Merge branch 'master' into master

This commit is contained in:
WP. Yingamphol
2025-07-15 12:35:06 +07:00
committed by GitHub
80 changed files with 182 additions and 100 deletions

View File

@@ -145,7 +145,7 @@ ODIN_OS_STRING :: ODIN_OS_STRING
/*
An `enum` value indicating the platform subtarget, chosen using the `-subtarget` switch.
Possible values are: `.Default` `.iOS`, and `.Android`.
Possible values are: `.Default` `.iOS`, .iPhoneSimulator, and `.Android`.
*/
ODIN_PLATFORM_SUBTARGET :: ODIN_PLATFORM_SUBTARGET

View File

@@ -558,6 +558,7 @@ ALL_ODIN_OS_TYPES :: Odin_OS_Types{
Odin_Platform_Subtarget_Type :: enum int {
Default,
iOS,
iPhoneSimulator
Android,
}
*/

View File

@@ -3,7 +3,7 @@
package runtime
when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -5,7 +5,7 @@ package libc
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -3,7 +3,7 @@ package libc
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -5,7 +5,7 @@ package libc
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -5,7 +5,7 @@ import "core:c"
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -7,7 +7,7 @@ import "base:intrinsics"
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -5,7 +5,7 @@ package libc
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -5,7 +5,7 @@ package libc
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -9,7 +9,7 @@ when ODIN_OS == .Windows {
"system:legacy_stdio_definitions.lib",
}
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -5,7 +5,7 @@ package libc
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -7,7 +7,7 @@ import "base:runtime"
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -5,7 +5,7 @@ package libc
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -5,7 +5,7 @@ package libc
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -5,7 +5,7 @@ package libc
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -5,7 +5,7 @@ package libc
when ODIN_OS == .Windows {
foreign import libc "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -23,7 +23,7 @@ package net
import "core:strings"
import "core:sys/posix"
foreign import lib "system:System.framework"
foreign import lib "system:System"
@(private)
_enumerate_interfaces :: proc(allocator := context.allocator) -> (interfaces: []Network_Interface, err: Interfaces_Error) {

View File

@@ -10,7 +10,7 @@ import "core:sys/posix"
import "core:sys/unix"
import "core:time"
foreign import lib "system:System.framework"
foreign import lib "system:System"
foreign lib {
sysctl :: proc(

View File

@@ -1,8 +1,8 @@
package os
foreign import dl "system:dl"
foreign import libc "system:System.framework"
foreign import pthread "system:System.framework"
foreign import libc "system:System"
foreign import pthread "system:System"
import "base:runtime"
import "core:strings"

View File

@@ -6,7 +6,7 @@ import "core:c"
import "core:sys/darwin"
import "core:time"
foreign import System "system:System.framework"
foreign import System "system:System"
foreign System {
// __ulock_wait is not available on 10.15

View File

@@ -5,7 +5,7 @@ package sync
import "core:c"
import "base:intrinsics"
foreign import pthread "system:System.framework"
foreign import pthread "system:System"
_current_thread_id :: proc "contextless" () -> int {
tid: u64

View File

@@ -62,7 +62,7 @@ global_block_descriptor := Block_Descriptor{
size = size_of(Internal_Block_Literal),
}
foreign import libSystem "system:System.framework"
foreign import libSystem "system:System"
foreign libSystem {
_NSConcreteGlobalBlock: intrinsics.objc_class
_NSConcreteStackBlock: intrinsics.objc_class

View File

@@ -4,7 +4,7 @@ package darwin
import "core:c"
@(export)
foreign import system "system:System.framework"
foreign import system "system:System"
Bool :: b8

View File

@@ -1,6 +1,6 @@
package darwin
foreign import mach "system:System.framework"
foreign import mach "system:System"
import "core:c"
import "base:intrinsics"

View File

@@ -4,7 +4,7 @@ import "base:intrinsics"
import "core:sys/posix"
foreign import lib "system:System.framework"
foreign import lib "system:System"
// Incomplete bindings to the proc API on MacOS, add to when needed.

View File

@@ -2,7 +2,7 @@
package kqueue
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else when ODIN_OS == .Haiku {
foreign import lib "system:network"
} else {

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else when ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD {
foreign import lib "system:dl"
} else {

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -2,7 +2,7 @@
package posix
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -6,7 +6,7 @@ import "base:intrinsics"
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -6,7 +6,7 @@ import "base:intrinsics"
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -9,7 +9,7 @@ import "core:c/libc"
when ODIN_OS == .Windows {
foreign import lib "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -10,7 +10,7 @@ when ODIN_OS == .Windows {
"system:legacy_stdio_definitions.lib",
}
} else when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -6,7 +6,7 @@ import "base:intrinsics"
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -9,7 +9,7 @@ import "core:c/libc"
when ODIN_OS == .Windows {
foreign import lib "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
when ODIN_OS == .Windows {
foreign import lib "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -6,7 +6,7 @@ import "base:intrinsics"
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -2,7 +2,7 @@
package posix
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import libc "system:System.framework"
foreign import libc "system:System"
} else {
foreign import libc "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -5,7 +5,7 @@ import "core:c"
import "core:c/libc"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -6,7 +6,7 @@ import "core:c"
when ODIN_OS == .Windows {
foreign import lib "system:libucrt.lib"
} else when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -2,7 +2,7 @@
package posix
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -4,7 +4,7 @@ package posix
import "core:c"
when ODIN_OS == .Darwin {
foreign import lib "system:System.framework"
foreign import lib "system:System"
} else {
foreign import lib "system:c"
}

View File

@@ -172,6 +172,7 @@ struct TargetMetrics {
enum Subtarget : u32 {
Subtarget_Default,
Subtarget_iOS,
Subtarget_iPhoneSimulator,
Subtarget_Android,
Subtarget_COUNT,
@@ -180,6 +181,7 @@ enum Subtarget : u32 {
gb_global String subtarget_strings[Subtarget_COUNT] = {
str_lit(""),
str_lit("ios"),
str_lit("iphonesimulator"),
str_lit("android"),
};
@@ -1824,16 +1826,29 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
}
}
if (metrics->os == TargetOs_darwin && subtarget == Subtarget_iOS) {
switch (metrics->arch) {
case TargetArch_arm64:
bc->metrics.target_triplet = str_lit("arm64-apple-ios");
break;
case TargetArch_amd64:
bc->metrics.target_triplet = str_lit("x86_64-apple-ios");
break;
default:
GB_PANIC("Unknown architecture for darwin");
if (metrics->os == TargetOs_darwin) {
switch (subtarget) {
case Subtarget_iOS:
switch (metrics->arch) {
case TargetArch_arm64:
bc->metrics.target_triplet = str_lit("arm64-apple-ios");
break;
default:
GB_PANIC("Unknown architecture for -subtarget:ios");
}
break;
case Subtarget_iPhoneSimulator:
switch (metrics->arch) {
case TargetArch_arm64:
bc->metrics.target_triplet = str_lit("arm64-apple-ios-simulator");
break;
case TargetArch_amd64:
bc->metrics.target_triplet = str_lit("x86_64-apple-ios-simulator");
break;
default:
GB_PANIC("Unknown architecture for -subtarget:iphonesimulator");
}
break;
}
} else if (metrics->os == TargetOs_linux && subtarget == Subtarget_Android) {
switch (metrics->arch) {
@@ -1892,10 +1907,23 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
// does not annoy the user with version warnings.
if (metrics->os == TargetOs_darwin) {
if (!bc->minimum_os_version_string_given) {
bc->minimum_os_version_string = str_lit("11.0.0");
if (subtarget == Subtarget_Default) {
bc->minimum_os_version_string = str_lit("11.0.0");
} else if (subtarget == Subtarget_iOS || subtarget == Subtarget_iPhoneSimulator) {
// NOTE(harold): We default to 17.4 on iOS because that's when os_sync_wait_on_address was added and
// we'd like to avoid any potential App Store issues by using the private ulock_* there.
bc->minimum_os_version_string = str_lit("17.4");
}
}
if (subtarget == Subtarget_Default) {
if (subtarget == Subtarget_iPhoneSimulator) {
// For the iOS simulator subtarget, the version must be between 'ios' and '-simulator'.
String suffix = str_lit("-simulator");
GB_ASSERT(string_ends_with(bc->metrics.target_triplet, suffix));
String prefix = substring(bc->metrics.target_triplet, 0, bc->metrics.target_triplet.len - suffix.len);
bc->metrics.target_triplet = concatenate3_strings(permanent_allocator(), prefix, bc->minimum_os_version_string, suffix);
} else {
bc->metrics.target_triplet = concatenate_strings(permanent_allocator(), bc->metrics.target_triplet, bc->minimum_os_version_string);
}
} else if (selected_subtarget == Subtarget_Android) {

View File

@@ -1171,9 +1171,10 @@ gb_internal void init_universal(void) {
{
GlobalEnumValue values[Subtarget_COUNT] = {
{"Default", Subtarget_Default},
{"iOS", Subtarget_iOS},
{"Android", Subtarget_Android},
{"Default", Subtarget_Default},
{"iOS", Subtarget_iOS},
{"iPhoneSimulator", Subtarget_iPhoneSimulator},
{"Android", Subtarget_Android},
};
auto fields = add_global_enum_type(str_lit("Odin_Platform_Subtarget_Type"), values, gb_count_of(values));

View File

@@ -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
@@ -591,7 +593,7 @@ try_cross_linking:;
// Do not add libc again, this is added later already, and omitted with
// the `-no-crt` flag, not skipping here would cause duplicate library
// warnings when linking on darwin and might link libc silently even with `-no-crt`.
if (lib == str_lit("System.framework") || lib == str_lit("c")) {
if (lib == str_lit("System.framework") || lib == str_lit("System") || lib == str_lit("c")) {
continue;
}
@@ -772,10 +774,58 @@ try_cross_linking:;
gbString platform_lib_str = gb_string_make(heap_allocator(), "");
defer (gb_string_free(platform_lib_str));
if (build_context.metrics.os == TargetOs_darwin) {
// Get the MacOSX SDK path.
// Get the SDK path.
gbString darwin_sdk_path = gb_string_make(temporary_allocator(), "");
if (!system_exec_command_line_app_output("xcrun --sdk macosx --show-sdk-path", &darwin_sdk_path)) {
darwin_sdk_path = gb_string_set(darwin_sdk_path, "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk");
char const* darwin_platform_name = "MacOSX";
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.
switch (selected_subtarget) {
case Subtarget_iOS:
darwin_platform_name = "iPhoneOS";
darwin_xcrun_sdk_name = "iphoneos";
darwin_min_version_id = "ios";
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";
if (!has_odin_clang_path_env) {
clang_path = "xcrun --sdk iphonesimulator clang";
}
break;
}
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);
if (!system_exec_command_line_app_output(darwin_find_sdk_cmd, &darwin_sdk_path)) {
// Fallback to default clang, since `xcrun --sdk` did not work.
clang_path = original_clang_path;
// Best-effort fallback to known locations
gbString darwin_sdk_path = gb_string_make(temporary_allocator(), "");
darwin_sdk_path = gb_string_append_fmt(darwin_sdk_path, "/Library/Developer/CommandLineTools/SDKs/%s.sdk", darwin_platform_name);
if (!path_is_directory(make_string_c(darwin_sdk_path))) {
gb_string_clear(darwin_sdk_path);
darwin_sdk_path = gb_string_append_fmt(darwin_sdk_path, "/Applications/Xcode.app/Contents/Developer/Platforms/%s.platform/Developer/SDKs/%s.sdk", darwin_platform_name);
if (!path_is_directory(make_string_c(darwin_sdk_path))) {
gb_printf_err("Failed to find %s SDK\n", darwin_platform_name);
return -1;
}
}
} else {
// Trim the trailing newline.
darwin_sdk_path = gb_string_trim_space(darwin_sdk_path);
@@ -796,8 +846,10 @@ try_cross_linking:;
// Only specify this flag if the user has given a minimum version to target.
// This will cause warnings to show up for mismatched libraries.
if (build_context.minimum_os_version_string_given) {
link_settings = gb_string_append_fmt(link_settings, "-mmacosx-version-min=%.*s ", LIT(build_context.minimum_os_version_string));
// NOTE(harold): For device subtargets we have to explicitly set the default version to
// avoid the same warning since we configure our own minimum version when compiling for devices.
if (build_context.minimum_os_version_string_given || selected_subtarget != Subtarget_Default) {
link_settings = gb_string_append_fmt(link_settings, "-m%s-version-min=%.*s ", darwin_min_version_id, LIT(build_context.minimum_os_version_string));
}
if (build_context.build_mode != BuildMode_DynamicLibrary) {

View File

@@ -242,7 +242,7 @@ struct lbGenerator : LinkerData {
MPSCQueue<lbEntityCorrection> entities_to_correct_linkage;
MPSCQueue<lbObjCGlobal> objc_selectors;
MPSCQueue<lbObjCGlobal> objc_classes;
MPSCQueue<lbObjCGlobal> objc_ivars;
MPSCQueue<lbObjCGlobal> objc_ivars;
MPSCQueue<String> raddebug_section_strings;
};

View File

@@ -174,9 +174,9 @@ gb_internal bool lb_init_generator(lbGenerator *gen, Checker *c) {
mpsc_init(&gen->entities_to_correct_linkage, heap_allocator());
mpsc_init(&gen->objc_selectors, heap_allocator());
mpsc_init(&gen->objc_classes, heap_allocator());
mpsc_init(&gen->objc_ivars, heap_allocator());
mpsc_init(&gen->objc_ivars, heap_allocator());
mpsc_init(&gen->raddebug_section_strings, heap_allocator());
return true;
}

View File

@@ -5797,7 +5797,7 @@ gb_internal AstPackage *try_add_import_path(Parser *p, String path, String const
for (FileInfo fi : list) {
String name = fi.name;
String ext = path_extension(name);
if (ext == FILE_EXT && !path_is_directory(name)) {
if (ext == FILE_EXT && !fi.is_dir) {
files_with_ext += 1;
}
if (ext == FILE_EXT && !is_excluded_target_filename(name)) {
@@ -5822,7 +5822,7 @@ gb_internal AstPackage *try_add_import_path(Parser *p, String path, String const
for (FileInfo fi : list) {
String name = fi.name;
String ext = path_extension(name);
if (ext == FILE_EXT && !path_is_directory(name)) {
if (ext == FILE_EXT && !fi.is_dir) {
if (is_excluded_target_filename(name)) {
continue;
}