Skip to content

Commit cbfd7c2

Browse files
committed
LLVM product: extract logic to handle libcxx headers in a separate ...
... function This is done in anticipation of switching to use headers from the SDKs for Darwin, so to not grow any further the `build` method.
1 parent dcfeff7 commit cbfd7c2

File tree

1 file changed

+12
-9
lines changed
  • utils/swift_build_support/swift_build_support/products

1 file changed

+12
-9
lines changed

utils/swift_build_support/swift_build_support/products/llvm.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,18 @@ def build(self, host_target):
345345
self.cmake_options.extend(host_config.cmake_options)
346346
self.cmake_options.extend(llvm_cmake_options)
347347

348+
self._handle_cxx_headers(host_target, platform)
349+
350+
self.build_with_cmake(build_targets, self.args.llvm_build_variant, [])
351+
352+
# copy over the compiler-rt builtins for iOS/tvOS/watchOS to ensure
353+
# that Swift's stdlib can use compiler-rt builtins when targeting
354+
# iOS/tvOS/watchOS.
355+
if self.args.build_llvm and system() == 'Darwin':
356+
self.copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain(
357+
self.build_dir)
358+
359+
def _handle_cxx_headers(self, host_target, platform):
348360
# When we are building LLVM create symlinks to the c++ headers. We need
349361
# to do this before building LLVM since compiler-rt depends on being
350362
# built with the just built clang compiler. These are normally put into
@@ -386,15 +398,6 @@ def build(self, host_target):
386398
host_cxx_headers_dir, built_cxx_include_dir))
387399
shell.call(['ln', '-s', '-f', host_cxx_headers_dir, built_cxx_include_dir])
388400

389-
self.build_with_cmake(build_targets, self.args.llvm_build_variant, [])
390-
391-
# copy over the compiler-rt builtins for iOS/tvOS/watchOS to ensure
392-
# that Swift's stdlib can use compiler-rt builtins when targeting
393-
# iOS/tvOS/watchOS.
394-
if self.args.build_llvm and system() == 'Darwin':
395-
self.copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain(
396-
self.build_dir)
397-
398401
def should_test(self, host_target):
399402
"""should_test() -> Bool
400403

0 commit comments

Comments
 (0)