use Glib::build_filename() to construct fullpath, rather than doing it by hand (hello...
[ardour2.git] / wscript
blob9b41223a847ece4806ead97fbad1990808bb6bdb
1 #!/usr/bin/env python
2 import autowaf
3 import Options
4 import os
5 import commands
6 import re
7 import string
8 import subprocess
9 import sys
11 # Variables for 'waf dist'
12 VERSION = '3.0pre0'
13 APPNAME = 'ardour'
15 # Mandatory variables
16 srcdir = '.'
17 blddir = 'build'
19 children = [
20 'libs/pbd',
21 'libs/midi++2',
22 'libs/evoral',
23 'libs/vamp-sdk',
24 'libs/vamp-plugins',
25 'libs/taglib',
26 'libs/rubberband',
27 'libs/surfaces',
28 'libs/ardour',
29 'libs/gtkmm2ext',
30 'libs/clearlooks-newer',
31 'libs/audiographer',
32 'gtk2_ardour'
36 i18n_children = [
37 'gtk2_ardour',
38 'libs/ardour'
41 # Version stuff
43 def fetch_svn_revision (path):
44 cmd = "LANG= svn info " + path + " | awk '/^Revision:/ { print $2}'"
45 return commands.getoutput(cmd)
47 def fetch_gcc_version ():
48 cmd = "LANG= gcc --version"
49 output = commands.getoutput(cmd).splitlines()
50 version = output[0].split(' ')[2].split('.')
51 return version
53 def fetch_git_revision (path):
54 cmd = "LANG= git log --abbrev HEAD^..HEAD " + path
55 output = commands.getoutput(cmd).splitlines()
56 rev = output[0].replace ("commit", "git")[0:10]
57 for line in output:
58 try:
59 if "git-svn-id" in line:
60 line = line.split('@')[1].split(' ')
61 rev = line[0]
62 except:
63 pass
64 return rev
66 def fetch_bzr_revision (path):
67 cmd = subprocess.Popen("LANG= bzr log -l 1 " + path, stdout=subprocess.PIPE, shell=True)
68 out = cmd.communicate()[0]
69 svn = re.search('^svn revno: [0-9]*', out, re.MULTILINE)
70 str = svn.group(0)
71 chars = 'svnreio: '
72 return string.lstrip(str, chars)
74 def create_stored_revision():
75 rev = ""
76 if os.path.exists('.svn'):
77 rev = fetch_svn_revision('.');
78 elif os.path.exists('.git'):
79 rev = fetch_git_revision('.');
80 elif os.path.exists('.bzr'):
81 rev = fetch_bzr_revision('.');
82 print "Revision: " + rev;
83 elif os.path.exists('libs/ardour/svn_revision.cc'):
84 print "Using packaged svn revision"
85 return
86 else:
87 print "Missing libs/ardour/svn_revision.cc. Blame the packager."
88 sys.exit(-1)
90 try:
91 text = '#include "ardour/svn_revision.h"\n'
92 text += 'namespace ARDOUR { const char* svn_revision = \"' + rev + '\"; }\n'
93 print 'Writing svn revision info to libs/ardour/svn_revision.cc'
94 o = file('libs/ardour/svn_revision.cc', 'w')
95 o.write(text)
96 o.close()
97 except IOError:
98 print 'Could not open libs/ardour/svn_revision.cc for writing\n'
99 sys.exit(-1)
101 def set_compiler_flags (conf,opt):
103 # Compiler flags and other system-dependent stuff
106 build_host_supports_sse = False
107 optimization_flags = []
108 if opt.gprofile:
109 debug_flags = [ '-pg' ]
110 else:
111 debug_flags = [ ] # waf adds -O0 -g itself. thanks waf!
113 # guess at the platform, used to define compiler flags
115 config_guess = os.popen("tools/config.guess").read()[:-1]
117 config_cpu = 0
118 config_arch = 1
119 config_kernel = 2
120 config_os = 3
121 config = config_guess.split ("-")
123 print "system triple: " + config_guess
125 # Autodetect
126 if opt.dist_target == 'auto':
127 if config[config_arch] == 'apple':
128 # The [.] matches to the dot after the major version, "." would match any character
129 if re.search ("darwin[0-7][.]", config[config_kernel]) != None:
130 conf.define ('build_target', 'panther')
131 elif re.search ("darwin8[.]", config[config_kernel]) != None:
132 conf.define ('build_target', 'tiger')
133 else:
134 conf.define ('build_target', 'leopard')
135 else:
136 if re.search ("x86_64", config[config_cpu]) != None:
137 conf.define ('build_target', 'x86_64')
138 elif re.search("i[0-5]86", config[config_cpu]) != None:
139 conf.define ('build_target', 'i386')
140 elif re.search("powerpc", config[config_cpu]) != None:
141 conf.define ('build_target', 'powerpc')
142 else:
143 conf.define ('build_target', 'i686')
144 else:
145 conf.define ('build_target', opt.dist_target)
147 if config[config_cpu] == 'powerpc' and conf.env['build_target'] != 'none':
149 # Apple/PowerPC optimization options
151 # -mcpu=7450 does not reliably work with gcc 3.*
153 if opt.dist_target == 'panther' or opt.dist_target == 'tiger':
154 if config[config_arch] == 'apple':
155 # optimization_flags.extend ([ "-mcpu=7450", "-faltivec"])
156 # to support g3s but still have some optimization for above
157 optimization_flags.extend ([ "-mcpu=G3", "-mtune=7450"])
158 else:
159 optimization_flags.extend ([ "-mcpu=7400", "-maltivec", "-mabi=altivec"])
160 else:
161 optimization_flags.extend([ "-mcpu=750", "-mmultiple" ])
162 optimization_flags.extend (["-mhard-float", "-mpowerpc-gfxopt"])
163 optimization_flags.extend (["-Os"])
165 elif ((re.search ("i[0-9]86", config[config_cpu]) != None) or (re.search ("x86_64", config[config_cpu]) != None)) and conf.env['build_target'] != 'none':
169 # ARCH_X86 means anything in the x86 family from i386 to x86_64
170 # USE_X86_64_ASM is used to distingush 32 and 64 bit assembler
173 if (re.search ("(i[0-9]86|x86_64)", config[config_cpu]) != None):
174 debug_flags.append ("-DARCH_X86")
175 optimization_flags.append ("-DARCH_X86")
177 if config[config_kernel] == 'linux' :
180 # determine processor flags via /proc/cpuinfo
183 if conf.env['build_target'] != 'i386':
185 flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1]
186 x86_flags = flag_line.split (": ")[1:][0].split ()
188 if "mmx" in x86_flags:
189 optimization_flags.append ("-mmmx")
190 if "sse" in x86_flags:
191 build_host_supports_sse = True
192 if "3dnow" in x86_flags:
193 optimization_flags.append ("-m3dnow")
195 if config[config_cpu] == "i586":
196 optimization_flags.append ("-march=i586")
197 elif config[config_cpu] == "i686":
198 optimization_flags.append ("-march=i686")
200 if ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
201 optimization_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"])
202 debug_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"])
204 # end of processor-specific section
206 # optimization section
207 if conf.env['FPU_OPTIMIZATION']:
208 if conf.env['build_target'] == 'tiger' or conf.env['build_target'] == 'leopard':
209 optimization_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
210 debug_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
211 conf.env.append_value('LINKFLAGS', "-framework Accelerate")
212 elif conf.env['build_target'] == 'i686' or conf.env['build_target'] == 'x86_64':
213 optimization_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
214 debug_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
215 elif conf.env['build_target'] == 'x86_64':
216 optimization_flags.append ("-DUSE_X86_64_ASM")
217 debug_flags.append ("-DUSE_X86_64_ASM")
218 if not build_host_supports_sse:
219 print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)"
221 # check this even if we aren't using FPU optimization
222 if conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', ccflags='-D_XOPEN_SOURCE=600') == False:
223 optimization_flags.append("-DNO_POSIX_MEMALIGN")
225 # end optimization section
228 # no VST on x86_64
231 if conf.env['build_target'] == 'x86_64' and opt.vst:
232 print "\n\n=================================================="
233 print "You cannot use VST plugins with a 64 bit host. Please run waf with --vst=0"
234 print "\nIt is theoretically possible to build a 32 bit host on a 64 bit system."
235 print "However, this is tricky and not recommended for beginners."
236 sys.exit (-1)
239 # a single way to test if we're on OS X
242 if conf.env['build_target'] in ['panther', 'tiger', 'leopard' ]:
243 conf.define ('IS_OSX', 1)
244 # force tiger or later, to avoid issues on PPC which defaults
245 # back to 10.1 if we don't tell it otherwise.
246 conf.env.append_value('CCFLAGS', "-DMAC_OS_X_VERSION_MIN_REQUIRED=1040")
248 else:
249 conf.define ('IS_OSX', 0)
252 # save off guessed arch element in an env
254 conf.define ('CONFIG_ARCH', config[config_arch])
257 # ARCH="..." overrides all
260 if opt.arch != None:
261 optimization_flags = opt.arch.split()
264 # prepend boiler plate optimization flags that work on all architectures
267 optimization_flags[:0] = [
268 "-O3",
269 "-fomit-frame-pointer",
270 "-ffast-math",
271 "-fstrength-reduce",
272 "-pipe"
275 if opt.debug:
276 conf.env.append_value('CCFLAGS', debug_flags)
277 conf.env.append_value('CXXFLAGS', debug_flags)
278 conf.env.append_value('LINKFLAGS', debug_flags)
279 else:
280 conf.env.append_value('CCFLAGS', optimization_flags)
281 conf.env.append_value('CXXFLAGS', optimization_flags)
282 conf.env.append_value('LINKFLAGS', optimization_flags)
284 if opt.stl_debug:
285 conf.env.append_value('CXXFLAGS', "-D_GLIBCXX_DEBUG")
287 if opt.universal:
288 conf.env.append_value('CCFLAGS', "-arch i386 -arch ppc")
289 conf.env.append_value('CXXFLAGS', "-arch i386 -arch ppc")
290 conf.env.append_value('LINKFLAGS', "-arch i386 -arch ppc")
293 # warnings flags
296 conf.env.append_value('CCFLAGS', "-Wall")
297 conf.env.append_value('CXXFLAGS', [ '-Wall', '-Woverloaded-virtual'])
299 if opt.extra_warn:
300 flags = [ '-Wextra' ]
301 conf.env.append_value('CCFLAGS', flags )
302 conf.env.append_value('CXXFLAGS', flags )
306 # more boilerplate
309 conf.env.append_value('CCFLAGS', [ '-D_LARGEFILE64_SOURCE', '-D_LARGEFILE_SOURCE' ])
310 conf.env.append_value('CCFLAGS', [ '-D_FILE_OFFSET_BITS=64', '-D_FILE_OFFSET_BITS=64' ])
311 conf.env.append_value('CXXFLAGS', [ '-D_LARGEFILE64_SOURCE', '-D_LARGEFILE_SOURCE' ])
312 conf.env.append_value('CXXFLAGS', [ '-D_FILE_OFFSET_BITS=64', '-D_FILE_OFFSET_BITS=64' ])
313 if opt.nls:
314 conf.env.append_value('CXXFLAGS', '-DENABLE_NLS')
315 conf.env.append_value('CCFLAGS', '-DENABLE_NLS')
318 #----------------------------------------------------------------
320 # Waf stages
322 def set_options(opt):
323 autowaf.set_options(opt)
324 opt.add_option('--program-name', type='string', action='store', default='Ardour', dest='program_name',
325 help='The user-visible name of the program being built')
326 opt.add_option('--arch', type='string', action='store', dest='arch',
327 help='Architecture-specific compiler flags')
328 opt.add_option('--boost-sp-debug', action='store_true', default=False, dest='boost_sp_debug',
329 help='Compile with Boost shared pointer debugging')
330 opt.add_option('--audiounits', action='store_true', default=False, dest='audiounits',
331 help='Compile with Apple\'s AudioUnit library (experimental)')
332 opt.add_option('--coreaudio', action='store_true', default=False, dest='coreaudio',
333 help='Compile with Apple\'s CoreAudio library')
334 opt.add_option('--dist-target', type='string', default='auto', dest='dist_target',
335 help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,powerpc,tiger,leopard]')
336 opt.add_option('--extra-warn', action='store_true', default=False, dest='extra_warn',
337 help='Build with even more compiler warning flags')
338 opt.add_option('--fpu-optimization', action='store_true', default=True, dest='fpu_optimization',
339 help='Build runtime checked assembler code (default)')
340 opt.add_option('--no-fpu-optimization', action='store_false', dest='fpu_optimization')
341 opt.add_option('--freedesktop', action='store_true', default=False, dest='freedesktop',
342 help='Install MIME type, icons and .desktop file as per freedesktop.org standards')
343 opt.add_option('--freesound', action='store_true', default=False, dest='freesound',
344 help='Include Freesound database lookup')
345 opt.add_option('--gprofile', action='store_true', default=False, dest='gprofile',
346 help='Compile for use with gprofile')
347 opt.add_option('--gtkosx', action='store_true', default=False, dest='gtkosx',
348 help='Compile for use with GTK-OSX, not GTK-X11')
349 opt.add_option('--lv2', action='store_true', default=False, dest='lv2',
350 help='Compile with support for LV2 (if slv2 is available)')
351 opt.add_option('--nls', action='store_true', default=True, dest='nls',
352 help='Enable i18n (native language support) (default)')
353 opt.add_option('--no-nls', action='store_false', dest='nls')
354 opt.add_option('--stl-debug', action='store_true', default=False, dest='stl_debug',
355 help='Build with debugging for the STL')
356 opt.add_option('--test', action='store_true', default=False, dest='build_tests',
357 help="Build unit tests")
358 opt.add_option('--tranzport', action='store_true', default=False, dest='tranzport',
359 help='Compile with support for Frontier Designs Tranzport (if libusb is available)')
360 opt.add_option('--universal', action='store_true', default=False, dest='universal',
361 help='Compile as universal binary (requires that external libraries are universal)')
362 opt.add_option('--versioned', action='store_true', default=False, dest='versioned',
363 help='Add revision information to executable name inside the build directory')
364 opt.add_option('--vst', action='store_true', default=False, dest='vst',
365 help='Compile with support for VST')
366 opt.add_option('--wiimote', action='store_true', default=False, dest='wiimote',
367 help='Build the wiimote control surface')
368 opt.add_option('--windows-key', type='string', action='store', dest='windows_key', default='Mod4><Super',
369 help='X Modifier(s) (Mod1,Mod2, etc) for the Windows key (X11 builds only). ' +
370 'Multiple modifiers must be separated by \'><\'')
372 for i in children:
373 opt.sub_options(i)
375 def sub_config_and_use(conf, name, has_objects = True):
376 conf.sub_config(name)
377 autowaf.set_local_lib(conf, name, has_objects)
379 def configure(conf):
380 create_stored_revision()
381 conf.env['VERSION'] = VERSION
382 autowaf.set_recursive()
383 autowaf.configure(conf)
385 gcc_versions = fetch_gcc_version()
386 if Options.options.debug and gcc_versions[0] == '4' and gcc_versions[1] > '4':
387 print 'Version 4.5 of gcc is not ready for use when compiling Ardour with optimization.'
388 print 'Please use a different version or re-configure with --debug'
389 exit (1)
391 if sys.platform == 'darwin':
393 # Define OSX as a uselib to use when compiling
394 # on Darwin to add all applicable flags at once
396 conf.env.append_value('CXXFLAGS_OSX', "-mmacosx-version-min=10.4")
397 conf.env.append_value('CCFLAGS_OSX', "-mmacosx-version-min=10.4")
398 conf.env.append_value('CXXFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
399 conf.env.append_value('CCFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
400 conf.env.append_value('LINKFLAGS_OSX', "-mmacosx-version-min=10.4")
401 conf.env.append_value('LINKFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
403 conf.env.append_value('LINKFLAGS_OSX', "-sysroot /Developer/SDKs/MacOSX10.4u.sdk")
404 conf.env.append_value('LINKFLAGS_OSX', "-F/System/Library/Frameworks")
406 conf.env.append_value('CXXFLAGS_OSX', "-msse")
407 conf.env.append_value('CCFLAGS_OSX', "-msse")
408 conf.env.append_value('CXXFLAGS_OSX', "-msse2")
409 conf.env.append_value('CCFLAGS_OSX', "-msse2")
411 # TODO: The previous sse flags NEED to be based
412 # off processor type. Need to add in a check
413 # for that.
416 conf.env.append_value('CPPPATH_OSX', "/System/Library/Frameworks/")
417 conf.env.append_value('CPPPATH_OSX', "/usr/include/")
418 conf.env.append_value('CPPPATH_OSX', "/usr/include/c++/4.0.0")
419 conf.env.append_value('CPPPATH_OSX', "/usr/include/c++/4.0.0/i686-apple-darwin8/")
421 # TODO: Fix the above include path, it needs to be
422 # defined based off what is read in the configuration
423 # stage about the machine(PPC, X86, X86_64, etc.)
425 conf.env.append_value('CPPPATH_OSX', "/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/")
427 # TODO: Likewise this needs to be defined not only
428 # based off the machine characteristics, but also
429 # based off the version of GCC being used.
432 conf.env.append_value('FRAMEWORK_OSX', ['CoreFoundation'])
434 conf.env.append_value('LINKFLAGS_OSX', ['-undefined', 'suppress'])
435 conf.env.append_value('LINKFLAGS_OSX', "-flat_namespace")
437 # The previous 2 flags avoid circular dependencies
438 # between libardour and libardour_cp on OS X.
439 # ld reported -undefined suppress as an unknown option
440 # in one of the tests ran, removing it for the moment
442 conf.env.append_value('CXXFLAGS_OSX', "-F/System/Library/Frameworks")
443 conf.env.append_value('CCFLAGS_OSX', "-F/System/Library/Frameworks")
445 # GTKOSX only builds on darwin anyways
446 if Options.options.gtkosx:
448 # Define Include Paths for GTKOSX
450 conf.env.append_value('CXXFLAGS_GTKOSX', '-DTOP_MENUBAR')
451 conf.env.append_value('CXXFLAGS_GTKOSX', '-DGTKOSX')
452 conf.env.append_value('LINKFLAGS_GTKOSX', "-framework AppKit")
453 conf.env.append_value('LINKFLAGS_GTKOSX', "-Xlinker -headerpad")
454 conf.env.append_value('LINKFLAGS_GTKOSX', "-Xlinker 2048")
455 conf.env.append_value('CPPPATH_GTKOSX', "/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/")
457 if Options.options.coreaudio:
458 conf.check_cc (header_name = '/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h',
459 define_name = 'HAVE_COREAUDIO', linkflags = ['-framework CoreAudio'],
460 uselib_store="COREAUDIO")
461 conf.check_cxx (header_name = '/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h',
462 linkflags = [ '-framework AudioToolbox' ], uselib_store="COREAUDIO")
463 conf.check_cc (header_name = '/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h',
464 linkflags = ['-framework CoreServices'], uselib_store="COREAUDIO")
466 if Options.options.audiounits:
467 #conf.env.append_value('CXXFLAGS_AUDIOUNIT', "-DHAVE_AUDIOUNITS")
468 conf.env.append_value('FRAMEWORK_AUDIOUNIT', ['AudioToolbox'])
469 conf.env.append_value('FRAMEWORK_AUDIOUNIT', ['CoreServices'])
470 conf.check_cc (header_name = '/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h',
471 define_name = 'HAVE_AUDIOUNITS', linkflags = [ '-framework AudioUnit' ],
472 uselib_store="AUDIOUNIT")
474 if Options.options.boost_sp_debug:
475 conf.env.append_value('CXXFLAGS', '-DBOOST_SP_ENABLE_DEBUG_HOOKS')
477 autowaf.check_header(conf, 'boost/signals2.hpp', mandatory = True)
479 autowaf.check_header(conf, 'jack/session.h', define="JACK_SESSION")
481 conf.check_cc(fragment = "#include <boost/version.hpp>\nint main(void) { return (BOOST_VERSION >= 103900 ? 0 : 1); }\n",
482 execute = "1",
483 mandatory = True,
484 msg = 'Checking for boost library >= 1.39',
485 okmsg = 'ok',
486 errmsg = 'too old\nPlease install boost version 1.39 or higher.')
488 autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
489 autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
490 autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2')
491 autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0')
492 if sys.platform == 'darwin':
493 sub_config_and_use(conf, 'libs/appleutility')
494 for i in children:
495 sub_config_and_use(conf, i)
497 # Fix utterly braindead FLAC include path to not smash assert.h
498 conf.env['CPPPATH_FLAC'] = []
500 # Tell everyone that this is a waf build
502 conf.env.append_value('CCFLAGS', '-DWAF_BUILD')
503 conf.env.append_value('CXXFLAGS', '-DWAF_BUILD')
505 autowaf.print_summary(conf)
506 opts = Options.options
507 autowaf.display_header('Ardour Configuration')
508 autowaf.display_msg(conf, 'Build Target', conf.env['build_target'])
509 autowaf.display_msg(conf, 'Architecture flags', opts.arch)
510 autowaf.display_msg(conf, 'Aubio', bool(conf.env['HAVE_AUBIO']))
511 autowaf.display_msg(conf, 'AudioUnits', opts.audiounits)
512 autowaf.display_msg(conf, 'CoreAudio', bool(conf.env['HAVE_COREAUDIO']))
513 if bool(conf.env['HAVE_COREAUDIO']):
514 conf.define ('COREAUDIO', 1)
515 if opts.audiounits:
516 conf.define('AUDIOUNITS',1)
517 autowaf.display_msg(conf, 'FPU Optimization', opts.fpu_optimization)
518 if opts.fpu_optimization:
519 conf.define('FPU_OPTIMIZATION', 1)
520 autowaf.display_msg(conf, 'Freedesktop Files', opts.freedesktop)
521 autowaf.display_msg(conf, 'Freesound', opts.freesound)
522 if opts.freesound:
523 conf.define('FREESOUND',1)
524 autowaf.display_msg(conf, 'GtkOSX', opts.gtkosx)
525 if opts.gtkosx:
526 conf.define ('GTKOSX', 1)
527 autowaf.display_msg(conf, 'LV2 Support', bool(conf.env['HAVE_SLV2']))
528 autowaf.display_msg(conf, 'Rubberband', bool(conf.env['HAVE_RUBBERBAND']))
529 autowaf.display_msg(conf, 'Samplerate', bool(conf.env['HAVE_SAMPLERATE']))
530 autowaf.display_msg(conf, 'Soundtouch', bool(conf.env['HAVE_SOUNDTOUCH']))
531 autowaf.display_msg(conf, 'Translation', opts.nls)
532 if opts.nls:
533 conf.define ('ENABLE_NLS', 1)
534 autowaf.display_msg(conf, 'Tranzport', opts.tranzport)
535 if opts.build_tests:
536 conf.env['BUILD_TESTS'] = opts.build_tests
537 autowaf.display_msg(conf, 'Unit Tests', bool(conf.env['BUILD_TESTS']) and bool (conf.env['HAVE_CPPUNIT']))
538 if opts.tranzport:
539 conf.define('TRANZPORT', 1)
540 autowaf.display_msg(conf, 'Universal Binary', opts.universal)
541 autowaf.display_msg(conf, 'VST Support', opts.vst)
542 if opts.vst:
543 conf.define('VST_SUPPORT', 1)
544 if bool(conf.env['JACK_SESSION']):
545 conf.define ('HAVE_JACK_SESSION', 1)
546 autowaf.display_msg(conf, 'Wiimote Support', opts.wiimote)
547 if opts.wiimote:
548 conf.define('WIIMOTE',1)
549 if opts.windows_key:
550 conf.define('WINDOWS_KEY', opts.windows_key)
551 autowaf.display_msg(conf, 'Windows Key', opts.windows_key)
552 conf.env['PROGRAM_NAME'] = opts.program_name
553 autowaf.display_msg(conf, 'Program Name', opts.program_name)
555 set_compiler_flags (conf, Options.options)
557 autowaf.display_msg(conf, 'C Compiler flags', conf.env['CCFLAGS'])
558 autowaf.display_msg(conf, 'C++ Compiler flags', conf.env['CXXFLAGS'])
560 # and dump the same stuff to a file for use in the build
562 config_text = open ('libs/ardour/config_text.cc',"w")
563 config_text.write ('#include "ardour/ardour.h"\n\nnamespace ARDOUR {\nconst char* const ardour_config_info = "\\n\\\n')
564 config_text.write ("Install prefix "); config_text.write (str (conf.env['PREFIX'])); config_text.write ("\\n\\\n")
565 config_text.write ("Debuggable build "); config_text.write (str (str(conf.env['DEBUG']))); config_text.write ("\\n\\\n")
566 config_text.write ("Strict compiler flags "); config_text.write (str (str(conf.env['STRICT']))); config_text.write ("\\n\\\n")
567 config_text.write ("Build documentation "); config_text.write (str (str(conf.env['BUILD_DOCS']))); config_text.write ("\\n\\\n")
568 config_text.write ('Build Target '); config_text.write (str (conf.env['build_target'])); config_text.write ("\\n\\\n")
569 config_text.write ('Architecture flags '); config_text.write (str (opts.arch)); config_text.write ("\\n\\\n")
570 config_text.write ('Aubio '); config_text.write (str (bool(conf.env['HAVE_AUBIO']))); config_text.write ("\\n\\\n")
571 config_text.write ('AudioUnits '); config_text.write (str (opts.audiounits)); config_text.write ("\\n\\\n")
572 config_text.write ('CoreAudio '); config_text.write (str (bool(conf.env['HAVE_COREAUDIO']))); config_text.write ("\\n\\\n")
573 config_text.write ('FPU Optimization '); config_text.write (str (opts.fpu_optimization)); config_text.write ("\\n\\\n")
574 config_text.write ('Freedesktop Files '); config_text.write (str (opts.freedesktop)); config_text.write ("\\n\\\n")
575 config_text.write ('Freesound '); config_text.write (str (opts.freesound)); config_text.write ("\\n\\\n")
576 config_text.write ('GtkOSX '); config_text.write (str (opts.gtkosx)); config_text.write ("\\n\\\n")
577 config_text.write ('LV2 Support '); config_text.write (str (bool(conf.env['HAVE_SLV2']))); config_text.write ("\\n\\\n")
578 config_text.write ('Rubberband '); config_text.write (str (bool(conf.env['HAVE_RUBBERBAND']))); config_text.write ("\\n\\\n")
579 config_text.write ('Samplerate '); config_text.write (str (bool(conf.env['HAVE_SAMPLERATE']))); config_text.write ("\\n\\\n")
580 config_text.write ('Soundtouch '); config_text.write (str (bool(conf.env['HAVE_SOUNDTOUCH']))); config_text.write ("\\n\\\n")
581 config_text.write ('Translation '); config_text.write (str (opts.nls)); config_text.write ("\\n\\\n")
582 config_text.write ('Tranzport '); config_text.write (str (opts.tranzport)); config_text.write ("\\n\\\n")
583 config_text.write ('Universal Binary '); config_text.write (str (opts.universal)); config_text.write ("\\n\\\n")
584 config_text.write ('VST Support '); config_text.write (str (opts.vst)); config_text.write ("\\n\\\n")
585 config_text.write ('Wiimote Support '); config_text.write (str (opts.wiimote)); config_text.write ("\\n\\\n")
586 config_text.write ('Windows Key '); config_text.write (str (opts.windows_key)); config_text.write ("\\n\\\n")
587 config_text.write ('C Compiler flags '); config_text.write (str (conf.env['CCFLAGS'])); config_text.write ("\\n\\\n")
588 config_text.write ('C++ Compiler flags '); config_text.write (str (conf.env['CXXFLAGS'])); config_text.write ("\\n\\\n")
589 config_text.write ('";}\n')
590 config_text.close ()
592 def build(bld):
593 autowaf.set_recursive()
594 if sys.platform == 'darwin':
595 bld.add_subdirs('libs/appleutility')
596 for i in children:
597 bld.add_subdirs(i)
599 # ideally, we'd like to use the OS-provided MIDI API
600 # for default ports. that doesn't work on at least
601 # Fedora (Nov 9th, 2009) so use JACK MIDI on linux.
603 if sys.platform == 'darwin':
604 rc_subst_dict = {
605 'MIDITAG' : 'control',
606 'MIDITYPE' : 'coremidi',
607 'JACK_INPUT' : 'auditioner'
609 else:
610 rc_subst_dict = {
611 'MIDITAG' : 'control',
612 'MIDITYPE' : 'jack',
613 'JACK_INPUT' : 'auditioner'
616 obj = bld.new_task_gen('subst')
617 obj.source = 'ardour.rc.in'
618 obj.target = 'ardour_system.rc'
619 obj.dict = rc_subst_dict
620 obj.install_path = '${CONFIGDIR}/ardour3'
622 def i18n(bld):
623 bld.recurse (i18n_children)