-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSConstruct
62 lines (47 loc) · 1.96 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
nameProgram = 'Evacuation'
agents = ['EvacAgent']
world = 'EvacWorld'
namespaceAgents = ['Evacuation']
srcFiles = ['main.cxx', 'EvacConfig.cxx', 'EvacAgent.cxx', 'EvacWorld.cxx']
###################################################
########## END OF CUSTOM INFORMATION #############
##### don't modify anything below these lines #####
###################################################
import os, sys
from subprocess import call
pandoraPath = os.getenv('PANDORAPATH', '/usr/local/pandora')
sys.path.append(pandoraPath+'/bin')
import generateMpi
vars = Variables('custom.py')
vars.Add(BoolVariable('debug', 'compile with debug flags', 'no'))
vars.Add(BoolVariable('edebug', 'compile with extreme debug logs', 'no'))
env = Environment(variables=vars, ENV=os.environ, CXX='mpicxx')
Help(vars.GenerateHelpText(env))
generateMPICodeBuilder = Builder(action=generateMpi.execute)
env.Append( BUILDERS = {'GenerateMPICode' : generateMPICodeBuilder})
env.Append(LINKFLAGS = '-fopenmp')
env.Append(CCFLAGS = '-std=c++0x -DTIXML_USE_STL'.split())
if env['debug'] == True:
env.Append(CCFLAGS = '-g -O0 -Wall -DPANDORADEBUG'.split())
if env['edebug']==True:
env.Append(CCFLAGS = '-DPANDORAEDEBUG')
env.Append(LIBS = 'pandorad')
else:
env.Append(CCFLAGS = '-Ofast'.split())
env.Append(LIBS = 'pandora')
env.Append(CPPPATH = ['.', pandoraPath+'/include'])
env.Append(LIBPATH = [pandoraPath+'/lib'])
# add the list of mpi code that must be generated & compiled
mpiAgentsSrc = ['mpiCode/FactoryCode.cxx']
agentsSrc = ['main.cxx']
for agent in agents:
if agent != '':
agentsSrc.append(agent+".cxx")
mpiAgentsSrc.append("mpiCode/"+agent+"_mpi.cxx")
env['namespaces'] = namespaceAgents
if (len(namespaceAgents) != len(agents)):
print("The number of agents and name spaces declared should match!")
sys.exit(1)
env.GenerateMPICode( target=mpiAgentsSrc, source=agentsSrc)
env.Depends(world+'.hxx',mpiAgentsSrc)
env.Program(nameProgram, srcFiles+mpiAgentsSrc)