-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSConstruct
129 lines (108 loc) · 5.06 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#/******************************************************************************
# * SConstruct
# *****************************************************************************/
# scons build file for the KaHIP.
#
# You can build it in the following variants:
#
# optimized no debug symbols, no assertions, optimization.
# optimized_output no debug symbols, no assertions, optimization -- more output on console.
#
# scons variant=${variant} program=${program}
import os
import platform
import sys
# Get the current platform.
SYSTEM = platform.uname()[0]
HOST = platform.uname()[1]
# Get shortcut to $HOME.
HOME = os.environ['HOME']
def GetEnvironment():
"""Get environment variables from command line and environment.
Exits on errors.
Returns
Environment with the configuration from the command line.
"""
opts = Variables()
opts.Add('variant', 'the variant to build, optimized or optimized with output', 'optimized')
opts.Add('mode', 'the mode for the size of the number of edges possible', '32bit')
opts.Add('program', 'program or interface to compile', 'vcc')
env = Environment(options=opts, ENV=os.environ)
if not env['variant'] in ['optimized','optimized_output','debug']:
print('Illegal value for variant: %s' % env['variant'])
sys.exit(1)
if not env['program'] in ['kaffpa', 'kaffpaE', 'partition_to_vertex_separator','improve_vertex_separator','library','graphchecker','label_propagation','evaluator','node_separator','spac', 'vcc']:
print('Illegal value for program: %s' % env['program'])
sys.exit(1)
if not env['mode'] in ['32bit','64bit']:
print('Illegal value for mode: %s' % env['mode'])
sys.exit(1)
# Special configuration for 64 bit machines.
if platform.architecture()[0] == '64bit':
env.Append(CPPFLAGS=['-DPOINTER64=1'])
return env
# Get the common environment.
env = GetEnvironment()
env.Append(CPPPATH=['../extern/argtable3-3.0.3/'])
env.Append(CPPPATH=['./extern/argtable3-3.0.3/'])
env.Append(CPPPATH=['./lib'])
env.Append(CPPPATH=['./app'])
env.Append(CPPPATH=['./lib/tools'])
env.Append(CPPPATH=['./lib/partition'])
env.Append(CPPPATH=['./lib/io'])
env.Append(CPPPATH=['./lib/partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement/'])
env.Append(CPPPATH=['../lib'])
env.Append(CPPPATH=['../lib/tools'])
env.Append(CPPPATH=['../lib/partition'])
env.Append(CPPPATH=['../lib/io'])
env.Append(CPPPATH=['../lib/partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement/'])
env.Append(CPPPATH=['/usr/include/openmpi/'])
conf = Configure(env)
if SYSTEM == 'Darwin':
env.Append(CPPPATH=['/opt/local/include/','../include'])
env.Append(LIBPATH=['/opt/local/lib/'])
env.Append(LIBPATH=['/opt/local/lib/openmpi/'])
# homebrew related paths
env.Append(LIBPATH=['/usr/local/lib/'])
env.Append(LIBPATH=['/usr/local/lib/openmpi/'])
#env.Append(LIBPATH=['../extern/argtable3-2.10/maclib'])
#env.Append(LIBPATH=['./extern/argtable-2.10/maclib'])
#if not conf.CheckCXXHeader('mpi.h'):
#print "openmpi header not found. Exiting"
#Exit(-1)
#
#
env.Append(CXXFLAGS = '-fopenmp')
if "clang" in env['CC'] or "clang" in env['CXX']:
if env['variant'] == 'optimized':
env.Append(CXXFLAGS = '-DNDEBUG -Wall -funroll-loops -O3 -std=c++11')
env.Append(CCFLAGS = '-O3 -DNDEBUG -funroll-loops -std=c++11')
elif env['variant'] == 'optimized_output':
# A little bit more output on the console
env.Append(CXXFLAGS = ' -DNDEBUG -funroll-loops -Wall -O3 -std=c++11')
env.Append(CCFLAGS = '-O3 -DNDEBUG -DKAFFPAOUTPUT -std=c++11')
else:
env.Append(CXXFLAGS = ' -g -DDEBUG -Wall -funroll-loops -O0 -std=c++11')
env.Append(CCFLAGS = ' -g -O0 -DDEBUG -funroll-loops -std=c++11 ')
if SYSTEM != 'Darwin':
env.Append(CXXFLAGS = '-march=native')
env.Append(CCFLAGS = '-march=native')
else:
if env['variant'] == 'optimized':
env.Append(CXXFLAGS = '-DNDEBUG -Wall -funroll-loops -fno-stack-limit -O3 -std=c++11 -fpermissive')
env.Append(CCFLAGS = '-O3 -DNDEBUG -funroll-loops -std=c++11 -fpermissive')
elif env['variant'] == 'optimized_output':
# A little bit more output on the console
env.Append(CXXFLAGS = ' -DNDEBUG -funroll-loops -Wall -fno-stack-limit -O3 -std=c++11 -fpermissive')
env.Append(CCFLAGS = '-O3 -DNDEBUG -DKAFFPAOUTPUT -std=c++11 -fpermissive')
else:
env.Append(CXXFLAGS = ' -g -DDEBUG -Wall -funroll-loops -fno-stack-limit -O0 -std=c++11 -fpermissive')
env.Append(CCFLAGS = ' -g -O0 -DNDEBUG -funroll-loops -std=c++11 -fpermissive')
if SYSTEM != 'Darwin':
env.Append(CXXFLAGS = '-march=native')
env.Append(CCFLAGS = '-march=native')
if env['mode'] == '64bit':
env.Append(CXXFLAGS = '-DMODE64BITEDGES')
env.Append(CCFLAGS = '-DMODE64BITEDGES')
# Execute the SConscript.
SConscript('SConscript', exports=['env'],variant_dir=env['variant'], duplicate=False)