Skip to content
Snippets Groups Projects
Commit 6e7c2485 authored by Edward Brash's avatar Edward Brash
Browse files

Implement 'scons cppcheck=1'

Generate cppcheck_report.txt in the top level directory.
parent 7a9ba6d3
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,8 @@ To compile with debug capabilities, do
`scons debug=1`
To compile the standalone codes the are part of podd, do
`scons standalone=1`
To run cppcheck (if installed) on the Hall C src diretory, do
`scons cppcheck=1`
Running
-------
......
......@@ -105,6 +105,37 @@ except OSError:
bld = Builder(action=rootcint)
baseenv.Append(BUILDERS = {'RootCint': bld})
######## cppcheck ###########################
def which(program):
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None
proceed = "1" or "y" or "yes" or "Yes" or "Y"
if baseenv.subst('$CPPCHECK')==proceed:
is_cppcheck = which('cppcheck')
print "Path to cppcheck is %s\n" % is_cppcheck
if(is_cppcheck == None):
print('!!! cppcheck not found on this system. Check if cppcheck is installed and in your PATH.')
Exit(1)
else:
cppcheck_command = baseenv.Command('cppcheck_report.txt',[],"cppcheck --quiet --enable=all src/ 2> $TARGET")
baseenv.AlwaysBuild(cppcheck_command)
####### Start of main SConstruct ############
hallclib = 'HallC'
......
......@@ -5,6 +5,8 @@ def config(env,args):
debug = args.get('debug',0)
standalone = args.get('standalone',0)
cppcheck = args.get('cppcheck',0)
if int(debug):
env.Append(CXXFLAGS = '-g -O0')
else:
......@@ -14,6 +16,9 @@ def config(env,args):
if int(standalone):
env.Append(STANDALONE= '1')
if int(cppcheck):
env.Append(CPPCHECK= '1')
#env.Append(CXXFLAGS = '-Wall -Woverloaded-virtual -pthread -rdynamic')
env.Append(CXXFLAGS = '-Wall -Woverloaded-virtual -pthread')
env.Append(CPPDEFINES = '-DMACVERS')
......
......@@ -5,6 +5,8 @@ def config(env,args):
debug = args.get('debug',0)
standalone = args.get('standalone',0)
cppcheck = args.get('cppcheck',0)
if int(debug):
env.Append(CXXFLAGS = '-g -O0')
else:
......@@ -14,6 +16,9 @@ def config(env,args):
if int(standalone):
env.Append(STANDALONE= '1')
if int(cppcheck):
env.Append(CPPCHECK= '1')
env.Append(CXXFLAGS = '-m32 -Wall -Woverloaded-virtual')
env.Append(CPPDEFINES = '-DLINUXVERS')
......
......@@ -5,6 +5,8 @@ def config(env,args):
debug = args.get('debug',0)
standalone = args.get('standalone',0)
cppcheck = args.get('cppcheck',0)
if int(debug):
env.Append(CXXFLAGS = '-g -O0')
else:
......@@ -14,6 +16,9 @@ def config(env,args):
if int(standalone):
env.Append(STANDALONE= '1')
if int(cppcheck):
env.Append(CPPCHECK= '1')
env.Append(CXXFLAGS = '-Wall -Woverloaded-virtual')
env.Append(CPPDEFINES = '-DLINUXVERS')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment