aboutsummaryrefslogtreecommitdiff
path: root/src/linker.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2025-07-14 18:11:28 +0100
committerGitHub <noreply@github.com>2025-07-14 18:11:28 +0100
commit02e5dc9948cfa4e0b96219d63bfd10c91591ec88 (patch)
tree168d6d68cd5dec1d21d5034ed2dbe8702adcc611 /src/linker.cpp
parent362c146f9dd995c7880a2a7a63e13784ee940dad (diff)
parent070943aa9865bda8c163dc76fde70a2602d447c4 (diff)
Merge pull request #5465 from harold-b/hb.ios-min-version-linker-fix
Provide default minimum version for iOS and apply its target triplet.
Diffstat (limited to 'src/linker.cpp')
-rw-r--r--src/linker.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/linker.cpp b/src/linker.cpp
index bf7705282..413995e0d 100644
--- a/src/linker.cpp
+++ b/src/linker.cpp
@@ -431,8 +431,10 @@ try_cross_linking:;
// Link using `clang`, unless overridden by `ODIN_CLANG_PATH` environment variable.
const char* clang_path = gb_get_env("ODIN_CLANG_PATH", permanent_allocator());
+ bool has_odin_clang_path_env = true;
if (clang_path == NULL) {
clang_path = "clang";
+ has_odin_clang_path_env = false;
}
// NOTE(vassvik): needs to add the root to the library search paths, so that the full filenames of the library
@@ -779,6 +781,8 @@ try_cross_linking:;
char const* darwin_xcrun_sdk_name = "macosx";
char const* darwin_min_version_id = "macosx";
+ const char* original_clang_path = clang_path;
+
// NOTE(harold): We set the clang_path to run through xcrun because otherwise it complaints about the the sysroot
// being set to 'MacOSX' even though we've set the sysroot to the correct SDK (-Wincompatible-sysroot).
// This is because it is likely not using the SDK's toolchain Apple Clang but another one installed in the system.
@@ -787,18 +791,20 @@ try_cross_linking:;
darwin_platform_name = "iPhoneOS";
darwin_xcrun_sdk_name = "iphoneos";
darwin_min_version_id = "ios";
- clang_path = "xcrun --sdk iphoneos clang";
+ if (!has_odin_clang_path_env) {
+ clang_path = "xcrun --sdk iphoneos clang";
+ }
break;
case Subtarget_iPhoneSimulator:
darwin_platform_name = "iPhoneSimulator";
darwin_xcrun_sdk_name = "iphonesimulator";
darwin_min_version_id = "ios-simulator";
- clang_path = "xcrun --sdk iphonesimulator clang";
+ if (!has_odin_clang_path_env) {
+ clang_path = "xcrun --sdk iphonesimulator clang";
+ }
break;
}
- const char* original_clang_path = clang_path;
-
gbString darwin_find_sdk_cmd = gb_string_make(temporary_allocator(), "");
darwin_find_sdk_cmd = gb_string_append_fmt(darwin_find_sdk_cmd, "xcrun --sdk %s --show-sdk-path", darwin_xcrun_sdk_name);