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',
|
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',
|
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',
|
|
|
|
'stacktrace.cc',
|
|
|
|
'stateful_diff_command.cc',
|
|
|
|
'stateful.cc',
|
|
|
|
'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',
|
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):
|
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.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')
|
|
|
|
|
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)
|
2015-07-19 17:02:24 -04:00
|
|
|
if not Options.options.ppc:
|
|
|
|
conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', cflags='-D_XOPEN_SOURCE=600', define_name='HAVE_POSIX_MEMALIGN', mandatory=False)
|
2013-07-11 15:00:22 -04:00
|
|
|
conf.check(function_name='localtime_r', header_name='time.h', define_name='HAVE_LOCALTIME_R',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')
|
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
|
|
|
|
|
|
|
def build(bld):
|
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)
|
|
|
|
obj.cxxflags = [ '-fPIC' ]
|
2013-10-17 13:51:02 -04:00
|
|
|
obj.cflags = [ '-fPIC' ]
|
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'
|
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-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
|
|
|
|
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
|
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-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']
|
|
|
|
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'
|
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':
|
2012-05-14 09:34:50 -04:00
|
|
|
testobj.linkflags = ['-lrt']
|
2015-11-29 11:52:42 -05:00
|
|
|
|
2009-02-25 12:51:42 -05:00
|
|
|
def shutdown():
|
2011-04-22 18:15:21 -04:00
|
|
|
autowaf.shutdown()
|