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'
|
2016-12-04 15:15:11 -05:00
|
|
|
LIBPBD_MAJOR_VERSION = '4'
|
2009-02-25 12:51:42 -05:00
|
|
|
|
|
|
|
# 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',
|
2014-12-22 18:53:19 -05:00
|
|
|
'configuration_variable.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'convert.cc',
|
|
|
|
'controllable.cc',
|
2014-12-04 04:16:06 -05:00
|
|
|
'crossthread.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'cpus.cc',
|
|
|
|
'debug.cc',
|
2015-10-29 07:58:51 -04:00
|
|
|
'demangle.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'enumwriter.cc',
|
|
|
|
'event_loop.cc',
|
|
|
|
'enums.cc',
|
|
|
|
'epa.cc',
|
|
|
|
'error.cc',
|
2013-07-17 05:29:34 -04:00
|
|
|
'ffs.cc',
|
2016-09-13 10:14:08 -04:00
|
|
|
'file_archive.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'file_utils.cc',
|
2015-04-21 11:39:19 -04:00
|
|
|
'fpu.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'id.cc',
|
|
|
|
'locale_guard.cc',
|
2013-07-11 15:00:22 -04:00
|
|
|
'localtime_r.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'malign.cc',
|
2014-07-08 00:49:53 -04:00
|
|
|
'md5.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'mountpoint.cc',
|
|
|
|
'openuri.cc',
|
|
|
|
'pathexpand.cc',
|
2013-08-09 08:03:39 -04:00
|
|
|
'pbd.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'pool.cc',
|
|
|
|
'property_list.cc',
|
|
|
|
'pthread_utils.cc',
|
2016-01-26 22:53:57 -05:00
|
|
|
'reallocpool.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'receiver.cc',
|
2013-07-11 12:41:55 -04:00
|
|
|
'resource.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'search_path.cc',
|
|
|
|
'semutils.cc',
|
|
|
|
'shortpath.cc',
|
|
|
|
'signals.cc',
|
2017-10-26 16:33:11 -04:00
|
|
|
'spinlock.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'stacktrace.cc',
|
|
|
|
'stateful_diff_command.cc',
|
|
|
|
'stateful.cc',
|
2015-08-02 22:32:31 -04:00
|
|
|
'string_convert.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'strreplace.cc',
|
|
|
|
'strsplit.cc',
|
2014-02-18 21:38:43 -05:00
|
|
|
'system_exec.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'textreceiver.cc',
|
2014-12-25 08:44:06 -05:00
|
|
|
'timer.cc',
|
2014-12-22 00:39:57 -05:00
|
|
|
'timing.cc',
|
2016-07-19 09:03:51 -04:00
|
|
|
'tlsf.cc',
|
2013-03-20 17:18:55 -04:00
|
|
|
'transmitter.cc',
|
|
|
|
'undo.cc',
|
|
|
|
'uuid.cc',
|
|
|
|
'whitespace.cc',
|
|
|
|
'xml++.cc',
|
|
|
|
]
|
|
|
|
|
2011-09-29 15:17:54 -04:00
|
|
|
def options(opt):
|
2016-12-04 15:15:11 -05:00
|
|
|
opt.load('compiler_cxx')
|
2011-04-22 18:15:21 -04:00
|
|
|
autowaf.set_options(opt)
|
2016-12-04 15:15:11 -05:00
|
|
|
opt.add_option('--ppc', action='store_true', default=False, dest='ppc',
|
|
|
|
help='Compile with -arch ppc (OS X ONLY)')
|
|
|
|
opt.add_option('--dist-target', type='string', default='auto', dest='dist_target',
|
|
|
|
help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,tiger,leopard,mingw,msvc]')
|
|
|
|
opt.add_option('--internal-shared-libs', action='store_true', default=True, dest='internal_shared_libs',
|
|
|
|
help='Build internal libs as shared libraries')
|
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.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')
|
2016-12-04 15:15:11 -05:00
|
|
|
autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL', atleast_version='7.0.0', mandatory=True)
|
|
|
|
autowaf.check_pkg(conf, 'libarchive', uselib_store='ARCHIVE', atleast_version='3.0.0', mandatory=True)
|
|
|
|
autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.32.0', mandatory=True)
|
|
|
|
autowaf.check_pkg(conf, 'giomm-2.4', uselib_store='GIOMM', atleast_version='2.2', mandatory=True)
|
2011-04-22 18:15:21 -04:00
|
|
|
|
2011-09-30 08:11:20 -04:00
|
|
|
conf.check(header_name='execinfo.h', define_name='HAVE_EXECINFO',mandatory=False)
|
|
|
|
conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
|
2015-07-19 17:02:24 -04:00
|
|
|
if not Options.options.ppc:
|
2020-01-20 17:08:11 -05:00
|
|
|
conf.check_cc(
|
|
|
|
msg="Checking for function 'posix_memalign' in stdlib.h",
|
|
|
|
fragment = "#define _XOPEN_SOURCE 600\n #include <stdlib.h>\n int main(void) { return posix_memalign (0, 64, 1); }\n",
|
|
|
|
define_name='HAVE_POSIX_MEMALIGN', execute = False, mandatory=False)
|
|
|
|
conf.check_cc(
|
|
|
|
msg="Checking for function 'getmntent' in mntent.h",
|
|
|
|
fragment = "#include <mntent.h>\n int main(void) { return (int)getmntent(0); }\n",
|
|
|
|
define_name='HAVE_GETMNTENT', execute = False, mandatory=False)
|
|
|
|
conf.check_cc(
|
|
|
|
msg="Checking for function 'localtime_r' in time.h",
|
|
|
|
fragment = "#include <time.h>\n int main(void) { return localtime_r(NULL, NULL); }\n",
|
|
|
|
define_name='HAVE_LOCALTIME_R', execute = False, mandatory=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')
|
2014-05-02 06:48:04 -04:00
|
|
|
if Options.options.dist_target == 'mingw':
|
2014-03-04 09:25:58 -05:00
|
|
|
conf.check(compiler='cxx',
|
|
|
|
lib='ole32',
|
|
|
|
mandatory=True,
|
|
|
|
uselib_store='OLE')
|
2009-02-25 12:51:42 -05:00
|
|
|
|
2016-12-04 15:15:11 -05:00
|
|
|
if Options.options.internal_shared_libs:
|
|
|
|
conf.define('INTERNAL_SHARED_LIBS', 1)
|
|
|
|
|
|
|
|
conf.write_config_header('libpbd-config.h', remove=False)
|
|
|
|
|
2009-02-25 12:51:42 -05:00
|
|
|
def build(bld):
|
2016-12-04 15:15:11 -05:00
|
|
|
if not autowaf.is_child(): # Building standalone, install dev stuff
|
|
|
|
# C++ Headers
|
|
|
|
includedir = '${INCLUDEDIR}/pbd-%s/pbd' % LIBPBD_MAJOR_VERSION
|
|
|
|
bld.install_files(includedir, bld.path.ant_glob('pbd/*.h'))
|
|
|
|
bld.install_files(includedir, 'build/pbd/signals_generated.h')
|
|
|
|
|
|
|
|
# Pkgconfig file
|
|
|
|
autowaf.build_pc(bld, 'libpbd', LIBPBD_VERSION, LIBPBD_MAJOR_VERSION, [],
|
|
|
|
{'LIBPBD_VERSION' : LIBPBD_VERSION,
|
|
|
|
'LIBPBD_MAJOR_VERSION' : LIBPBD_MAJOR_VERSION})
|
2014-03-04 09:25:58 -05:00
|
|
|
|
2012-05-16 08:10:06 -04:00
|
|
|
# Make signals_generated.h using signals.py
|
2015-12-06 18:49:04 -05:00
|
|
|
bld(rule = sys.executable + ' ${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'):
|
|
|
|
obj = bld.shlib(features = 'cxx cxxshlib', source=libpbd_sources)
|
2013-10-18 11:50:44 -04:00
|
|
|
obj.defines = [ 'LIBPBD_DLL_EXPORTS=1' ]
|
2013-03-20 17:18:55 -04:00
|
|
|
else:
|
|
|
|
obj = bld.stlib(features = 'cxx cxxstlib', source=libpbd_sources)
|
2020-01-13 18:52:01 -05:00
|
|
|
obj.cxxflags = [ bld.env['compiler_flags_dict']['pic'] ]
|
|
|
|
obj.cflags = [ bld.env['compiler_flags_dict']['pic'] ]
|
2013-10-16 23:30:28 -04:00
|
|
|
obj.defines = []
|
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'
|
2020-01-20 17:08:11 -05:00
|
|
|
obj.uselib = 'GLIBMM SIGCPP XML UUID SNDFILE GIOMM ARCHIVE CURL XML'
|
2011-04-22 18:15:21 -04:00
|
|
|
if sys.platform == 'darwin':
|
|
|
|
TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
|
2013-08-02 11:29:12 -04:00
|
|
|
if 'cocoa_open_uri.mm' not in obj.source:
|
|
|
|
obj.source += [ 'cocoa_open_uri.mm' ]
|
2011-04-22 18:15:21 -04:00
|
|
|
obj.uselib += ' OSX'
|
|
|
|
obj.vnum = LIBPBD_LIB_VERSION
|
2014-04-28 21:11:08 -04:00
|
|
|
obj.install_path = bld.env['LIBDIR']
|
2014-11-29 01:58:07 -05:00
|
|
|
obj.defines += [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
|
2014-03-04 09:25:58 -05:00
|
|
|
|
2016-07-05 10:35:31 -04:00
|
|
|
if sys.platform.startswith('netbsd'):
|
|
|
|
obj.linkflags = '-lexecinfo'
|
|
|
|
|
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' ]
|
2014-03-01 22:44:56 -05:00
|
|
|
if bld.env['build_target'] == 'mingw':
|
2015-05-12 21:07:09 -04:00
|
|
|
obj.defines += [ 'NO_POSIX_MEMALIGN' ]
|
2014-03-02 10:53:25 -05:00
|
|
|
obj.source += [ 'windows_special_dirs.cc' ]
|
2015-09-12 07:41:00 -04:00
|
|
|
obj.source += [ 'windows_timer_utils.cc' ]
|
2015-09-13 23:26:07 -04:00
|
|
|
obj.source += [ 'windows_mmcss.cc' ]
|
2014-03-04 09:25:58 -05:00
|
|
|
obj.uselib += ' OLE'
|
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
|
2013-07-13 17:00:18 -04:00
|
|
|
test/mutex_test.cc
|
2011-04-22 18:15:21 -04:00
|
|
|
test/scalar_properties.cc
|
|
|
|
test/signals_test.cc
|
2015-08-02 22:32:31 -04:00
|
|
|
test/string_convert_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
|
2016-07-14 10:52:19 -04:00
|
|
|
test/natsort_test.cc
|
2016-01-27 20:40:59 -05:00
|
|
|
test/reallocpool_test.cc
|
2015-07-25 02:43:24 -04:00
|
|
|
test/xml_test.cc
|
2013-07-11 10:58:35 -04:00
|
|
|
test/test_common.cc
|
2011-04-22 18:15:21 -04:00
|
|
|
'''.split()
|
2015-09-13 20:33:48 -04:00
|
|
|
if bld.env['build_target'] == 'mingw':
|
|
|
|
testobj.source += [ 'test/windows_timer_utils_test.cc' ]
|
2011-04-22 18:15:21 -04:00
|
|
|
testobj.target = 'run-tests'
|
|
|
|
testobj.includes = obj.includes + ['test', '../pbd']
|
2020-01-27 11:43:37 -05:00
|
|
|
testobj.uselib = 'GLIBMM SIGCPP XML UUID SNDFILE GIOMM ARCHIVE CURL XML OSX CPPUNIT'
|
2011-09-29 15:17:54 -04:00
|
|
|
testobj.use = 'libpbd'
|
2012-05-14 13:07:53 -04:00
|
|
|
testobj.name = 'libpbd-tests'
|
2014-11-29 01:56:26 -05:00
|
|
|
testobj.defines = [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
|
2013-07-15 13:43:17 -04:00
|
|
|
if sys.platform != 'darwin' and bld.env['build_target'] != 'mingw':
|
2020-01-27 11:43:37 -05:00
|
|
|
testobj.lib = ['rt']
|