Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CMake configopts when iterating (multiple builds) #2885

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 12 additions & 6 deletions easybuild/easyblocks/generic/cmakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,20 @@ def build_type(self):
build_type = 'Debug' if self.toolchain.options.get('debug', None) else 'Release'
return build_type

def prepend_config_opts(self, config_opts):
"""Prepends configure options (-Dkey=value) to configopts ignoring those already set"""
def combine_config_opts(self, config_opts_default):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a good approach to fix #2881, since it removes a method (prepend_config_opts) from a commonly used generic easyblock like CMakeMake.
Although we don't have any easyblocks in the central repository that derive from CMakeMake and call prepend_config_opts, sites could have their own easyblocks that do, so we shouldn't be breaking the API like this.

As mentioned, not updating configopts in place also has other downsides, like easyblocks deriving from CMakeMake not being able to inspect the modified configopts.

"""Combine configure options (-Dkey=value) from config_opts_default with those from the EC

-- config_opts_default: Dictionary mapping keys (variable names) to values.
Those will be prepended to the ECs configopts if they are set by the EC,
i.e. if they would be overwritten/duplicated.
"""
cfg_configopts = self.cfg['configopts']
# All options are of the form '-D<key>=<value>'
new_opts = ' '.join('-D%s=%s' % (key, value) for key, value in config_opts.items()
new_opts = ' '.join('-D%s=%s' % (key, value) for key, value in config_opts_default.items()
if '-D%s=' % key not in cfg_configopts)
self.cfg['configopts'] = ' '.join([new_opts, cfg_configopts])
if new_opts and cfg_configopts:
new_opts += ' '
return new_opts + cfg_configopts

def configure_step(self, srcdir=None, builddir=None):
"""Configure build using cmake"""
Expand Down Expand Up @@ -286,12 +293,11 @@ def configure_step(self, srcdir=None, builddir=None):
options['Boost_NO_SYSTEM_PATHS'] = 'ON'

if self.cfg.get('configure_cmd') == DEFAULT_CONFIGURE_CMD:
self.prepend_config_opts(options)
command = ' '.join([
self.cfg['preconfigopts'],
DEFAULT_CONFIGURE_CMD,
generator,
self.cfg['configopts'],
self.combine_config_opts(options),
srcdir])
else:
command = ' '.join([
Expand Down