Skip to content

Commit bd12562

Browse files
committed
Fix typo, rework how OSX_SYSROOT is used by llvm
1 parent 45c47d2 commit bd12562

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ def create_argument_parser():
13991399
'be called multiple times to add multiple such options.')
14001400

14011401
option('--llvm-build-compiler-rt-with-use-runtimes', toggle_true,
1402-
help='Switch to LLVM_USE_RUNTIMES as the mechanism to build compiler-rt'
1402+
help='Switch to LLVM_ENABLE_RUNTIMES as the mechanism to build compiler-rt'
14031403
'It will become the default with LLVM 21, this flag is '
14041404
'meant to stage its introduction and account for edge cases')
14051405

utils/swift_build_support/swift_build_support/products/cmake_product.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ class CMakeProduct(product.Product):
2323
def is_verbose(self):
2424
return self.args.verbose_build
2525

26-
@property
27-
def cmake_os_sysroot(self):
28-
return self._cmake_os_sysroot
29-
3026
def build_with_cmake(self, build_targets, build_type, build_args,
3127
prefer_native_toolchain=False):
3228
assert self.toolchain.cmake is not None
@@ -347,11 +343,11 @@ def host_cmake_options(self, host_target):
347343
option_name = 'SWIFTLIB_DEPLOYMENT_VERSION_{}'.format(sdk_target)
348344
swift_cmake_options.define(option_name, target_version)
349345

350-
self._cmake_os_sysroot = xcrun.sdk_path(sdk=platform)
346+
cmake_os_sysroot = xcrun.sdk_path(sdk=platform)
351347

352348
llvm_cmake_options.define('CMAKE_OSX_DEPLOYMENT_TARGET:STRING',
353349
cmake_osx_deployment_target)
354-
llvm_cmake_options.define('CMAKE_OSX_SYSROOT:PATH', self.cmake_os_sysroot)
350+
llvm_cmake_options.define('CMAKE_OSX_SYSROOT:PATH', cmake_os_sysroot)
355351
llvm_cmake_options.define('COMPILER_RT_ENABLE_IOS:BOOL', 'FALSE')
356352
llvm_cmake_options.define('COMPILER_RT_ENABLE_WATCHOS:BOOL', 'FALSE')
357353
llvm_cmake_options.define('COMPILER_RT_ENABLE_TVOS:BOOL', 'FALSE')
@@ -380,7 +376,7 @@ def host_cmake_options(self, host_target):
380376
self.args.darwin_deployment_version_tvos)
381377
swift_cmake_options.define('SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS',
382378
self.args.darwin_deployment_version_watchos)
383-
swift_cmake_options.define('CMAKE_OSX_SYSROOT:PATH', self.cmake_os_sysroot)
379+
swift_cmake_options.define('CMAKE_OSX_SYSROOT:PATH', cmake_os_sysroot)
384380
# This is needed to make sure to avoid using the wrong architecture
385381
# in the compiler checks CMake performs
386382
swift_cmake_options.define('CMAKE_OSX_ARCHITECTURES', arch)
@@ -419,4 +415,8 @@ def host_cmake_options(self, host_target):
419415

420416
llvm_cmake_options.define('COVERAGE_DB', self.args.coverage_db)
421417

422-
return (llvm_cmake_options, swift_cmake_options)
418+
# This provides easier access to certain settings
419+
# users may need without having to use CMakeOptions interface
420+
relevant_options = {'CMAKE_OSX_SYSROOT': cmake_os_sysroot}
421+
422+
return (llvm_cmake_options, swift_cmake_options, relevant_options)

utils/swift_build_support/swift_build_support/products/llvm.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def build(self, host_target):
225225

226226
(platform, arch) = host_target.split('-')
227227

228-
llvm_cmake_options = self.host_cmake_options(host_target)[0]
228+
llvm_cmake_options, _, relevant_options = self.host_cmake_options(host_target)
229229
llvm_cmake_options.extend_raw(self.args.llvm_cmake_options)
230230

231231
# TODO: handle cross compilation
@@ -307,13 +307,13 @@ def build(self, host_target):
307307
builtins_runtimes_target_for_darwin = 'arm64-apple-darwin'
308308
if system() == "Darwin":
309309
llvm_cmake_options.define(
310-
f'RUNTIMES_{builtins_runtimes_target_for_darwin}_'
310+
f'BUILTINS_{builtins_runtimes_target_for_darwin}_'
311311
'CMAKE_OSX_SYSROOT',
312-
self.cmake_os_sysroot)
312+
relevant_options['CMAKE_OSX_SYSROOT'])
313313
llvm_cmake_options.define(
314-
f'BUILTINS_{builtins_runtimes_target_for_darwin}_'
314+
f'RUNTIMES_{builtins_runtimes_target_for_darwin}_'
315315
'CMAKE_OSX_SYSROOT',
316-
self.cmake_os_sysroot)
316+
relevant_options['CMAKE_OSX_SYSROOT'])
317317
llvm_cmake_options.define(
318318
'LLVM_BUILTIN_TARGETS', builtins_runtimes_target_for_darwin)
319319
llvm_cmake_options.define(

validation-test/BuildSystem/llvm-build-compiler-rt-on-macosx.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
# LLVM-USE-RUNTIMES: Building llvm
1010
# LLVM-USE-RUNTIMES-DAG: cmake -G Ninja
11+
# LLVM-USE-RUNTIMES-SAME: -DBUILTINS_{{[^ ]*}}_CMAKE_OSX_SYSROOT
12+
# LLVM-USE-RUNTIMES-SAME: -DRUNTIMES_{{[^ ]*}}_CMAKE_OSX_SYSROOT
1113
# LLVM-USE-RUNTIMES-SAME: -DLLVM_BUILTIN_TARGETS
1214
# LLVM-USE-RUNTIMES-SAME: -DLLVM_RUNTIME_TARGETS
1315
# LLVM-USE-RUNTIMES-SAME: -DRUNTIMES_{{[^ ]*}}_COMPILER_RT_SANITIZERS_TO_BUILD

0 commit comments

Comments
 (0)