Skip to content

Commit

Permalink
Introduce a 'generator' option for CMakeMake
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Aug 14, 2020
1 parent 6e0a55f commit 67fa728
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions easybuild/easyblocks/generic/cmakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def extra_options(extra_vars=None):
'build_type': [None, "Build type for CMake, e.g. Release."
"Defaults to 'Release' or 'Debug' depending on toolchainopts[debug]", CUSTOM],
'configure_cmd': [DEFAULT_CONFIGURE_CMD, "Configure command to use", CUSTOM],
'generator': [None, "Build file generator to use. None to use CMakes default", CUSTOM],
'srcdir': [None, "Source directory location to provide to cmake command", CUSTOM],
'separate_build_dir': [True, "Perform build in a separate directory", CUSTOM],
})
Expand Down Expand Up @@ -157,6 +158,9 @@ def configure_step(self, srcdir=None, builddir=None):
if self.toolchain.options['pic']:
options.append('-DCMAKE_POSITION_INDEPENDENT_CODE=ON')

if self.cfg['generator']:
options.append('-G "%s"' % self.cfg['generator'])

# Set flag for shared libs if requested
# Not adding one allows the project to choose a default
build_shared_libs = self.cfg.get('build_shared_libs')
Expand Down
7 changes: 7 additions & 0 deletions easybuild/easyblocks/generic/cmakeninja.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
class CMakeNinja(CMakeMake, MesonNinja):
"""Support for configuring with CMake, building and installing with MesonNinja."""

@staticmethod
def extra_options(extra_vars=None):
"""Define extra easyconfig parameters specific to CMakeMake."""
extra_vars = CMakeMake.extra_options(extra_vars)
extra_vars['generator'][0] = 'Ninja'
return extra_vars

def configure_step(self, *args, **kwargs):
"""Configure using CMake."""
self.cfg.update('configopts', '-G Ninja')
Expand Down

0 comments on commit 67fa728

Please sign in to comment.