mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
build a builtins .obj file for windows cross-compilation
This commit is contained in:
parent
d9db0b7096
commit
42ef5d1977
4 changed files with 21 additions and 1 deletions
|
@ -42,6 +42,7 @@ pub fn build(b: *Builder) void {
|
||||||
|
|
||||||
// Generate Object Files
|
// Generate Object Files
|
||||||
generateObjectFile(b, mode, host_target, main_path, "object", "builtins-host");
|
generateObjectFile(b, mode, host_target, main_path, "object", "builtins-host");
|
||||||
|
generateObjectFile(b, mode, windows64_target, main_path, "windows-x86_64-object", "builtins-windows-x86_64");
|
||||||
generateObjectFile(b, mode, wasm32_target, main_path, "wasm32-object", "builtins-wasm32");
|
generateObjectFile(b, mode, wasm32_target, main_path, "wasm32-object", "builtins-wasm32");
|
||||||
|
|
||||||
removeInstallSteps(b);
|
removeInstallSteps(b);
|
||||||
|
|
|
@ -253,7 +253,9 @@ test "" {
|
||||||
|
|
||||||
// Export it as weak incase it is already linked in by something else.
|
// Export it as weak incase it is already linked in by something else.
|
||||||
comptime {
|
comptime {
|
||||||
@export(__muloti4, .{ .name = "__muloti4", .linkage = .Weak });
|
if (builtin.target.os.tag != .windows) {
|
||||||
|
@export(__muloti4, .{ .name = "__muloti4", .linkage = .Weak });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fn __muloti4(a: i128, b: i128, overflow: *c_int) callconv(.C) i128 {
|
fn __muloti4(a: i128, b: i128, overflow: *c_int) callconv(.C) i128 {
|
||||||
// @setRuntimeSafety(std.builtin.is_test);
|
// @setRuntimeSafety(std.builtin.is_test);
|
||||||
|
|
|
@ -60,6 +60,12 @@ fn main() {
|
||||||
|
|
||||||
generate_object_file(&bitcode_path, "object", BUILTINS_HOST_FILE);
|
generate_object_file(&bitcode_path, "object", BUILTINS_HOST_FILE);
|
||||||
|
|
||||||
|
generate_object_file(
|
||||||
|
&bitcode_path,
|
||||||
|
"windows-x86_64-object",
|
||||||
|
"builtins-windows-x86_64.obj",
|
||||||
|
);
|
||||||
|
|
||||||
generate_object_file(&bitcode_path, "wasm32-object", "builtins-wasm32.o");
|
generate_object_file(&bitcode_path, "wasm32-object", "builtins-wasm32.o");
|
||||||
|
|
||||||
copy_zig_builtins_to_target_dir(&bitcode_path);
|
copy_zig_builtins_to_target_dir(&bitcode_path);
|
||||||
|
|
|
@ -14,6 +14,17 @@ pub fn get_builtins_host_obj_path() -> String {
|
||||||
.expect("Failed to convert builtins_host_path to str")
|
.expect("Failed to convert builtins_host_path to str")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_builtins_windows_obj_path() -> String {
|
||||||
|
let builtins_host_path = get_lib_path()
|
||||||
|
.expect(LIB_DIR_ERROR)
|
||||||
|
.join("builtins-windows-x86_64.obj");
|
||||||
|
|
||||||
|
builtins_host_path
|
||||||
|
.into_os_string()
|
||||||
|
.into_string()
|
||||||
|
.expect("Failed to convert builtins_host_path to str")
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_builtins_wasm32_obj_path() -> String {
|
pub fn get_builtins_wasm32_obj_path() -> String {
|
||||||
let builtins_wasm32_path = get_lib_path()
|
let builtins_wasm32_path = get_lib_path()
|
||||||
.expect(LIB_DIR_ERROR)
|
.expect(LIB_DIR_ERROR)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue