-
Notifications
You must be signed in to change notification settings - Fork 7
/
SConstruct
99 lines (70 loc) · 2.62 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
# This SConstruct launches all Sconscript files inside the library directories
import sys
import os
#Compiler configure
debug = int(ARGUMENTS.get('debug', '0'))
compiler = ARGUMENTS.get('compiler', 'gcc')
#Paths
system_include = '/usr/include'
system_libpath = '/usr/lib'
third_party_path = os.getcwd() + '/third_party'
build_tools = ['default']
if compiler == 'intel':
build_tools += ['intelc']
#Build C environment
hpg_c_env = Environment(TOOLS = build_tools,
CFLAGS = ' -Wall -std=c99 -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_GNU_SOURCE -D_REENTRANT ',
CPPPATH = ['.', '#', system_include, '%s/libxml2' % system_include, '%s' % third_party_path],
LIBPATH = [system_libpath],
LINKFLAGS = [],
LIBS = ['xml2', 'm', 'z', 'curl'])
if os.environ.has_key('CPATH'):
for dir in os.getenv('CPATH').split(':'):
hpg_c_env.Append(CPPPATH=[dir])
if os.environ.has_key('LIBRARY_PATH'):
for dir in os.getenv('LIBRARY_PATH').split(':'):
hpg_c_env.Append(LIBPATH=[dir])
if compiler == 'intel':
hpg_c_env['CFLAGS'] += ' -msse4.2 -openmp '
hpg_c_env['LIBS'] += ['irc']
hpg_c_env['LINKFLAGS'] += ['-openmp']
else:
hpg_c_env['CFLAGS'] += ' -fopenmp '
hpg_c_env['LINKFLAGS'] += ['-fopenmp']
if debug == 1:
hpg_c_env['CFLAGS'] += ' -O0 -g'
else:
hpg_c_env['CFLAGS'] += ' -O2 '
hpg_c_env['objects'] = []
hpg_c_env.Decider('MD5-timestamp')
#Build C++ environment
hpg_cpp_env = Environment(TOOLS = build_tools,
CFLAGS = ' -Wall -std=c++11 -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_GNU_SOURCE -D_REENTRANT ',
CPPPATH = ['.', '#', system_include, '%s/libxml2' % system_include, '%s' % third_party_path],
LIBPATH = [system_libpath],
LINKFLAGS = [],
LIBS = ['xml2', 'm', 'z', 'curl'])
if os.environ.has_key('CPATH'):
for dir in os.getenv('CPATH').split(':'):
hpg_cpp_env.Append(CPPPATH=[dir])
if os.environ.has_key('LIBRARY_PATH'):
for dir in os.getenv('LIBRARY_PATH').split(':'):
hpg_cpp_env.Append(LIBPATH=[dir])
if compiler == 'intel':
hpg_cpp_env['CFLAGS'] += ' -msse4.2 -openmp '
hpg_cpp_env['LIBS'] += ['irc']
hpg_cpp_env['LINKFLAGS'] += ['-openmp']
else:
hpg_cpp_env['CFLAGS'] += ' -fopenmp '
hpg_cpp_env['LINKFLAGS'] += ['-fopenmp']
if debug == 1:
hpg_cpp_env['CFLAGS'] += ' -O0 -g'
else:
hpg_cpp_env['CFLAGS'] += ' -O2 '
hpg_cpp_env['objects'] = []
hpg_cpp_env.Decider('MD5-timestamp')
# Third party
SConscript('third_party/SConscript', exports = ['hpg_c_env', 'hpg_cpp_env', 'debug', 'compiler'])
# our src
SConscript('c/SConscript', exports = ['hpg_c_env', 'debug', 'compiler'])
SConscript('cpp/SConscript', exports = ['hpg_cpp_env', 'debug', 'compiler'])