Merge branch 'main' into rebuild-platform

This commit is contained in:
Sam Mohr 2024-08-14 19:39:26 -07:00
commit 550baded7f
No known key found for this signature in database
GPG key ID: EA41D161A3C1BC99
657 changed files with 33813 additions and 21987 deletions

View file

@ -1083,6 +1083,10 @@ fn link_macos(
.args(input_paths)
.args(extra_link_flags());
if get_xcode_version() >= 15.0 {
ld_command.arg("-ld_classic");
}
let sdk_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib";
if Path::new(sdk_path).exists() {
ld_command.arg(format!("-L{sdk_path}"));
@ -1165,6 +1169,24 @@ fn get_macos_version() -> String {
.join(".")
}
fn get_xcode_version() -> f32 {
let mut cmd = Command::new("xcodebuild");
cmd.arg("-version");
debug_print_command(&cmd);
cmd.output()
.map_err(|_| ())
.and_then(|out| String::from_utf8(out.stdout).map_err(|_| ()))
.and_then(|str| {
str.split_whitespace()
.nth(1)
.map(|s| s.to_string())
.ok_or(())
})
.and_then(|version| version.parse::<f32>().map_err(|_| ()))
.unwrap_or(0.0)
}
fn link_wasm32(
_target: Target,
output_path: PathBuf,