non/wscript

177 lines
5.8 KiB
Plaintext
Raw Permalink Normal View History

2012-11-14 10:54:03 +01:00
#!/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('--disable-native-cpu-optimization', action='store_false', default=True, dest='native',
help='Disable native CPU optimziation (e.g. for generic binary packaging)')
2012-11-14 10:54:03 +01:00
opt.add_option('--project', action='store', default=False, dest='project',
2012-11-17 02:20:20 +01:00
help='Limit build to a single project (' + ', '.join( projects ) + ')')
2012-11-14 10:54:03 +01:00
for i in projects:
opt.recurse(i)
def configure(conf):
conf.load('compiler_c')
conf.load('compiler_cxx')
conf.load('gnu_dirs')
2019-09-25 09:01:22 +02:00
conf.load('ntk_fluid',tooldir='tools.waf')
2013-02-19 07:47:41 +01:00
conf.load('gccdeps')
2012-11-14 10:54:03 +01:00
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)
2013-08-24 05:41:17 +02:00
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)
2013-08-24 05:41:17 +02:00
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)
2012-11-14 10:54:03 +01:00
optimization_flags = [
"-O3",
"-fomit-frame-pointer",
"-ffast-math",
"-pipe"
]
if Options.options.native:
print('Using native CPU optimization')
optimization_flags.extend( [
"-march=native",
"-mtune=native", # ~200% DSP performance increase on AMD bulldozer...
]);
if Options.options.sse:
print('Using SSE optimization')
optimization_flags.extend( [
"-msse2",
"-mfpmath=sse" ] );
conf.define( 'USE_SSE', 1 )
2012-11-14 10:54:03 +01:00
2013-04-09 05:58:18 +02:00
debug_flags = [ '-O0', '-g3' ]
2012-11-14 10:54:03 +01:00
if Options.options.debug:
print('Building for debugging')
2012-11-14 10:54:03 +01:00
conf.env.append_value('CFLAGS', debug_flags )
conf.env.append_value('CXXFLAGS', debug_flags )
else:
print('Building for performance')
2012-11-14 10:54:03 +01:00
conf.env.append_value('CFLAGS', optimization_flags )
conf.env.append_value('CXXFLAGS', optimization_flags )
conf.define( 'NDEBUG', 1 )
2012-11-18 22:22:02 +01:00
conf.define( "_GNU_SOURCE", 1)
2012-11-14 10:54:03 +01:00
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 )
2012-11-14 10:54:03 +01:00
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);