Skip to content

Commit 4dc6689

Browse files
timofey-soloninSpace Team
authored and
Space Team
committed
[Native] Support Xcode 15.3 — add back the TargetConditional.h macros
^KT-65542
1 parent d3b2c6f commit 4dc6689

File tree

1 file changed

+25
-0
lines changed
  • native/utils/src/org/jetbrains/kotlin/konan/target

1 file changed

+25
-0
lines changed

native/utils/src/org/jetbrains/kotlin/konan/target/ClangArgs.kt

+25
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,31 @@ sealed class ClangArgs(
151151
if (environmentOsVersionMinRequired != null) {
152152
add(listOf("-D__ENVIRONMENT_OS_VERSION_MIN_REQUIRED__=$environmentOsVersionMinRequired"))
153153
}
154+
155+
val targetConditionals = when (target) {
156+
KonanTarget.MACOS_ARM64, KonanTarget.MACOS_X64 -> hashMapOf(
157+
"TARGET_OS_OSX" to "1",
158+
)
159+
KonanTarget.IOS_ARM64 -> hashMapOf(
160+
"TARGET_OS_EMBEDDED" to "1",
161+
"TARGET_OS_IPHONE" to "1",
162+
"TARGET_OS_IOS" to "1",
163+
)
164+
KonanTarget.TVOS_ARM64 -> hashMapOf(
165+
"TARGET_OS_EMBEDDED" to "1",
166+
"TARGET_OS_IPHONE" to "1",
167+
"TARGET_OS_TV" to "1",
168+
)
169+
KonanTarget.WATCHOS_ARM64, KonanTarget.WATCHOS_ARM32, KonanTarget.WATCHOS_DEVICE_ARM64 -> hashMapOf(
170+
"TARGET_OS_EMBEDDED" to "1",
171+
"TARGET_OS_IPHONE" to "1",
172+
"TARGET_OS_WATCH" to "1",
173+
)
174+
else -> null
175+
}
176+
if (targetConditionals != null) {
177+
add(targetConditionals.map { "-D${it.key}=${it.value}" })
178+
}
154179
}.flatten()
155180

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

0 commit comments

Comments
 (0)