-
Notifications
You must be signed in to change notification settings - Fork 8
/
wscript
167 lines (127 loc) · 5.41 KB
/
wscript
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
#!/usr/bin/env python
import os
import subprocess
import waflib.Logs as Logs, waflib.Options as Options
import string
VERSION = 'xxx'
APPNAME = 'non-things'
top = '.'
out = 'build'
common = [ 'nonlib', 'FL' ]
projects = [ 'timeline', 'mixer', 'sequencer', 'session-manager' ]
def options(opt):
# opt.add_option('--use-system-ntk', action='store_true', default=False,
# dest='use_system_ntk',
# help="Link to system-installed shared NTK instead of bundled version")
opt.add_option('--enable-debug', action='store_true', default=False, dest='debug',
help='Build for debugging')
opt.add_option('--disable-sse', action='store_false', default=True, dest='sse',
help='Disable SSE optimization')
opt.add_option('--project', action='store', default=False, dest='project',
help='Limit build to a single project (' + ', '.join( projects ) + ')')
for i in projects:
opt.recurse(i)
def configure(conf):
conf.load('compiler_c')
conf.load('compiler_cxx')
conf.load('gnu_dirs')
conf.load('ntk_fluid',tooldir='tools.waf')
conf.load('gccdeps')
conf.line_just = 52
conf.env['LIB_PTHREAD'] = ['pthread']
conf.env['LIB_DL'] = ['dl']
conf.env['LIB_M'] = ['m']
if Options.options.sse:
if os.system("grep -q '^flags.*\<sse2\>' /proc/cpuinfo"):
Options.options.sse = 0
print( "Processor lacks sse, disabling..." )
# NTK_EXTRA_FLAGS=''
# if not Options.options.use_system_ntk:
# print 'Using bundled NTK'
# os.environ['PKG_CONFIG_PATH'] = 'lib/ntk/build/:' + os.environ.get('PKG_CONFIG_PATH','')
# NTK_EXTRA_FLAGS='--static'
# PWD = os.environ.get('PWD','')
# os.environ['PATH'] = PWD + '/lib/ntk/build/fluid:' + os.environ.get('PATH','')
conf.check_cfg(package='ntk', uselib_store='NTK', args='--cflags --libs',
atleast_version='1.3.0', mandatory=True)
conf.check_cfg(package='ntk_images', uselib_store='NTK_IMAGES', args=' --cflags --libs',
atleast_version='1.3.0', mandatory=True)
conf.find_program('ntk-fluid', var='NTK_FLUID')
conf.check_cfg(package='jack', uselib_store='JACK', args="--cflags --libs",
atleast_version='0.103.0', mandatory=True)
conf.check_cc(msg='Checking for jack_port_get_latency_range()',
define_name='HAVE_JACK_PORT_GET_LATENCY_RANGE',
fragment='#include <jack/jack.h>\nint main (int argc, char**argv) { jack_port_get_latency_range( (jack_port_t*)0, JackCaptureLatency, (jack_latency_range_t *)0 ); }',
mandatory=False);
conf.check(function_name='jack_get_property',
header_name='jack/metadata.h',
define_name='HAVE_JACK_METADATA',
uselib='JACK',
mandatory=False)
conf.check_cfg(package='x11', uselib_store='XLIB',args="--cflags --libs",
mandatory=True)
conf.check_cfg(package='liblo', uselib_store='LIBLO',args="--cflags --libs",
atleast_version='0.26', mandatory=True)
conf.check_cc(msg='Checking for compiler pointer alignment hints',
uselib_store='HAS_BUILTIN_ASSUME_ALIGNED',
fragment='int main ( char**argv, int argc ) { const char *s = (const char*)__builtin_assume_aligned( 0, 16 ); return 0; }',
execute=False, mandatory=False)
###
for i in common:
conf.recurse(i)
optimization_flags = [
"-O3",
"-fomit-frame-pointer",
"-ffast-math",
"-pipe"
]
if Options.options.sse:
print('Using SSE optimization')
optimization_flags.extend( [
"-msse2",
"-mfpmath=sse" ] );
conf.define( 'USE_SSE', 1 )
debug_flags = [ '-O0', '-g3' ]
if Options.options.debug:
print('Building for debugging')
conf.env.append_value('CFLAGS', debug_flags )
conf.env.append_value('CXXFLAGS', debug_flags )
else:
print('Building for performance')
conf.env.append_value('CFLAGS', optimization_flags )
conf.env.append_value('CXXFLAGS', optimization_flags )
conf.define( 'NDEBUG', 1 )
conf.define( "_GNU_SOURCE", 1)
conf.env.append_value('CFLAGS',['-Wall'])
# conf.env.append_value('CXXFLAGS',['-Wall','-fno-exceptions', '-fno-rtti'])
conf.env.append_value('CXXFLAGS',['-Wall','-fno-rtti'])
global_flags = [ '-pthread',
'-D_LARGEFILE64_SOURCE',
'-D_FILE_OFFSET_BITS=64',
'-D_GNU_SOURCE' ]
conf.env.append_value('CFLAGS', global_flags )
conf.env.append_value('CXXFLAGS', global_flags )
conf.env.PROJECT = conf.options.project
if conf.env.PROJECT:
pl = [ conf.env.PROJECT ]
else:
pl = projects;
for i in pl:
Logs.pprint('YELLOW', 'Configuring %s' % i)
conf.recurse(i);
def run(ctx):
if not Options.options.cmd:
Logs.error("missing --cmd option for run command")
return
cmd = Options.options.cmd
Logs.pprint('GREEN', 'Running %s' % cmd)
subprocess.call(cmd, shell=True, env=source_tree_env())
def build(bld):
for i in common:
bld.recurse(i)
if bld.env.PROJECT:
pl = [ bld.env.PROJECT ]
else:
pl = projects;
for i in pl:
bld.recurse(i);