@@ -291,6 +291,7 @@ def build(self, host_target):
291
291
llvm_cmake_options .define ('LLVM_INCLUDE_DOCS:BOOL' , 'TRUE' )
292
292
llvm_cmake_options .define ('LLVM_ENABLE_LTO:STRING' , self .args .lto_type )
293
293
llvm_cmake_options .define ('COMPILER_RT_INTERCEPT_LIBDISPATCH' , 'ON' )
294
+ llvm_cmake_options .define ('RUNTIMES_CMAKE_ARGS' , '-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR:BOOL=OFF' )
294
295
295
296
if self .args .build_embedded_stdlib and system () == "Darwin" :
296
297
# Ask for Mach-O cross-compilation builtins (for Embedded Swift)
@@ -299,10 +300,14 @@ def build(self, host_target):
299
300
'armv6 armv6m armv7 armv7m armv7em' )
300
301
301
302
llvm_enable_projects = ['clang' ]
303
+ llvm_enable_runtimes = []
302
304
303
305
if self .args .build_compiler_rt and \
304
306
not self .is_cross_compile_target (host_target ):
305
- llvm_enable_projects .append ('compiler-rt' )
307
+ llvm_enable_runtimes .append ('compiler-rt' )
308
+ build_targets .append ("runtimes" )
309
+ # This is needed to build correctly TSan under Linux
310
+ llvm_cmake_options .define ('COMPILER_RT_USE_BUILTINS_LIBRARY' , 'ON' )
306
311
307
312
if self .args .build_clang_tools_extra :
308
313
llvm_enable_projects .append ('clang-tools-extra' )
@@ -316,18 +321,20 @@ def build(self, host_target):
316
321
if self .args .build_lld :
317
322
llvm_enable_projects .append ('lld' )
318
323
324
+ if self .args .test :
325
+ # LLVMTestingSupport is not built at part of `all`
326
+ # and is required by some Swift tests
327
+ build_targets .append ('LLVMTestingSupport' )
328
+
319
329
llvm_cmake_options .define ('LLVM_ENABLE_PROJECTS' ,
320
330
';' .join (llvm_enable_projects ))
331
+ llvm_cmake_options .define ('LLVM_ENABLE_RUNTIMES' ,
332
+ ';' .join (llvm_enable_runtimes ))
321
333
322
- # In the near future we are aiming to build compiler-rt with
323
- # LLVM_ENABLE_RUNTIMES
324
- # Until that happens, we need to unset this variable from
325
- # LLVM CMakeCache.txt for two reasons
326
- # * prevent PRs testing this variable to affect other runs landing
327
- # unrelated features
328
- # * avoid fallouts should we land such change and then have to revert
329
- # it to account for unforeseen regressions
330
- llvm_cmake_options .undefine ('LLVM_ENABLE_RUNTIMES' )
334
+ # This accounts for previous incremental runs that may have set
335
+ # those in the LLVM CMakeCache.txt
336
+ llvm_cmake_options .undefine ('LLVM_TOOL_COMPILER_RT_BUILD' )
337
+ llvm_cmake_options .undefine ('LLVM_BUILD_EXTERNAL_COMPILER_RT' )
331
338
332
339
# NOTE: This is not a dead option! It is relied upon for certain
333
340
# bots/build-configs!
@@ -491,9 +498,19 @@ def install(self, host_target):
491
498
self .args .llvm_install_components != 'all' :
492
499
install_targets = []
493
500
components = self .args .llvm_install_components .split (';' )
501
+ if 'compiler-rt' in components :
502
+ # This is a courtesy fallback to avoid breaking downstream presets
503
+ # we are not aware of
504
+ components .remove ('compiler-rt' )
505
+ components .append ('builtins' )
506
+ components .append ('runtimes' )
507
+ print ('warning: replaced legacy LLVM component compiler-rt '
508
+ 'with builtins;runtimes -- consider updating your preset' ,
509
+ flush = True )
510
+
494
511
for component in components :
495
512
if self .is_cross_compile_target (host_target ):
496
- if component == 'compiler-rt' :
513
+ if component in [ 'builtins' , 'runtimes' ] :
497
514
continue
498
515
install_targets .append ('install-{}' .format (component ))
499
516
0 commit comments