Skip to content

Commit 99f83a4

Browse files
authored
Add scons options for compilation verbosity (#32)
* Add warnings options to scons * Only print compiler errors
1 parent 2e5fd3d commit 99f83a4

2 files changed

Lines changed: 22 additions & 13 deletions

File tree

SConstruct

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ vars.Add(EnumVariable(
123123
'build',
124124
'compiler settings',
125125
'fast', allowed_values=('debug', 'fast')))
126+
vars.Add(EnumVariable(
127+
'warnings',
128+
'warning flags policy',
129+
'none', allowed_values=('all', 'none', 'default')))
130+
vars.Add(BoolVariable(
131+
'verbose',
132+
'print build commands', False))
126133
vars.Add(EnumVariable(
127134
'tool',
128135
'C++ compiler toolkit to be used',
@@ -135,6 +142,8 @@ vars.Add(BoolVariable(
135142
'compile and link with the shared cctbx library', False))
136143

137144
vars.Update(env)
145+
SetOption('silent', not env['verbose'])
146+
SetOption('no_progress', not env['verbose'])
138147
env.Help(MY_SCONS_HELP % vars.GenerateHelpText(env))
139148

140149
# the CPPPATH directories are checked by scons dependency scanner

src/SConscript

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,30 @@ if env['PLATFORM'] == 'darwin':
3030
if platform.system().lower() == "windows":
3131
# Visual c++
3232
env.PrependUnique(CCFLAGS=['/Ox', '/EHsc', '/MD', '/DREAL=double'])
33+
if env['warnings'] == 'none':
34+
env.PrependUnique(CCFLAGS=['/w'])
3335
env.AppendUnique(CPPDEFINES={'NDEBUG': None})
3436
# env.AppendUnique(LINKFLAGS='/EXPORT')
3537
else:
3638
# Use double precision for objcryst's REAL
3739
env.PrependUnique(CCFLAGS=['-DREAL=double'])
40+
if env['warnings'] == 'none':
41+
env.PrependUnique(LINKFLAGS=['-w'])
3842
if icpc:
3943
# options for Intel C++ compiler on hpc dev-intel07
40-
env.PrependUnique(CCFLAGS=['-w1', '-fp-model', 'precise'])
44+
if env['warnings'] == 'none':
45+
env.PrependUnique(CCFLAGS=['-w'])
46+
else:
47+
env.PrependUnique(CCFLAGS=['-w1'])
48+
env.PrependUnique(CCFLAGS=['-fp-model', 'precise'])
4149
env.PrependUnique(LIBS=['imf'])
4250
fast_optimflags = ['-fast', '-no-ipo']
4351
else:
4452
# g++ options
45-
env.PrependUnique(CCFLAGS=['-Wall'])
53+
if env['warnings'] == 'all':
54+
env.PrependUnique(CCFLAGS=['-Wall'])
55+
elif env['warnings'] == 'none':
56+
env.PrependUnique(CCFLAGS=['-w'])
4657
fast_optimflags = ['-ffast-math']
4758

4859
# Configure build variants
@@ -120,17 +131,6 @@ inc_target_path = lambda f: os.path.join(env['includedir'],
120131
include_targets = [inc_target_path(f) for f in env['lib_includes']]
121132
install_include = InstallAs(include_targets, env['lib_includes'])
122133

123-
# DEBUG installation
124-
print("\nenv['lib_includes']:")
125-
for f in env['lib_includes']:
126-
print(f" {f.path}")
127-
print("\ninclude_targets:")
128-
for f in include_targets:
129-
print(f" {f}")
130-
print("\ninstall-include:")
131-
for f in install_include:
132-
print(f" {f.path}")
133-
134134
Alias('install-include', install_include)
135135

136136
# install

0 commit comments

Comments
 (0)