From ab9b0593818d41219cf4d61e9afaaf5d33d5fb7b Mon Sep 17 00:00:00 2001 From: Clemens Schmid Date: Mon, 24 Aug 2026 16:47:47 +0200 Subject: [PATCH 1/2] Add warnings options to scons --- SConstruct | 4 ++++ src/SConscript | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 6e566173..69173099 100644 --- a/SConstruct +++ b/SConstruct @@ -123,6 +123,10 @@ vars.Add(EnumVariable( 'build', 'compiler settings', 'fast', allowed_values=('debug', 'fast'))) +vars.Add(EnumVariable( + 'warnings', + 'warning flags policy', + 'all', allowed_values=('all', 'none', 'default'))) vars.Add(EnumVariable( 'tool', 'C++ compiler toolkit to be used', diff --git a/src/SConscript b/src/SConscript index 53d58878..a3e27522 100644 --- a/src/SConscript +++ b/src/SConscript @@ -42,7 +42,10 @@ else: fast_optimflags = ['-fast', '-no-ipo'] else: # g++ options - env.PrependUnique(CCFLAGS=['-Wall']) + if env['warnings'] == 'all': + env.PrependUnique(CCFLAGS=['-Wall']) + elif env['warnings'] == 'none': + env.PrependUnique(CCFLAGS=['-w']) fast_optimflags = ['-ffast-math'] # Configure build variants From 4a3a2bdff1372c3bc77f9b3bfadbe6aa5148726b Mon Sep 17 00:00:00 2001 From: Clemens Schmid Date: Mon, 29 Jun 2026 15:43:45 +0200 Subject: [PATCH 2/2] Only print compiler errors --- SConstruct | 7 ++++++- src/SConscript | 21 +++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/SConstruct b/SConstruct index 69173099..ea7b6a8a 100644 --- a/SConstruct +++ b/SConstruct @@ -126,7 +126,10 @@ vars.Add(EnumVariable( vars.Add(EnumVariable( 'warnings', 'warning flags policy', - 'all', allowed_values=('all', 'none', 'default'))) + 'none', allowed_values=('all', 'none', 'default'))) +vars.Add(BoolVariable( + 'verbose', + 'print build commands', False)) vars.Add(EnumVariable( 'tool', 'C++ compiler toolkit to be used', @@ -139,6 +142,8 @@ vars.Add(BoolVariable( 'compile and link with the shared cctbx library', False)) vars.Update(env) +SetOption('silent', not env['verbose']) +SetOption('no_progress', not env['verbose']) env.Help(MY_SCONS_HELP % vars.GenerateHelpText(env)) # the CPPPATH directories are checked by scons dependency scanner diff --git a/src/SConscript b/src/SConscript index a3e27522..6c8e75fe 100644 --- a/src/SConscript +++ b/src/SConscript @@ -30,14 +30,22 @@ if env['PLATFORM'] == 'darwin': if platform.system().lower() == "windows": # Visual c++ env.PrependUnique(CCFLAGS=['/Ox', '/EHsc', '/MD', '/DREAL=double']) + if env['warnings'] == 'none': + env.PrependUnique(CCFLAGS=['/w']) env.AppendUnique(CPPDEFINES={'NDEBUG': None}) # env.AppendUnique(LINKFLAGS='/EXPORT') else: # Use double precision for objcryst's REAL env.PrependUnique(CCFLAGS=['-DREAL=double']) + if env['warnings'] == 'none': + env.PrependUnique(LINKFLAGS=['-w']) if icpc: # options for Intel C++ compiler on hpc dev-intel07 - env.PrependUnique(CCFLAGS=['-w1', '-fp-model', 'precise']) + if env['warnings'] == 'none': + env.PrependUnique(CCFLAGS=['-w']) + else: + env.PrependUnique(CCFLAGS=['-w1']) + env.PrependUnique(CCFLAGS=['-fp-model', 'precise']) env.PrependUnique(LIBS=['imf']) fast_optimflags = ['-fast', '-no-ipo'] else: @@ -123,17 +131,6 @@ inc_target_path = lambda f: os.path.join(env['includedir'], include_targets = [inc_target_path(f) for f in env['lib_includes']] install_include = InstallAs(include_targets, env['lib_includes']) -# DEBUG installation -print("\nenv['lib_includes']:") -for f in env['lib_includes']: - print(f" {f.path}") -print("\ninclude_targets:") -for f in include_targets: - print(f" {f}") -print("\ninstall-include:") -for f in install_include: - print(f" {f.path}") - Alias('install-include', install_include) # install