@@ -353,18 +353,81 @@ def __init__(self, *args, **kwargs):
353353 if LooseVersion (self .version ) < LooseVersion ('16' ):
354354 general_opts ['LLVM_INCLUDE_GO_TESTS' ] = 'OFF'
355355
356- # Sysroot
357- self .sysroot = build_option ('sysroot' )
358- if self .sysroot :
359- if LooseVersion (self .version ) < LooseVersion ('19' ):
360- raise EasyBuildError ("Using sysroot is not supported by EasyBuild for LLVM < 19" )
361- general_opts ['DEFAULT_SYSROOT' ] = self .sysroot
362- general_opts ['CMAKE_SYSROOT' ] = self .sysroot
363- self ._set_dynamic_linker ()
364- trace_msg (f"Using '{ self .dynamic_linker } ' as dynamic linker from sysroot { self .sysroot } " )
356+ self .log .info ("Final projects to build: %s" , ', ' .join (self .final_projects ))
357+ self .log .info ("Final runtimes to build: %s" , ', ' .join (self .final_runtimes ))
365358
366- self .ignore_patterns = self .cfg ['test_suite_ignore_patterns' ] or []
359+ self ._cmakeopts = {}
360+ self ._cfgopts = list (filter (None , self .cfg .get ('configopts' , '' ).split ()))
361+
362+ def prepare_step (self , * args , ** kwargs ):
363+ """Prepare step, modified to ensure install dir is deleted before building"""
364+ super (EB_LLVM , self ).prepare_step (* args , ** kwargs )
365+ # re-create installation dir (deletes old installation),
366+ # Needed to ensure hardcoded rpath do not point to old installation during runtime builds and testing
367+ self .make_installdir ()
368+
369+ def _add_cmake_runtime_args (self ):
370+ """Generate the value for 'RUNTIMES_CMAKE_ARGS' and add it to the cmake options."""
371+ if self .runtimes_cmake_args :
372+ args = []
373+ for key , val in self .runtimes_cmake_args .items ():
374+ if isinstance (val , list ):
375+ val = ' ' .join (val )
376+ if val :
377+ args .append ('-D%s=%s' % (key , val ))
378+ self ._cmakeopts ['RUNTIMES_CMAKE_ARGS' ] = '"%s"' % ';' .join (args )
379+
380+ def _configure_general_build (self ):
381+ """General configuration step for LLVM."""
382+ self ._cmakeopts .update (general_opts )
383+ self ._add_cmake_runtime_args ()
384+
385+ def _configure_intermediate_build (self ):
386+ """Configure the intermediate stages of the build."""
387+ self ._cmakeopts ['LLVM_ENABLE_PROJECTS' ] = '"%s"' % ';' .join (self .intermediate_projects )
388+ self ._cmakeopts ['LLVM_ENABLE_RUNTIMES' ] = '"%s"' % ';' .join (self .intermediate_runtimes )
389+
390+ def _configure_final_build (self ):
391+ """Configure the final stage of the build."""
392+ self ._cmakeopts ['LLVM_ENABLE_PROJECTS' ] = '"%s"' % ';' .join (self .final_projects )
393+ self ._cmakeopts ['LLVM_ENABLE_RUNTIMES' ] = '"%s"' % ';' .join (self .final_runtimes )
367394
395+ hwloc_root = get_software_root ('hwloc' )
396+ if hwloc_root :
397+ self .log .info ("Using %s as hwloc root" , hwloc_root )
398+ self ._cmakeopts ['LIBOMP_USE_HWLOC' ] = 'ON'
399+ self ._cmakeopts ['LIBOMP_HWLOC_INSTALL_DIR' ] = hwloc_root
400+
401+ if 'openmp' in self .final_projects :
402+ if LooseVersion (self .version ) >= LooseVersion ('19' ) and self .cfg ['build_openmp_offload' ]:
403+ self .runtimes_cmake_args ['LIBOMPTARGET_PLUGINS_TO_BUILD' ] = '%s' % '|' .join (self .offload_targets )
404+ self ._cmakeopts ['OPENMP_ENABLE_LIBOMPTARGET' ] = 'ON'
405+ self ._cmakeopts ['LIBOMP_INSTALL_ALIASES' ] = 'OFF'
406+ if not self .cfg ['build_openmp_tools' ]:
407+ self ._cmakeopts ['OPENMP_ENABLE_OMPT_TOOLS' ] = 'OFF'
408+
409+ # Make sure tests are not running with more than 'parallel' tasks
410+ parallel = self .cfg .parallel
411+ if not build_option ('mpi_tests' ):
412+ parallel = 1
413+ lit_args = [f'-j { parallel } ' ]
414+ if self .cfg ['debug_tests' ]:
415+ lit_args += ['-v' ]
416+ timeout_single = self .cfg ['test_suite_timeout_single' ]
417+ if timeout_single :
418+ lit_args += ['--timeout' , str (timeout_single )]
419+ timeout_total = self .cfg ['test_suite_timeout_total' ]
420+ if timeout_total :
421+ lit_args += ['--max-time' , str (timeout_total )]
422+ self ._cmakeopts ['LLVM_LIT_ARGS' ] = '"%s"' % ' ' .join (lit_args )
423+
424+ if self .cfg ['usepolly' ]:
425+ self ._cmakeopts ['LLVM_POLLY_LINK_INTO_TOOLS' ] = 'ON'
426+ if not self .cfg ['skip_all_tests' ]:
427+ self ._cmakeopts ['LLVM_INCLUDE_TESTS' ] = 'ON'
428+ self ._cmakeopts ['LLVM_BUILD_TESTS' ] = 'ON'
429+
430+ def _configure_build_targets (self ):
368431 # list of CUDA compute capabilities to use can be specifed in two ways (where (2) overrules (1)):
369432 # (1) in the easyconfig file, via the custom cuda_compute_capabilities;
370433 # (2) in the EasyBuild configuration, via --cuda-compute-capabilities configuration option;
@@ -460,77 +523,6 @@ def __init__(self, *args, **kwargs):
460523 general_opts ['CMAKE_BUILD_TYPE' ] = self .build_type
461524 general_opts ['LLVM_TARGETS_TO_BUILD' ] = '"%s"' % ';' .join (build_targets )
462525
463- self ._cmakeopts = {}
464- self ._cfgopts = list (filter (None , self .cfg .get ('configopts' , '' ).split ()))
465-
466- def prepare_step (self , * args , ** kwargs ):
467- """Prepare step, modified to ensure install dir is deleted before building"""
468- super (EB_LLVM , self ).prepare_step (* args , ** kwargs )
469- # re-create installation dir (deletes old installation),
470- # Needed to ensure hardcoded rpath do not point to old installation during runtime builds and testing
471- self .make_installdir ()
472-
473- def _add_cmake_runtime_args (self ):
474- """Generate the value for 'RUNTIMES_CMAKE_ARGS' and add it to the cmake options."""
475- if self .runtimes_cmake_args :
476- args = []
477- for key , val in self .runtimes_cmake_args .items ():
478- if isinstance (val , list ):
479- val = ' ' .join (val )
480- if val :
481- args .append ('-D%s=%s' % (key , val ))
482- self ._cmakeopts ['RUNTIMES_CMAKE_ARGS' ] = '"%s"' % ';' .join (args )
483-
484- def _configure_general_build (self ):
485- """General configuration step for LLVM."""
486- self ._cmakeopts .update (general_opts )
487- self ._add_cmake_runtime_args ()
488-
489- def _configure_intermediate_build (self ):
490- """Configure the intermediate stages of the build."""
491- self ._cmakeopts ['LLVM_ENABLE_PROJECTS' ] = '"%s"' % ';' .join (self .intermediate_projects )
492- self ._cmakeopts ['LLVM_ENABLE_RUNTIMES' ] = '"%s"' % ';' .join (self .intermediate_runtimes )
493-
494- def _configure_final_build (self ):
495- """Configure the final stage of the build."""
496- self ._cmakeopts ['LLVM_ENABLE_PROJECTS' ] = '"%s"' % ';' .join (self .final_projects )
497- self ._cmakeopts ['LLVM_ENABLE_RUNTIMES' ] = '"%s"' % ';' .join (self .final_runtimes )
498-
499- hwloc_root = get_software_root ('hwloc' )
500- if hwloc_root :
501- self .log .info ("Using %s as hwloc root" , hwloc_root )
502- self ._cmakeopts ['LIBOMP_USE_HWLOC' ] = 'ON'
503- self ._cmakeopts ['LIBOMP_HWLOC_INSTALL_DIR' ] = hwloc_root
504-
505- if 'openmp' in self .final_projects :
506- if LooseVersion (self .version ) >= LooseVersion ('19' ) and self .cfg ['build_openmp_offload' ]:
507- self .runtimes_cmake_args ['LIBOMPTARGET_PLUGINS_TO_BUILD' ] = '%s' % '|' .join (self .offload_targets )
508- self ._cmakeopts ['OPENMP_ENABLE_LIBOMPTARGET' ] = 'ON'
509- self ._cmakeopts ['LIBOMP_INSTALL_ALIASES' ] = 'OFF'
510- if not self .cfg ['build_openmp_tools' ]:
511- self ._cmakeopts ['OPENMP_ENABLE_OMPT_TOOLS' ] = 'OFF'
512-
513- # Make sure tests are not running with more than 'parallel' tasks
514- parallel = self .cfg .parallel
515- if not build_option ('mpi_tests' ):
516- parallel = 1
517- lit_args = [f'-j { parallel } ' ]
518- if self .cfg ['debug_tests' ]:
519- lit_args += ['-v' ]
520- timeout_single = self .cfg ['test_suite_timeout_single' ]
521- if timeout_single :
522- lit_args += ['--timeout' , str (timeout_single )]
523- timeout_total = self .cfg ['test_suite_timeout_total' ]
524- if timeout_total :
525- lit_args += ['--max-time' , str (timeout_total )]
526- self ._cmakeopts ['LLVM_LIT_ARGS' ] = '"%s"' % ' ' .join (lit_args )
527-
528- if self .cfg ['usepolly' ]:
529- self ._cmakeopts ['LLVM_POLLY_LINK_INTO_TOOLS' ] = 'ON'
530- if not self .cfg ['skip_all_tests' ]:
531- self ._cmakeopts ['LLVM_INCLUDE_TESTS' ] = 'ON'
532- self ._cmakeopts ['LLVM_BUILD_TESTS' ] = 'ON'
533-
534526 @staticmethod
535527 def _get_gcc_prefix ():
536528 """Get the GCC prefix for the build."""
@@ -603,6 +595,8 @@ def _set_dynamic_linker(self):
603595 def _update_test_ignore_patterns (self ):
604596 """Update the ignore patterns based on known ignorable test failures when running with specific LLVM versions
605597 or with specific dependencies/options."""
598+ self .ignore_patterns = self .cfg ['test_suite_ignore_patterns' ] or []
599+
606600 new_ignore_patterns = []
607601 if self .sysroot :
608602 # Some tests will run a FileCheck on the output of `clang -v` for `-internal-externc-isystem /usr/include`
@@ -673,6 +667,18 @@ def configure_step(self):
673667 if self .cfg .parallel :
674668 self .make_parallel_opts = f"-j { self .cfg .parallel } "
675669
670+ self ._configure_build_targets ()
671+
672+ # Sysroot
673+ self .sysroot = build_option ('sysroot' )
674+ if self .sysroot :
675+ if LooseVersion (self .version ) < LooseVersion ('19' ):
676+ raise EasyBuildError ("Using sysroot is not supported by EasyBuild for LLVM < 19" )
677+ general_opts ['DEFAULT_SYSROOT' ] = self .sysroot
678+ general_opts ['CMAKE_SYSROOT' ] = self .sysroot
679+ self ._set_dynamic_linker ()
680+ trace_msg (f"Using '{ self .dynamic_linker } ' as dynamic linker from sysroot { self .sysroot } " )
681+
676682 # CMAKE_INSTALL_PREFIX and LLVM start directory are set here instead of in __init__ to
677683 # ensure this easyblock can be used as a Bundle component, see
678684 # https://github.com/easybuilders/easybuild-easyblocks/issues/3680
0 commit comments