Skip to content

Commit

Permalink
Merge pull request #2449 from ComputeCanada/make_multi_targets
Browse files Browse the repository at this point in the history
enhance ConfigureMake generic easyblock to add support for building multiple build targets
  • Loading branch information
smoors authored Jun 11, 2021
2 parents 144cf00 + d2f10fc commit 27b9ebc
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions easybuild/easyblocks/generic/configuremake.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
DEFAULT_CONFIGURE_CMD = './configure'
DEFAULT_BUILD_CMD = 'make'
DEFAULT_INSTALL_CMD = 'make install'
DEFAULT_BUILD_TARGET = ''


def check_config_guess(config_guess):
Expand Down Expand Up @@ -175,6 +176,7 @@ def extra_options(extra_vars=None):
extra_vars = EasyBlock.extra_options(extra=extra_vars)
extra_vars.update({
'build_cmd': [DEFAULT_BUILD_CMD, "Build command to use", CUSTOM],
'build_targets': [DEFAULT_BUILD_TARGET, "Target name (string) or list of target names to build", CUSTOM],
'build_type': [None, "Value to provide to --build option of configure script, e.g., x86_64-pc-linux-gnu "
"(determined by config.guess shipped with EasyBuild if None,"
" False implies to leave it up to the configure script)", CUSTOM],
Expand Down Expand Up @@ -320,14 +322,21 @@ def build_step(self, verbose=False, path=None):
if self.cfg['parallel']:
paracmd = "-j %s" % self.cfg['parallel']

cmd = ' '.join([
self.cfg['prebuildopts'],
self.cfg.get('build_cmd') or DEFAULT_BUILD_CMD,
paracmd,
self.cfg['buildopts'],
])

(out, _) = run_cmd(cmd, path=path, log_all=True, simple=False, log_output=verbose)
targets = self.cfg['build_targets'] or DEFAULT_BUILD_TARGET
# ensure strings are converted to list
targets = [targets] if isinstance(targets, str) else targets

for target in targets:
cmd = ' '.join([
self.cfg['prebuildopts'],
self.cfg.get('build_cmd') or DEFAULT_BUILD_CMD,
target,
paracmd,
self.cfg['buildopts'],
])
self.log.info("Building target '%s'", target)

(out, _) = run_cmd(cmd, path=path, log_all=True, simple=False, log_output=verbose)

return out

Expand Down

0 comments on commit 27b9ebc

Please sign in to comment.