2009-02-25 12:51:42 -05:00
|
|
|
#!/usr/bin/env python
|
2011-09-29 15:17:54 -04:00
|
|
|
from waflib.extras import autowaf as autowaf
|
2013-03-20 17:18:55 -04:00
|
|
|
from waflib import Options
|
2011-09-29 15:58:05 -04:00
|
|
|
from waflib import TaskGen
|
2009-02-26 23:40:44 -05:00
|
|
|
import os
|
2009-08-08 18:36:32 -04:00
|
|
|
import sys
|
2009-02-25 12:51:42 -05:00
|
|
|
|
|
|
|
# Version of this package (even if built as a child)
|
2009-02-25 21:24:16 -05:00
|
|
|
MAJOR = '4'
|
|
|
|
MINOR = '1'
|
|
|
|
MICRO = '0'
|
|
|
|
LIBPBD_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
|
2009-02-25 12:51:42 -05:00
|
|
|
|
|
|
|
# Library version (UNIX style major, minor, micro)
|
|
|
|
# major increment <=> incompatible changes
|
|
|
|
# minor increment <=> compatible changes (additions)
|
|
|
|
# micro increment <=> no interface changes
|
|
|
|
LIBPBD_LIB_VERSION = '4.1.0'
|
|
|
|
|
|
|
|
# Variables for 'waf dist'
|
|
|
|
APPNAME = 'libpbd'
|
|
|
|
VERSION = LIBPBD_VERSION
|
2011-11-21 17:24:56 -05:00
|
|
|
I18N_PACKAGE = 'libpbd4'
|
2009-02-25 12:51:42 -05:00
|
|
|
|
|
|
|
# Mandatory variables
|
2011-09-29 15:17:54 -04:00
|
|
|
top = '.'
|
|
|
|
out = 'build'
|
2009-02-25 12:51:42 -05:00
|
|
|
|
2009-02-25 21:24:16 -05:00
|
|
|
path_prefix = 'libs/pbd/'
|
|
|
|
|
2013-03-20 17:18:55 -04:00
|
|
|
libpbd_sources = [
|
|
|
|
'basename.cc',
|
|
|
|
'base_ui.cc',
|
|
|
|
'boost_debug.cc',
|
|
|
|
'cartesian.cc',
|
|
|
|
'command.cc',
|
|
|
|
'convert.cc',
|
|
|
|
'controllable.cc',
|
|
|
|
'controllable_descriptor.cc',
|
|
|
|
'clear_dir.cc',
|
|
|
|
'crossthread.cc',
|
|
|
|
'cpus.cc',
|
|
|
|
'debug.cc',
|
|
|
|
'enumwriter.cc',
|
|
|
|
'event_loop.cc',
|
|
|
|
'enums.cc',
|
|
|
|
'epa.cc',
|
|
|
|
'error.cc',
|
|
|
|
'file_manager.cc',
|
|
|
|
'file_utils.cc',
|
|
|
|
'fpu.cc',
|
|
|
|
'id.cc',
|
|
|
|
'locale_guard.cc',
|
|
|
|
'malign.cc',
|
|
|
|
'mountpoint.cc',
|
|
|
|
'openuri.cc',
|
|
|
|
'pathexpand.cc',
|
|
|
|
'pathscanner.cc',
|
|
|
|
'pool.cc',
|
|
|
|
'property_list.cc',
|
|
|
|
'pthread_utils.cc',
|
|
|
|
'receiver.cc',
|
|
|
|
'search_path.cc',
|
|
|
|
'semutils.cc',
|
|
|
|
'shortpath.cc',
|
|
|
|
'signals.cc',
|
|
|
|
'sndfile_manager.cc',
|
|
|
|
'stacktrace.cc',
|
|
|
|
'stateful_diff_command.cc',
|
|
|
|
'stateful.cc',
|
|
|
|
'strreplace.cc',
|
|
|
|
'strsplit.cc',
|
|
|
|
'textreceiver.cc',
|
|
|
|
'transmitter.cc',
|
|
|
|
'undo.cc',
|
|
|
|
'uuid.cc',
|
|
|
|
'version.cc',
|
|
|
|
'whitespace.cc',
|
|
|
|
'xml++.cc',
|
|
|
|
]
|
|
|
|
|
2011-09-29 15:17:54 -04:00
|
|
|
def options(opt):
|
2011-04-22 18:15:21 -04:00
|
|
|
autowaf.set_options(opt)
|
2009-02-25 12:51:42 -05:00
|
|
|
|
|
|
|
def configure(conf):
|
2011-09-29 15:58:05 -04:00
|
|
|
conf.load('compiler_cxx')
|
2011-04-22 18:15:21 -04:00
|
|
|
autowaf.build_version_files(path_prefix+'pbd/version.h', path_prefix+'version.cc',
|
|
|
|
'libpbd', MAJOR, MINOR, MICRO)
|
|
|
|
autowaf.configure(conf)
|
|
|
|
autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
|
|
|
|
autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
|
|
|
|
if sys.platform != 'darwin':
|
|
|
|
autowaf.check_pkg(conf, 'uuid', uselib_store='UUID')
|
|
|
|
|
2011-09-30 08:11:20 -04:00
|
|
|
conf.check(function_name='getmntent', header_name='mntent.h', define_name='HAVE_GETMNTENT',mandatory=False)
|
|
|
|
conf.check(header_name='execinfo.h', define_name='HAVE_EXECINFO',mandatory=False)
|
|
|
|
conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
|
2012-05-16 20:54:43 -04:00
|
|
|
conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', cflags='-D_XOPEN_SOURCE=600', define_name='HAVE_POSIX_MEMALIGN', mandatory=False)
|
2011-04-22 18:15:21 -04:00
|
|
|
|
2011-09-29 15:17:54 -04:00
|
|
|
conf.write_config_header('libpbd-config.h', remove=False)
|
2011-04-22 18:15:21 -04:00
|
|
|
|
|
|
|
# Boost headers
|
2011-09-29 15:17:54 -04:00
|
|
|
autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
|
|
|
|
autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
|
|
|
|
# autowaf.check_header(conf, 'cxx', 'boost/uuid/uuid.hpp')
|
2009-02-25 12:51:42 -05:00
|
|
|
|
|
|
|
def build(bld):
|
2012-05-14 13:46:07 -04:00
|
|
|
|
2012-05-16 08:10:06 -04:00
|
|
|
# Make signals_generated.h using signals.py
|
2012-05-14 20:05:57 -04:00
|
|
|
bld(rule = 'python ${SRC} ${TGT}', source = 'pbd/signals.py', target = 'pbd/signals_generated.h')
|
2012-05-14 13:46:07 -04:00
|
|
|
|
2011-04-22 18:15:21 -04:00
|
|
|
# Library
|
2013-03-20 17:18:55 -04:00
|
|
|
if bld.is_defined ('INTERNAL_SHARED_LIBS'):
|
2013-03-24 08:51:57 -04:00
|
|
|
print('BUILD SHARED LIB')
|
2013-03-20 17:18:55 -04:00
|
|
|
obj = bld.shlib(features = 'cxx cxxshlib', source=libpbd_sources)
|
|
|
|
else:
|
2013-03-24 08:51:57 -04:00
|
|
|
print('BUILD STATIC LIB')
|
2013-03-20 17:18:55 -04:00
|
|
|
obj = bld.stlib(features = 'cxx cxxstlib', source=libpbd_sources)
|
|
|
|
obj.cxxflags = [ '-fPIC' ]
|
2011-04-22 18:15:21 -04:00
|
|
|
|
2011-09-30 12:22:04 -04:00
|
|
|
if bld.is_defined('DEBUG_RT_ALLOC'):
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.source += 'debug_rt_alloc.c'
|
|
|
|
|
2011-09-29 15:17:54 -04:00
|
|
|
obj.export_includes = ['.']
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.includes = ['.']
|
|
|
|
obj.name = 'libpbd'
|
|
|
|
obj.target = 'pbd'
|
2011-10-22 17:46:46 -04:00
|
|
|
obj.uselib = 'GLIBMM SIGCPP XML UUID SNDFILE GIOMM'
|
2011-04-22 18:15:21 -04:00
|
|
|
if sys.platform == 'darwin':
|
|
|
|
TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
|
2013-04-01 09:03:33 -04:00
|
|
|
obj.source += [ 'cocoa_open_uri.mm' ]
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.uselib += ' OSX'
|
|
|
|
obj.vnum = LIBPBD_LIB_VERSION
|
|
|
|
obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
|
2011-11-21 17:24:56 -05:00
|
|
|
obj.defines = ['PACKAGE="' + I18N_PACKAGE + '"']
|
2011-04-22 18:15:21 -04:00
|
|
|
|
|
|
|
if bld.env['build_target'] == 'x86_64':
|
2011-11-21 17:24:56 -05:00
|
|
|
obj.defines += [ 'USE_X86_64_ASM' ]
|
2011-04-22 18:15:21 -04:00
|
|
|
|
2011-11-12 22:54:29 -05:00
|
|
|
if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
|
2011-04-22 18:15:21 -04:00
|
|
|
# Unit tests
|
2011-09-29 15:17:54 -04:00
|
|
|
testobj = bld(features = 'cxx cxxprogram')
|
2011-04-22 18:15:21 -04:00
|
|
|
testobj.source = '''
|
|
|
|
test/testrunner.cc
|
|
|
|
test/xpath.cc
|
|
|
|
test/scalar_properties.cc
|
|
|
|
test/signals_test.cc
|
2012-04-01 10:29:26 -04:00
|
|
|
test/convert_test.cc
|
2012-05-28 12:32:41 -04:00
|
|
|
test/filesystem_test.cc
|
2013-07-11 10:58:35 -04:00
|
|
|
test/test_common.cc
|
2011-04-22 18:15:21 -04:00
|
|
|
'''.split()
|
|
|
|
testobj.target = 'run-tests'
|
|
|
|
testobj.includes = obj.includes + ['test', '../pbd']
|
|
|
|
testobj.uselib = 'CPPUNIT XML SNDFILE'
|
2011-09-29 15:17:54 -04:00
|
|
|
testobj.use = 'libpbd'
|
2012-05-14 13:07:53 -04:00
|
|
|
testobj.name = 'libpbd-tests'
|
2012-05-14 09:34:50 -04:00
|
|
|
if sys.platform != 'darwin':
|
|
|
|
testobj.linkflags = ['-lrt']
|
2010-04-02 10:52:55 -04:00
|
|
|
|
2010-11-13 00:14:48 -05:00
|
|
|
|
2009-02-25 12:51:42 -05:00
|
|
|
def shutdown():
|
2011-04-22 18:15:21 -04:00
|
|
|
autowaf.shutdown()
|