Skip to content

Commit 2349af1

Browse files
committed
Preserve options set by CMakeMake configure_step
1 parent d230fe6 commit 2349af1

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

easybuild/easyblocks/l/llvm.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@
127127
'Python3_FIND_VIRTUALENV': 'STANDARD',
128128
'LLVM_INSTALL_UTILS': 'ON',
129129
'LLVM_INCLUDE_BENCHMARKS': 'OFF',
130-
'CMAKE_VERBOSE_MAKEFILE': 'ON',
131130
}
132131

133132

@@ -343,11 +342,6 @@ def __init__(self, *args, **kwargs):
343342
else:
344343
self.log.info("Using AMDGPU targets: %s", ', '.join(self.amd_gfx))
345344

346-
general_opts['CMAKE_BUILD_TYPE'] = self.build_type
347-
general_opts['CMAKE_INSTALL_PREFIX'] = self.installdir
348-
if self.toolchain.options['pic']:
349-
general_opts['CMAKE_POSITION_INDEPENDENT_CODE'] = 'ON'
350-
351345
general_opts['LLVM_TARGETS_TO_BUILD'] = '"%s"' % ';'.join(build_targets)
352346

353347
self._cmakeopts = {}
@@ -494,6 +488,20 @@ def configure_step(self):
494488
builddir=self.llvm_obj_dir_stage1,
495489
srcdir=os.path.join(self.llvm_src_dir, "llvm")
496490
)
491+
# Inherit _cfgopts from the configure_step of CMakeMake parent class
492+
for item in self.cfg.get('configopts', '').split():
493+
if not item:
494+
continue
495+
if item.startswith('-D'):
496+
key = item.split('=')[0][2:]
497+
# Skip flags that where already set by _cmakeopts to allow overriding them in multistage build
498+
if key in self._cmakeopts:
499+
continue
500+
# Skip compiler options to allow overriding in multistage build
501+
# They were already set and used for the 1st stage build
502+
if key.endswith('_COMPILER'):
503+
continue
504+
self._cfgopts.append(item)
497505

498506
def disable_sanitizer_tests(self):
499507
"""Disable the tests of all the sanitizers by removing the test directories from the build system"""
@@ -507,7 +515,9 @@ def add_cmake_opts(self):
507515
"""Add LLVM-specific CMake options."""
508516
base_opts = self._cfgopts.copy()
509517
for k, v in self._cmakeopts.items():
510-
base_opts.append('-D%s=%s' % (k, v))
518+
chk = '-D%s=' % k
519+
if not any(opt.startswith(chk) for opt in self._cfgopts):
520+
base_opts.append('-D%s=%s' % (k, v))
511521
self.cfg['configopts'] = ' '.join(base_opts)
512522

513523
def configure_step2(self):

0 commit comments

Comments
 (0)