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/'
37 'configuration_variable.cc',
72 'stateful_diff_command.cc',
88 autowaf.set_options(opt)
91 conf.load('compiler_cxx')
92 autowaf.configure(conf)
93 autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
94 autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
96 conf.check(function_name='getmntent', header_name='mntent.h', define_name='HAVE_GETMNTENT',mandatory=False)
97 conf.check(header_name='execinfo.h', define_name='HAVE_EXECINFO',mandatory=False)
98 conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
99 if not Options.options.ppc:
100 conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', cflags='-D_XOPEN_SOURCE=600', define_name='HAVE_POSIX_MEMALIGN', mandatory=False)
101 conf.check(function_name='localtime_r', header_name='time.h', define_name='HAVE_LOCALTIME_R',mandatory=False)
103 conf.write_config_header('libpbd-config.h', remove=False)
106 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
107 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
108 if Options.options.dist_target == 'mingw':
109 conf.check(compiler='cxx',
116 # Make signals_generated.h using signals.py
117 bld(rule = sys.executable + ' ${SRC} ${TGT}', source = 'pbd/signals.py', target = 'pbd/signals_generated.h')
120 if bld.is_defined ('INTERNAL_SHARED_LIBS'):
121 obj = bld.shlib(features = 'cxx cxxshlib', source=libpbd_sources)
122 obj.defines = [ 'LIBPBD_DLL_EXPORTS=1' ]
124 obj = bld.stlib(features = 'cxx cxxstlib', source=libpbd_sources)
125 obj.cxxflags = [ '-fPIC' ]
126 obj.cflags = [ '-fPIC' ]
129 if bld.is_defined('DEBUG_RT_ALLOC'):
130 obj.source += 'debug_rt_alloc.c'
132 obj.export_includes = ['.']
136 obj.uselib = 'GLIBMM SIGCPP XML UUID SNDFILE GIOMM'
137 if sys.platform == 'darwin':
138 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
139 if 'cocoa_open_uri.mm' not in obj.source:
140 obj.source += [ 'cocoa_open_uri.mm' ]
142 obj.vnum = LIBPBD_LIB_VERSION
143 obj.install_path = bld.env['LIBDIR']
144 obj.defines += [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
146 if bld.env['build_target'] == 'x86_64':
147 obj.defines += [ 'USE_X86_64_ASM' ]
148 if bld.env['build_target'] == 'mingw':
149 obj.defines += [ 'NO_POSIX_MEMALIGN' ]
150 obj.source += [ 'windows_special_dirs.cc' ]
151 obj.source += [ 'windows_timer_utils.cc' ]
152 obj.source += [ 'windows_mmcss.cc' ]
155 if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
157 testobj = bld(features = 'cxx cxxprogram')
162 test/scalar_properties.cc
165 test/filesystem_test.cc
166 test/reallocpool_test.cc
170 if bld.env['build_target'] == 'mingw':
171 testobj.source += [ 'test/windows_timer_utils_test.cc' ]
172 testobj.target = 'run-tests'
173 testobj.includes = obj.includes + ['test', '../pbd']
174 testobj.uselib = 'CPPUNIT XML SNDFILE'
175 testobj.use = 'libpbd'
176 testobj.name = 'libpbd-tests'
177 testobj.defines = [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
178 if sys.platform != 'darwin' and bld.env['build_target'] != 'mingw':
179 testobj.linkflags = ['-lrt']