-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwscript
More file actions
59 lines (46 loc) · 1.68 KB
/
wscript
File metadata and controls
59 lines (46 loc) · 1.68 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
#!/usr/bin/python
import os;
APPNAME = 'udpirsend'
VERSION = '1.0'
out = '.wafbuild'
def options(opt):
opt.load('compiler_cxx')
try:
opt.load('boost')
except ImportError:
pass # note: this is OK only at the download stage
opt.add_option('-d', '--debug', action='store_true', default=False, help='Create debug version')
def configure(ctx):
ctx.load('compiler_cxx boost')
ctx.check_boost(lib='system program_options')
ctx.check(features='cxx cxxprogram', lib=['pthread'], uselib_store='PTHREAD')
setCxxFlags(ctx)
setOSXSpecifics(ctx)
def build(ctx):
ctx.load('compiler_cxx boost')
ctx.program(
features = 'cxx cxxprogram',
source = ctx.path.ant_glob('*.cpp'),
target = APPNAME,
use = ['BOOST', 'PTHREAD'])
###################################
def setOSXSpecifics(ctx):
if (ctx.env.DEST_OS == 'darwin'):
ctx.env.append_unique('INCLUDES', '/opt/local/include')
ctx.env.append_unique('LIBPATH', '/opt/local/lib')
ctx.env.append_unique('CXXFLAGS', '-Wno-unused-local-typedef') # BOOST v1.59 workaround on OSX..
def enforceColorClangOutput():
if ('CXX' in os.environ and os.environ['CXX'] == 'clang++'):
return ['-fcolor-diagnostics']
else:
return []
def setCxxFlags(ctx):
print("Debug flag is " + str(ctx.options.debug))
if ctx.options.debug == True:
ctx.env.append_unique('CXXFLAGS', ['-g'])
else:
ctx.env.append_unique('CXXFLAGS', ['-O3', '-DNDEBUG'])
clangSpecificFlags = enforceColorClangOutput()
ctx.env.append_unique('CXXFLAGS',
['-Wall', '-Werror', '-Woverloaded-virtual', '-std=c++11'] +
clangSpecificFlags)