@@ -242,6 +242,9 @@ def __init__(self, *args, **kwargs):
242242 """Initialize LLVM-specific variables."""
243243 super ().__init__ (* args , ** kwargs )
244244
245+ # List of (lower-case) dependencies
246+ self .deps = [dep ['name' ].lower () for dep in self .cfg .dependencies (runtime_only = True )]
247+
245248 if self .cfg ['usepolly' ] is not None :
246249 self .log .deprecated ("Use of easyconfig parameter 'usepolly', replace by 'use_polly'" , '6.0' )
247250 if self .cfg ['use_polly' ] is None :
@@ -439,9 +442,6 @@ def _configure_build_targets(self):
439442 print_warning ("Both 'amd_gfx_list' and build option 'amdgcn_capabilities' "
440443 "are set, please use only the build option 'amdgcn_capabilities'" )
441444
442- # List of (lower-case) dependencies
443- self .deps = [dep ['name' ].lower () for dep in self .cfg .dependencies ()]
444-
445445 # Build targets
446446 build_targets = self .cfg ['build_targets' ] or []
447447 if not build_targets :
@@ -527,6 +527,10 @@ def _configure_build_targets(self):
527527 self .general_opts ['CMAKE_BUILD_TYPE' ] = self .build_type
528528 self .general_opts ['LLVM_TARGETS_TO_BUILD' ] = self .list_to_cmake_arg (build_targets )
529529
530+ def get_dependency_root (self , name : str ):
531+ """Get software root of dependency. Return None if it is not a dependecy."""
532+ return get_software_root (name ) if name .lower () in self .deps else None
533+
530534 def prepare_step (self , * args , ** kwargs ):
531535 """Prepare step, modified to ensure install dir is deleted before building"""
532536 super ().prepare_step (* args , ** kwargs )
@@ -560,7 +564,7 @@ def _configure_final_build(self):
560564 self ._cmakeopts ['LLVM_ENABLE_PROJECTS' ] = self .list_to_cmake_arg (self .final_projects )
561565 self ._cmakeopts ['LLVM_ENABLE_RUNTIMES' ] = self .list_to_cmake_arg (self .final_runtimes )
562566
563- hwloc_root = get_software_root ('hwloc' )
567+ hwloc_root = self . get_dependency_root ('hwloc' )
564568 if hwloc_root :
565569 self .log .info ("Using %s as hwloc root" , hwloc_root )
566570 self ._cmakeopts ['LIBOMP_USE_HWLOC' ] = 'ON'
@@ -877,7 +881,7 @@ def configure_step(self):
877881
878882 # Dependencies based persistent options (should be reused across stages)
879883 # Libxml2
880- xml2_root = get_software_root ('libxml2' )
884+ xml2_root = self . get_dependency_root ('libxml2' )
881885 # Explicitly disable libxml2 if not found to avoid linking against system libxml2
882886 if xml2_root :
883887 if self .full_llvm :
@@ -888,24 +892,24 @@ def configure_step(self):
888892 else :
889893 self .general_opts ['LLVM_ENABLE_LIBXML2' ] = 'OFF'
890894
891- libffi_root = get_software_root ('libffi' )
895+ libffi_root = self . get_dependency_root ('libffi' )
892896 self .general_opts ['LLVM_ENABLE_FFI' ] = 'ON' if libffi_root else 'OFF'
893897 if libffi_root :
894898 self .general_opts ['FFI_INCLUDE_DIR' ] = os .path .join (libffi_root , 'include' )
895899 self .general_opts ['FFI_LIBRARY_DIR' ] = os .path .join (libffi_root , 'lib64' )
896900
897901 # If 'ON', risk finding a system zlib or zstd leading to including /usr/include as -isystem that can lead
898902 # to errors during compilation of 'offload.tools.kernelreplay' due to the inclusion of LLVMSupport (19.x)
899- self .general_opts ['LLVM_ENABLE_ZLIB' ] = 'ON' if get_software_root ( 'zlib' ) else 'OFF'
900- self .general_opts ['LLVM_ENABLE_ZSTD' ] = 'ON' if get_software_root ( 'zstd' ) else 'OFF'
903+ self .general_opts ['LLVM_ENABLE_ZLIB' ] = 'ON' if 'zlib' in self . deps else 'OFF'
904+ self .general_opts ['LLVM_ENABLE_ZSTD' ] = 'ON' if 'zstd' in self . deps else 'OFF'
901905 # Should not use system SWIG if present
902- self .general_opts ['LLDB_ENABLE_SWIG' ] = 'ON' if get_software_root ( 'SWIG' ) else 'OFF'
906+ self .general_opts ['LLDB_ENABLE_SWIG' ] = 'ON' if 'swig' in self . deps else 'OFF'
903907
904908 # Avoid using system `gdb` in case it is not provided as a dependency
905909 # This could cause the wrong sysroot/dynamic linker being picked up in a sysroot build causing tests to fail
906- self .general_opts ['LIBOMP_OMPD_GDB_SUPPORT' ] = 'ON' if get_software_root ( 'GDB' ) else 'OFF'
910+ self .general_opts ['LIBOMP_OMPD_GDB_SUPPORT' ] = 'ON' if 'gdb' in self . deps else 'OFF'
907911
908- z3_root = get_software_root ("Z3" )
912+ z3_root = self . get_dependency_root ("Z3" )
909913 if z3_root :
910914 self .log .info ("Using %s as Z3 root" , z3_root )
911915 self .general_opts ['LLVM_ENABLE_Z3_SOLVER' ] = 'ON'
@@ -967,7 +971,7 @@ def configure_step(self):
967971 # If we don't want to build with CUDA (not in dependencies) trick CMakes FindCUDA module into not finding it by
968972 # using the environment variable which is used as-is and later checked for a falsy value when determining
969973 # whether CUDA was found
970- if not get_software_root ( 'CUDA' ) :
974+ if 'cuda' not in self . deps :
971975 setvar ('CUDA_NVCC_EXECUTABLE' , 'IGNORE' )
972976
973977 # 20.1+ uses a generic IR for OpenMP DeviceRTL
@@ -1020,6 +1024,8 @@ def disable_sanitizer_tests(self):
10201024 cmakelists_tests = os .path .join (self .start_dir , 'compiler-rt' , 'test' , 'CMakeLists.txt' )
10211025 regex_subs = [(r'compiler_rt_test_runtime.*san.*' , '' )]
10221026 apply_regex_substitutions (cmakelists_tests , regex_subs )
1027+ if LooseVersion (self .version ) >= '20.1.0' :
1028+ self .general_opts ['OPENMP_TEST_ENABLE_TSAN' ] = 'OFF'
10231029
10241030 def add_cmake_opts (self ):
10251031 """Add LLVM-specific CMake options."""
0 commit comments