Merge pull request #5467 from harold-b/hb.ios-subtarget-rename-iphone

Rename `iOS` subtarget to `iPhone`, add `ODIN_PLATFORM_SUBTARGET_IOS`
This commit is contained in:
gingerBill
2025-07-20 13:22:47 +01:00
committed by GitHub
7 changed files with 18 additions and 26 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ ODIN_OS_STRING :: ODIN_OS_STRING
/* /*
An `enum` value indicating the platform subtarget, chosen using the `-subtarget` switch. An `enum` value indicating the platform subtarget, chosen using the `-subtarget` switch.
Possible values are: `.Default` `.iOS`, .iPhoneSimulator, and `.Android`. Possible values are: `.Default` `.iPhone`, .iPhoneSimulator, and `.Android`.
*/ */
ODIN_PLATFORM_SUBTARGET :: ODIN_PLATFORM_SUBTARGET ODIN_PLATFORM_SUBTARGET :: ODIN_PLATFORM_SUBTARGET
+3 -1
View File
@@ -557,7 +557,7 @@ ALL_ODIN_OS_TYPES :: Odin_OS_Types{
// Defined internally by the compiler // Defined internally by the compiler
Odin_Platform_Subtarget_Type :: enum int { Odin_Platform_Subtarget_Type :: enum int {
Default, Default,
iOS, iPhone,
iPhoneSimulator iPhoneSimulator
Android, Android,
} }
@@ -566,6 +566,8 @@ Odin_Platform_Subtarget_Type :: type_of(ODIN_PLATFORM_SUBTARGET)
Odin_Platform_Subtarget_Types :: bit_set[Odin_Platform_Subtarget_Type] Odin_Platform_Subtarget_Types :: bit_set[Odin_Platform_Subtarget_Type]
@(builtin)
ODIN_PLATFORM_SUBTARGET_IOS :: ODIN_PLATFORM_SUBTARGET == .iPhone || ODIN_PLATFORM_SUBTARGET == .iPhoneSimulator
/* /*
// Defined internally by the compiler // Defined internally by the compiler
+5 -15
View File
@@ -3,23 +3,13 @@ package darwin
// #define OS_WAIT_ON_ADDR_AVAILABILITY \ // #define OS_WAIT_ON_ADDR_AVAILABILITY \
// __API_AVAILABLE(macos(14.4), ios(17.4), tvos(17.4), watchos(10.4)) // __API_AVAILABLE(macos(14.4), ios(17.4), tvos(17.4), watchos(10.4))
when ODIN_OS == .Darwin { when ODIN_OS == .Darwin {
when ODIN_PLATFORM_SUBTARGET_IOS {
when ODIN_PLATFORM_SUBTARGET == .iOS && ODIN_MINIMUM_OS_VERSION >= 17_04_00 { WAIT_ON_ADDRESS_AVAILABLE :: ODIN_MINIMUM_OS_VERSION >= 17_04_00
WAIT_ON_ADDRESS_AVAILABLE :: true ULOCK_WAIT_2_AVAILABLE :: ODIN_MINIMUM_OS_VERSION >= 14_00_00
} else when ODIN_MINIMUM_OS_VERSION >= 14_04_00 {
WAIT_ON_ADDRESS_AVAILABLE :: true
} else { } else {
WAIT_ON_ADDRESS_AVAILABLE :: false WAIT_ON_ADDRESS_AVAILABLE :: ODIN_MINIMUM_OS_VERSION >= 14_04_00
ULOCK_WAIT_2_AVAILABLE :: ODIN_MINIMUM_OS_VERSION >= 11_00_00
} }
when ODIN_PLATFORM_SUBTARGET == .iOS && ODIN_MINIMUM_OS_VERSION >= 14_00_00 {
ULOCK_WAIT_2_AVAILABLE :: true
} else when ODIN_MINIMUM_OS_VERSION >= 11_00_00 {
ULOCK_WAIT_2_AVAILABLE :: true
} else {
ULOCK_WAIT_2_AVAILABLE :: false
}
} else { } else {
WAIT_ON_ADDRESS_AVAILABLE :: false WAIT_ON_ADDRESS_AVAILABLE :: false
ULOCK_WAIT_2_AVAILABLE :: false ULOCK_WAIT_2_AVAILABLE :: false
+1 -1
View File
@@ -28,7 +28,7 @@ init_platform :: proc() {
macos_version = {int(version.majorVersion), int(version.minorVersion), int(version.patchVersion)} macos_version = {int(version.majorVersion), int(version.minorVersion), int(version.patchVersion)}
when ODIN_PLATFORM_SUBTARGET == .iOS { when ODIN_PLATFORM_SUBTARGET_IOS {
os_version.platform = .iOS os_version.platform = .iOS
ws(&b, "iOS") ws(&b, "iOS")
} else { } else {
+6 -6
View File
@@ -171,7 +171,7 @@ struct TargetMetrics {
enum Subtarget : u32 { enum Subtarget : u32 {
Subtarget_Default, Subtarget_Default,
Subtarget_iOS, Subtarget_iPhone,
Subtarget_iPhoneSimulator, Subtarget_iPhoneSimulator,
Subtarget_Android, Subtarget_Android,
@@ -180,7 +180,7 @@ enum Subtarget : u32 {
gb_global String subtarget_strings[Subtarget_COUNT] = { gb_global String subtarget_strings[Subtarget_COUNT] = {
str_lit(""), str_lit(""),
str_lit("ios"), str_lit("iphone"),
str_lit("iphonesimulator"), str_lit("iphonesimulator"),
str_lit("android"), str_lit("android"),
}; };
@@ -1828,13 +1828,13 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
if (metrics->os == TargetOs_darwin) { if (metrics->os == TargetOs_darwin) {
switch (subtarget) { switch (subtarget) {
case Subtarget_iOS: case Subtarget_iPhone:
switch (metrics->arch) { switch (metrics->arch) {
case TargetArch_arm64: case TargetArch_arm64:
bc->metrics.target_triplet = str_lit("arm64-apple-ios"); bc->metrics.target_triplet = str_lit("arm64-apple-ios");
break; break;
default: default:
GB_PANIC("Unknown architecture for -subtarget:ios"); GB_PANIC("Unknown architecture for -subtarget:iphone");
} }
break; break;
case Subtarget_iPhoneSimulator: case Subtarget_iPhoneSimulator:
@@ -1909,7 +1909,7 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
if (!bc->minimum_os_version_string_given) { if (!bc->minimum_os_version_string_given) {
if (subtarget == Subtarget_Default) { if (subtarget == Subtarget_Default) {
bc->minimum_os_version_string = str_lit("11.0.0"); bc->minimum_os_version_string = str_lit("11.0.0");
} else if (subtarget == Subtarget_iOS || subtarget == Subtarget_iPhoneSimulator) { } else if (subtarget == Subtarget_iPhone || subtarget == Subtarget_iPhoneSimulator) {
// NOTE(harold): We default to 17.4 on iOS because that's when os_sync_wait_on_address was added and // 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. // 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"); bc->minimum_os_version_string = str_lit("17.4");
@@ -1917,7 +1917,7 @@ gb_internal void init_build_context(TargetMetrics *cross_target, Subtarget subta
} }
if (subtarget == Subtarget_iPhoneSimulator) { if (subtarget == Subtarget_iPhoneSimulator) {
// For the iOS simulator subtarget, the version must be between 'ios' and '-simulator'. // For the iPhoneSimulator subtarget, the version must be between 'ios' and '-simulator'.
String suffix = str_lit("-simulator"); String suffix = str_lit("-simulator");
GB_ASSERT(string_ends_with(bc->metrics.target_triplet, suffix)); GB_ASSERT(string_ends_with(bc->metrics.target_triplet, suffix));
+1 -1
View File
@@ -1172,7 +1172,7 @@ gb_internal void init_universal(void) {
{ {
GlobalEnumValue values[Subtarget_COUNT] = { GlobalEnumValue values[Subtarget_COUNT] = {
{"Default", Subtarget_Default}, {"Default", Subtarget_Default},
{"iOS", Subtarget_iOS}, {"iPhone", Subtarget_iPhone},
{"iPhoneSimulator", Subtarget_iPhoneSimulator}, {"iPhoneSimulator", Subtarget_iPhoneSimulator},
{"Android", Subtarget_Android}, {"Android", Subtarget_Android},
}; };
+1 -1
View File
@@ -787,7 +787,7 @@ try_cross_linking:;
// being set to 'MacOSX' even though we've set the sysroot to the correct SDK (-Wincompatible-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. // This is because it is likely not using the SDK's toolchain Apple Clang but another one installed in the system.
switch (selected_subtarget) { switch (selected_subtarget) {
case Subtarget_iOS: case Subtarget_iPhone:
darwin_platform_name = "iPhoneOS"; darwin_platform_name = "iPhoneOS";
darwin_xcrun_sdk_name = "iphoneos"; darwin_xcrun_sdk_name = "iphoneos";
darwin_min_version_id = "ios"; darwin_min_version_id = "ios";