diff --git a/SConstruct b/SConstruct index 6e56617..ea7b6a8 100644 --- a/SConstruct +++ b/SConstruct @@ -123,6 +123,13 @@ vars.Add(EnumVariable( 'build', 'compiler settings', 'fast', allowed_values=('debug', 'fast'))) +vars.Add(EnumVariable( + 'warnings', + 'warning flags policy', + 'none', allowed_values=('all', 'none', 'default'))) +vars.Add(BoolVariable( + 'verbose', + 'print build commands', False)) vars.Add(EnumVariable( 'tool', 'C++ compiler toolkit to be used', @@ -135,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 53d5887..6c8e75f 100644 --- a/src/SConscript +++ b/src/SConscript @@ -30,19 +30,30 @@ 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: # 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 @@ -120,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