Skip to content

Commit

Permalink
Add option to set the default value of the toolchain option "debug"
Browse files Browse the repository at this point in the history
  • Loading branch information
Micket committed Oct 22, 2024
1 parent 8fc631d commit f76005c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions easybuild/tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ def mk_full_default_path(name, prefix=DEFAULT_PREFIX):
'cleanup_builddir',
'cleanup_easyconfigs',
'cleanup_tmpdir',
'default_debug_symbols',
'extended_dry_run_ignore_errors',
'fixed_installdir_naming_scheme',
'lib_lib64_symlink',
Expand Down
2 changes: 2 additions & 0 deletions easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ def override_options(self):
'debug-lmod': ("Run Lmod modules tool commands in debug module", None, 'store_true', False),
'default-opt-level': ("Specify default optimisation level", 'choice', 'store', DEFAULT_OPT_LEVEL,
Compiler.COMPILER_OPT_FLAGS),
'default-debug-symbols': ("Default value of debug toolchain option", 'choice', 'store', True,
[True, False]),
'deprecated': ("Run pretending to be (future) version, to test removal of deprecated code.",
None, 'store', None),
'detect-loaded-modules': ("Detect loaded EasyBuild-generated modules, act accordingly; "
Expand Down
10 changes: 9 additions & 1 deletion easybuild/tools/toolchain/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Compiler(Toolchain):
'loose': (False, "Loose precision"),
'veryloose': (False, "Very loose precision"),
'verbose': (False, "Verbose output"),
'debug': (False, "Enable debug"),
'debug': (build_option('default_debug_symbols'), "Enable debug"),
'i8': (False, "Integers are 8 byte integers"), # fortran only -> no: MKL and icc give -DMKL_ILP64
'r8': (False, "Real is 8 byte real"), # fortran only
'unroll': (False, "Unroll loops"),
Expand Down Expand Up @@ -175,6 +175,7 @@ def set_variables(self):

def _set_compiler_toolchainoptions(self):
"""Set the compiler related toolchain options"""
compiler_shared_opts = self.COMPILER_SHARED_OPTS.copy()
self.options.add_options(self.COMPILER_SHARED_OPTS, self.COMPILER_SHARED_OPTION_MAP)

# always include empty infix first for non-prefixed compilers (e.g., GCC, Intel, ...)
Expand Down Expand Up @@ -244,6 +245,13 @@ def _set_compiler_flags(self):
fflags = [self.options.option(x) for x in self.COMPILER_F_FLAGS + self.COMPILER_F_UNIQUE_FLAGS
if self.options.get(x, False)]

# Allow the user-defined default debug symbols
default_debug_symbols = build_option('default_debug_symbols')
if type(default_opt_level):
raise EasyBuildError(f"Bad value for default_debug_symbols: {default_debug_symbols}, should be bool")
else:


# Allow a user-defined default optimisation
default_opt_level = build_option('default_opt_level')
if default_opt_level not in self.COMPILER_OPT_FLAGS:
Expand Down

0 comments on commit f76005c

Please sign in to comment.