2 from waflib.extras import autowaf as autowaf
3 from waflib import Options
4 from waflib import TaskGen
8 # Version of this package (even if built as a child)
12 LIBPBD_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO)
14 # Library version (UNIX style major, minor, micro)
15 # major increment <=> incompatible changes
16 # minor increment <=> compatible changes (additions)
17 # micro increment <=> no interface changes
18 LIBPBD_LIB_VERSION = '4.1.0'
20 # Variables for 'waf dist'
22 VERSION = LIBPBD_VERSION
23 I18N_PACKAGE = 'libpbd4'
29 path_prefix = 'libs/pbd/'
39 'controllable_descriptor.cc',
70 'stateful_diff_command.cc',
85 autowaf.set_options(opt)
88 conf.load('compiler_cxx')
89 autowaf.build_version_files(path_prefix+'pbd/version.h', path_prefix+'version.cc',
90 'libpbd', MAJOR, MINOR, MICRO)
91 autowaf.configure(conf)
92 autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
93 autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
94 if sys.platform != 'darwin':
95 autowaf.check_pkg(conf, 'uuid', uselib_store='UUID')
97 conf.check(function_name='getmntent', header_name='mntent.h', define_name='HAVE_GETMNTENT',mandatory=False)
98 conf.check(header_name='execinfo.h', define_name='HAVE_EXECINFO',mandatory=False)
99 conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
100 conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', cflags='-D_XOPEN_SOURCE=600', define_name='HAVE_POSIX_MEMALIGN', mandatory=False)
102 conf.write_config_header('libpbd-config.h', remove=False)
105 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
106 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
107 # autowaf.check_header(conf, 'cxx', 'boost/uuid/uuid.hpp')
111 # Make signals_generated.h using signals.py
112 bld(rule = 'python ${SRC} ${TGT}', source = 'pbd/signals.py', target = 'pbd/signals_generated.h')
115 if bld.is_defined ('INTERNAL_SHARED_LIBS'):
116 print('BUILD SHARED LIB')
117 obj = bld.shlib(features = 'cxx cxxshlib', source=libpbd_sources)
119 print('BUILD STATIC LIB')
120 obj = bld.stlib(features = 'cxx cxxstlib', source=libpbd_sources)
121 obj.cxxflags = [ '-fPIC' ]
123 if bld.is_defined('DEBUG_RT_ALLOC'):
124 obj.source += 'debug_rt_alloc.c'
126 obj.export_includes = ['.']
130 obj.uselib = 'GLIBMM SIGCPP XML UUID SNDFILE GIOMM'
131 if sys.platform == 'darwin':
132 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
133 if 'cocoa_open_uri.mm' not in obj.source:
134 obj.source += [ 'cocoa_open_uri.mm' ]
136 obj.vnum = LIBPBD_LIB_VERSION
137 obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
138 obj.defines = ['PACKAGE="' + I18N_PACKAGE + '"']
140 if bld.env['build_target'] == 'x86_64':
141 obj.defines += [ 'USE_X86_64_ASM' ]
143 if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
145 testobj = bld(features = 'cxx cxxprogram')
149 test/scalar_properties.cc
152 test/filesystem_test.cc
155 testobj.target = 'run-tests'
156 testobj.includes = obj.includes + ['test', '../pbd']
157 testobj.uselib = 'CPPUNIT XML SNDFILE'
158 testobj.use = 'libpbd'
159 testobj.name = 'libpbd-tests'
160 if sys.platform != 'darwin':
161 testobj.linkflags = ['-lrt']