Skip to content

Commit

Permalink
[Native] Support Xcode 15.3 — add back the TargetConditional.h macros
Browse files Browse the repository at this point in the history
^KT-65542
  • Loading branch information
timofey-solonin authored and qodana-bot committed Feb 29, 2024
1 parent d3b2c6f commit 4dc6689
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions native/utils/src/org/jetbrains/kotlin/konan/target/ClangArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,31 @@ sealed class ClangArgs(
if (environmentOsVersionMinRequired != null) {
add(listOf("-D__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__=$environmentOsVersionMinRequired"))
}

val targetConditionals = when (target) {
KonanTarget.MACOS_ARM64, KonanTarget.MACOS_X64 -> hashMapOf(
"TARGET_OS_OSX" to "1",
)
KonanTarget.IOS_ARM64 -> hashMapOf(
"TARGET_OS_EMBEDDED" to "1",
"TARGET_OS_IPHONE" to "1",
"TARGET_OS_IOS" to "1",
)
KonanTarget.TVOS_ARM64 -> hashMapOf(
"TARGET_OS_EMBEDDED" to "1",
"TARGET_OS_IPHONE" to "1",
"TARGET_OS_TV" to "1",
)
KonanTarget.WATCHOS_ARM64, KonanTarget.WATCHOS_ARM32, KonanTarget.WATCHOS_DEVICE_ARM64 -> hashMapOf(
"TARGET_OS_EMBEDDED" to "1",
"TARGET_OS_IPHONE" to "1",
"TARGET_OS_WATCH" to "1",
)
else -> null
}
if (targetConditionals != null) {
add(targetConditionals.map { "-D${it.key}=${it.value}" })
}
}.flatten()

private val specificClangArgs: List<String> = when (target) {
Expand Down

0 comments on commit 4dc6689

Please sign in to comment.