-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwscript
More file actions
230 lines (199 loc) · 7.22 KB
/
wscript
File metadata and controls
230 lines (199 loc) · 7.22 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
#! /usr/bin/env python
# encoding: utf-8
APPNAME = "FunctionalXpp"
VERSION = "0.0"
top = "."
out = "build"
DIRS = 'source test'
import glob, os
from waflib.Configure import conf
def printProcess(msg, l = 70):
lmsg = (l - len(msg))/2
msgToPrint = lmsg * "-" + msg + lmsg * "-"
if len(msgToPrint) < l:
msgToPrint = msgToPrint.split(" ")[0] + " " + msgToPrint.split(" ")[1]
print l * "="
print msgToPrint
print l * "="
def global_env(ctx):
ctx.env.appname = APPNAME
ctx.env.append_unique('LDFLAGS_N',
[ 'bz2',
'gsl',
'gslcblas',
'dl']
)
ctx.env.append_unique('CATCH_PATH', '/usr/local/include/Catch')
ctx.env.append_unique("INCLUDES_REL",
['include',
'include/containers',
'include/containers/iterators',
'include/database',
'include/utils'
]
)
#ctx.env.INCLUDES_N = ["../../../" + x for x in ctx.env.INCLUDES_REL]
ctx.env.append_unique('INCLUDES_ABS',
ctx.env.CATCH_PATH[0]
)
def configure_gcc(conf):
conf.find_program('g++', var = 'CXX', mandatory = True)
conf.load('g++')
conf.find_program('gcc', var = 'C', mandatory = True)
#conf.load('gcc')
global_env(conf)
conf.env.append_unique('STLIB', 'stdc++')
conf.env.append_unique('LDFLAGS_N', 'stdc++')
conf.setenv('release', env=conf.env.derive())
conf.env.CXXFLAGS = ['-Wall',
'-Wno-unknown-pragmas',
'-Wextra',
'-Wconversion',
'-O3',
'-std=c++17']
conf.define('RELEASE', 1)
#print ("environment release\n")
#print(conf.all_envs['release'])
#print "-----------------------------------------------------------------------------------------"
conf.setenv('debug', env=conf.env.derive())
conf.env.CXXFLAGS = ['-DDEBUG',
'-D_GLIBCXX_DEBUG',
'-D_GLIBCXX_DEBUG_PEDANTIC',
'-g', '-std=c++17']
conf.define('DEBUG', 1)
#print ("environment debug\n")
#print(conf.all_envs['debug'])
#print "-----------------------------------------------------------------------------------------"
def configure_gcc_5(conf):
conf.find_program('g++-5', var = 'CXX', mandatory = True)
conf.load('g++')
conf.find_program('gcc-5', var = 'C', mandatory = True)
#conf.load('gcc')
global_env(conf)
conf.env.append_unique('STLIB', 'stdc++')
conf.env.append_unique('LDFLAGS_N', 'stdc++')
conf.setenv('alternative-gcc-5', env=conf.env.derive())
conf.env.CXXFLAGS = ['-Wall',
'-Wno-unknown-pragmas',
'-Wextra',
'-Wconversion',
'-O3',
'-std=c++17']
conf.define('RELEASE', 1)
#print ("environment release\n")
#print(conf.all_envs['release'])
#print "-----------------------------------------------------------------------------------------"
conf.setenv('alternative-gcc-5-debug', env=conf.env.derive())
conf.env.CXXFLAGS = ['-DDEBUG',
'-D_GLIBCXX_DEBUG',
'-D_GLIBCXX_DEBUG_PEDANTIC',
'-g', '-std=c++17']
conf.define('DEBUG', 1)
#print ("environment debug\n")
#print(conf.all_envs['debug'])
#print "-----------------------------------------------------------------------------------------"
def configure_clang(conf):
conf.find_program('clang', var='CXX', mandatory = True)
#conf.CXX = 'clang'
conf.load("clang++")
#conf.find_program('clang', var='CC', mandatory = True)
#conf.load("clang")
global_env(conf)
conf.env.append_unique('LDFLAGS_N',
[ "pthread",
"util", "m"]
)
conf.setenv('alternative-clang', env=conf.env.derive())
conf.env.CXXFLAGS = ['-Wall',
'-Wno-unknown-pragmas',
'-Wextra',
'-Wconversion',
'-fno-strict-aliasing',
'-D_FORTIFY_SOURCE=2',
'-fstack-protector',
'--param=ssp-buffer-size=4',
'-Wformat',
'-Werror=format-security',
'-fwrapv',
'-O3',
'-std=c++1z'
]
conf.env.append_unique('LIBS',
['c++', 'c++abi'])
conf.define('RELEASE', 1)
#print ("environment release\n")
#print(conf.all_envs['release'])
#print "-----------------------------------------------------------------------------------------"
conf.setenv('alternative-clang-debug', env=conf.env.derive())
conf.env.CXXFLAGS = ['-g',
'-glldb',
'-Wdocumentation']
conf.define('DEBUG', 1)
#print ("environment debug\n")
#print(conf.all_envs['debug'])
#print "-----------------------------------------------------------------------------------------"
def options(opt):
opt.load("compiler_cxx")
opt.load("compiler_c")
print("read options")
opt.add_option(
'--clang',
action = 'store_true',
default = False,
)
def configure_bak(conf):
from waflib.Tools.compiler_cxx import cxx_compiler
cxx_compiler['linux'] = ['gxx', 'clangxx']
conf.load('compiler_cxx')
print (conf.env.COMPILER_CXX)
#from waflib.Tools.compiler_c import c_compiler
#c_compiler['linux'] = ['clang', 'gcc', 'gcc-5', 'gcc-4.9', 'gcc-4.8']
#conf.load('compiler_c')
#if conf.options.clang:
# configure_clang(conf)
#else:
# configure_gcc(conf)
if conf.env.COMPILER_CXX == "clangxx":
configure_clang(conf)
else:
configure_gcc(conf)
#print(conf.env)
def configure(conf):
printProcess("Configuring gcc")
configure_gcc(conf)
conf.setenv("bebo")
printProcess("Configuring gcc-5")
configure_gcc_5(conf)
conf.setenv("buba")
printProcess("Configuring clang")
configure_clang(conf)
from waflib.Build import BuildContext
class release(BuildContext):
cmd = 'build_release'
variant = 'release'
class debug(BuildContext):
cmd = 'build_debug'
variant = 'debug'
class alt_release(BuildContext):
cmd = 'build_gcc5_release'
variant = 'alternative-gcc-5'
class alt_debug(BuildContext):
cmd = 'build_gcc5_debug'
variant = 'alternative-gcc-5-debug'
class alt_release(BuildContext):
cmd = 'build_clang_release'
variant = 'alternative-clang'
class alt_debug(BuildContext):
cmd = 'build_clang_debug'
variant = 'alternative-gcc-5-debug'
def build(bld):
if not bld.variant:
bld.fatal("""Please invoke a variant to build: \n
1. waf build_release \n
2. waf build_debug \n
3. waf build_clang_release\n
4. waf build_clang_debug\n
5. waf build_gcc5_release \n
6. waf build_gcc5_debug\n""")
printProcess("Building " + bld.variant)
bld.recurse(DIRS)