Non reinvents the DAW. Powerful enough to form a complete studio, fast and light enough to run on low-end hardware like the eeePC or Raspberry Pi, and so reliable that it can be used live https://non.tuxfamily.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

177 lines
5.8KB

  1. #!/usr/bin/env python
  2. import os
  3. import subprocess
  4. import waflib.Logs as Logs, waflib.Options as Options
  5. import string
  6. VERSION = 'xxx'
  7. APPNAME = 'non-things'
  8. top = '.'
  9. out = 'build'
  10. common = [ 'nonlib', 'FL' ]
  11. projects = [ 'timeline', 'mixer', 'sequencer', 'session-manager' ]
  12. def options(opt):
  13. # opt.add_option('--use-system-ntk', action='store_true', default=False,
  14. # dest='use_system_ntk',
  15. # help="Link to system-installed shared NTK instead of bundled version")
  16. opt.add_option('--enable-debug', action='store_true', default=False, dest='debug',
  17. help='Build for debugging')
  18. opt.add_option('--disable-sse', action='store_false', default=True, dest='sse',
  19. help='Disable SSE optimization')
  20. opt.add_option('--disable-native-cpu-optimization', action='store_false', default=True, dest='native',
  21. help='Disable native CPU optimziation (e.g. for generic binary packaging)')
  22. opt.add_option('--project', action='store', default=False, dest='project',
  23. help='Limit build to a single project (' + ', '.join( projects ) + ')')
  24. for i in projects:
  25. opt.recurse(i)
  26. def configure(conf):
  27. conf.load('compiler_c')
  28. conf.load('compiler_cxx')
  29. conf.load('gnu_dirs')
  30. conf.load('ntk_fluid',tooldir='tools.waf')
  31. conf.load('gccdeps')
  32. conf.line_just = 52
  33. conf.env['LIB_PTHREAD'] = ['pthread']
  34. conf.env['LIB_DL'] = ['dl']
  35. conf.env['LIB_M'] = ['m']
  36. if Options.options.sse:
  37. if os.system("grep -q '^flags.*\<sse2\>' /proc/cpuinfo"):
  38. Options.options.sse = 0
  39. print( "Processor lacks sse, disabling..." )
  40. # NTK_EXTRA_FLAGS=''
  41. # if not Options.options.use_system_ntk:
  42. # print 'Using bundled NTK'
  43. # os.environ['PKG_CONFIG_PATH'] = 'lib/ntk/build/:' + os.environ.get('PKG_CONFIG_PATH','')
  44. # NTK_EXTRA_FLAGS='--static'
  45. # PWD = os.environ.get('PWD','')
  46. # os.environ['PATH'] = PWD + '/lib/ntk/build/fluid:' + os.environ.get('PATH','')
  47. conf.check_cfg(package='ntk', uselib_store='NTK', args='--cflags --libs',
  48. atleast_version='1.3.0', mandatory=True)
  49. conf.check_cfg(package='ntk_images', uselib_store='NTK_IMAGES', args=' --cflags --libs',
  50. atleast_version='1.3.0', mandatory=True)
  51. conf.find_program('ntk-fluid', var='NTK_FLUID')
  52. conf.check_cfg(package='jack', uselib_store='JACK', args="--cflags --libs",
  53. atleast_version='0.103.0', mandatory=True)
  54. conf.check_cc(msg='Checking for jack_port_get_latency_range()',
  55. define_name='HAVE_JACK_PORT_GET_LATENCY_RANGE',
  56. 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 ); }',
  57. mandatory=False);
  58. conf.check(function_name='jack_get_property',
  59. header_name='jack/metadata.h',
  60. define_name='HAVE_JACK_METADATA',
  61. uselib='JACK',
  62. mandatory=False)
  63. conf.check_cfg(package='x11', uselib_store='XLIB',args="--cflags --libs",
  64. mandatory=True)
  65. conf.check_cfg(package='liblo', uselib_store='LIBLO',args="--cflags --libs",
  66. atleast_version='0.26', mandatory=True)
  67. conf.check_cc(msg='Checking for compiler pointer alignment hints',
  68. uselib_store='HAS_BUILTIN_ASSUME_ALIGNED',
  69. fragment='int main ( char**argv, int argc ) { const char *s = (const char*)__builtin_assume_aligned( 0, 16 ); return 0; }',
  70. execute=False, mandatory=False)
  71. ###
  72. for i in common:
  73. conf.recurse(i)
  74. optimization_flags = [
  75. "-O3",
  76. "-fomit-frame-pointer",
  77. "-ffast-math",
  78. "-pipe"
  79. ]
  80. if Options.options.native:
  81. print('Using native CPU optimization')
  82. optimization_flags.extend( [
  83. "-march=native",
  84. "-mtune=native", # ~200% DSP performance increase on AMD bulldozer...
  85. ]);
  86. if Options.options.sse:
  87. print('Using SSE optimization')
  88. optimization_flags.extend( [
  89. "-msse2",
  90. "-mfpmath=sse" ] );
  91. conf.define( 'USE_SSE', 1 )
  92. debug_flags = [ '-O0', '-g3' ]
  93. if Options.options.debug:
  94. print('Building for debugging')
  95. conf.env.append_value('CFLAGS', debug_flags )
  96. conf.env.append_value('CXXFLAGS', debug_flags )
  97. else:
  98. print('Building for performance')
  99. conf.env.append_value('CFLAGS', optimization_flags )
  100. conf.env.append_value('CXXFLAGS', optimization_flags )
  101. conf.define( 'NDEBUG', 1 )
  102. conf.define( "_GNU_SOURCE", 1)
  103. conf.env.append_value('CFLAGS',['-Wall'])
  104. # conf.env.append_value('CXXFLAGS',['-Wall','-fno-exceptions', '-fno-rtti'])
  105. conf.env.append_value('CXXFLAGS',['-Wall','-fno-rtti'])
  106. global_flags = [ '-pthread',
  107. '-D_LARGEFILE64_SOURCE',
  108. '-D_FILE_OFFSET_BITS=64',
  109. '-D_GNU_SOURCE' ]
  110. conf.env.append_value('CFLAGS', global_flags )
  111. conf.env.append_value('CXXFLAGS', global_flags )
  112. conf.env.PROJECT = conf.options.project
  113. if conf.env.PROJECT:
  114. pl = [ conf.env.PROJECT ]
  115. else:
  116. pl = projects;
  117. for i in pl:
  118. Logs.pprint('YELLOW', 'Configuring %s' % i)
  119. conf.recurse(i);
  120. def run(ctx):
  121. if not Options.options.cmd:
  122. Logs.error("missing --cmd option for run command")
  123. return
  124. cmd = Options.options.cmd
  125. Logs.pprint('GREEN', 'Running %s' % cmd)
  126. subprocess.call(cmd, shell=True, env=source_tree_env())
  127. def build(bld):
  128. for i in common:
  129. bld.recurse(i)
  130. if bld.env.PROJECT:
  131. pl = [ bld.env.PROJECT ]
  132. else:
  133. pl = projects;
  134. for i in pl:
  135. bld.recurse(i);