Skip to content

Commit 1fa9215

Browse files
committed
unix: define Apple SDK platform in YAML
1 parent e42363d commit 1fa9215

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

cpython-unix/build.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -119,26 +119,7 @@ def add_target_env(env, build_platform, target_triple, build_env):
119119
else:
120120
raise Exception("could not find minimum Apple SDK version in cflags")
121121

122-
if target_triple == "aarch64-apple-darwin":
123-
sdk_platform = "macosx"
124-
elif target_triple == "aarch64-apple-ios":
125-
# TODO arm64e not supported by open source Clang.
126-
# TODO add arm7 / arm7s?
127-
sdk_platform = "iphoneos"
128-
elif target_triple == "arm64-apple-tvos":
129-
sdk_platform = "appletvos"
130-
elif target_triple == "thumbv7k-apple-watchos":
131-
sdk_platform = "watchos"
132-
elif target_triple == "x86_64-apple-darwin":
133-
sdk_platform = "macosx"
134-
elif target_triple == "x86_64-apple-ios":
135-
sdk_platform = "iphonesimulator"
136-
elif target_triple == "x86_64-apple-tvos":
137-
sdk_platform = "appletvsimulator"
138-
elif target_triple == "x86_64-apple-watchos":
139-
sdk_platform = "watchsimulator"
140-
else:
141-
raise ValueError("unhandled target triple: %s" % target_triple)
122+
sdk_platform = settings["apple_sdk_platform"]
142123

143124
env["TARGET_TRIPLE"] = target_triple
144125
env["PATH"] = "/usr/bin:/bin"

cpython-unix/targets.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
#
3131
# Values will be added to LDFLAGS.
3232
#
33+
# apple_sdk_platform
34+
# Name of the Apple SDK platform to use when building.
35+
#
36+
# Value is fed into `xcrun --sdk` to locate the Apple SDK.
37+
#
38+
# Required when targeting Apple.
39+
#
3340
# openssl_target
3441
# Name of OpenSSL platform build target.
3542

@@ -45,6 +52,7 @@ aarch64-apple-darwin:
4552
needs_toolchain: true
4653
host_cc: clang
4754
target_cc: clang
55+
apple_sdk_platform: macosx
4856
target_cflags:
4957
- '-arch'
5058
- 'arm64'
@@ -71,6 +79,7 @@ aarch64-apple-ios:
7179
host_platforms:
7280
- darwin
7381
needs_toolchain: true
82+
apple_sdk_platform: iphoneos
7483
host_cc: clang
7584
target_cc: clang
7685
target_cflags:
@@ -121,6 +130,7 @@ arm64-apple-tvos:
121130
host_platforms:
122131
- darwin
123132
needs_toolchain: true
133+
apple_sdk_platform: appletvos
124134
host_cc: clang
125135
target_cc: clang
126136
target_cflags:
@@ -316,6 +326,7 @@ thumb7k-apple-watchos:
316326
host_platforms:
317327
- darwin
318328
needs_toolchain: true
329+
apple_sdk_platform: watchos
319330
host_cc: clang
320331
target_cc: clang
321332
target_cflags:
@@ -340,6 +351,7 @@ thumb7k-apple-watchos:
340351
x86_64-apple-darwin:
341352
host_platforms:
342353
- darwin
354+
apple_sdk_platform: macosx
343355
host_cc: clang
344356
target_cc: clang
345357
target_cflags:
@@ -368,6 +380,7 @@ x86_64-apple-ios:
368380
host_platforms:
369381
- darwin
370382
needs_toolchain: true
383+
apple_sdk_platform: iphonesimulator
371384
host_cc: clang
372385
target_cc: clang
373386
target_cflags:
@@ -390,6 +403,7 @@ x86_64-apple-tvos:
390403
host_platforms:
391404
- darwin
392405
needs_toolchain: true
406+
apple_sdk_platform: appletvsimulator
393407
host_cc: clang
394408
target_cc: clang
395409
target_cflags:
@@ -410,6 +424,7 @@ x86_64-apple-watchos:
410424
host_platforms:
411425
- darwin
412426
needs_toolchain: true
427+
apple_sdk_platform: watchsimulator
413428
host_cc: clang
414429
target_cc: clang
415430
target_cflags:

0 commit comments

Comments
 (0)