get examples working

This commit is contained in:
Brendan Hansknecht 2023-09-21 23:45:25 -07:00
parent 398bf2f96c
commit 40a40ef6d2
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
18 changed files with 111 additions and 110 deletions

View file

@ -163,10 +163,10 @@ pub fn build_zig_host_native(
zig_cmd.args([
zig_host_src,
&format!("-femit-bin={emit_bin}"),
"--pkg-begin",
"--mod",
&format!("glue::{}", find_zig_glue_path().to_str().unwrap()),
"--deps",
"glue",
find_zig_glue_path().to_str().unwrap(),
"--pkg-end",
// include libc
"-lc",
// cross-compile?
@ -235,10 +235,10 @@ pub fn build_zig_host_native(
zig_cmd.args(&[
zig_host_src,
&format!("-femit-bin={}", emit_bin),
"--pkg-begin",
"--mod",
&format!("glue::{}", find_zig_glue_path().to_str().unwrap()),
"--deps",
"glue",
find_zig_glue_path().to_str().unwrap(),
"--pkg-end",
// include the zig runtime
// "-fcompiler-rt", compiler-rt causes segfaults on windows; investigate why
// include libc
@ -282,10 +282,10 @@ pub fn build_zig_host_wasm32(
"build-obj",
zig_host_src,
emit_bin,
"--pkg-begin",
"--mod",
&format!("glue::{}", find_zig_glue_path().to_str().unwrap()),
"--deps",
"glue",
find_zig_glue_path().to_str().unwrap(),
"--pkg-end",
// include the zig runtime
// "-fcompiler-rt",
// include libc
@ -1184,7 +1184,7 @@ fn get_macos_version() -> String {
full_version_string
.trim_end()
.split('.')
.take(2)
.take(3)
.collect::<Vec<&str>>()
.join(".")
}
@ -1208,10 +1208,10 @@ fn link_wasm32(
&format!("-femit-bin={}", output_path.to_str().unwrap()),
"-target",
"wasm32-wasi-musl",
"--pkg-begin",
"--mod",
&format!("glue::{}", find_zig_glue_path().to_str().unwrap()),
"--deps",
"glue",
find_zig_glue_path().to_str().unwrap(),
"--pkg-end",
"--strip",
"-O",
"ReleaseSmall",
@ -1239,10 +1239,10 @@ fn link_windows(
&format!("-femit-bin={}", output_path.to_str().unwrap()),
"-target",
"native",
"--pkg-begin",
"--mod",
&format!("glue::{}", find_zig_glue_path().to_str().unwrap()),
"--deps",
"glue",
find_zig_glue_path().to_str().unwrap(),
"--pkg-end",
"--strip",
"-O",
"Debug",

View file

@ -87,12 +87,12 @@ pub fn target_zig_str(target: &Triple) -> &'static str {
architecture: Architecture::X86_64,
operating_system: OperatingSystem::Darwin,
..
} => "x86_64-macos-gnu",
} => "x86_64-macos-none",
Triple {
architecture: Architecture::Aarch64(_),
operating_system: OperatingSystem::Darwin,
..
} => "aarch64-macos-gnu",
} => "aarch64-macos-none",
_ => internal_error!("TODO gracefully handle unsupported target: {:?}", target),
}
}