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'
19 LIBPBD_MAJOR_VERSION = '4'
21 # Variables for 'waf dist'
23 VERSION = LIBPBD_VERSION
24 I18N_PACKAGE = 'libpbd4'
30 path_prefix = 'libs/pbd/'
38 'configuration_variable.cc',
74 'stateful_diff_command.cc',
92 opt.load('compiler_cxx')
93 autowaf.set_options(opt)
94 opt.add_option('--ppc', action='store_true', default=False, dest='ppc',
95 help='Compile with -arch ppc (OS X ONLY)')
96 opt.add_option('--dist-target', type='string', default='auto', dest='dist_target',
97 help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,tiger,leopard,mingw,msvc]')
98 opt.add_option('--internal-shared-libs', action='store_true', default=True, dest='internal_shared_libs',
99 help='Build internal libs as shared libraries')
102 conf.load('compiler_cxx')
103 autowaf.configure(conf)
104 autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
105 autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
106 autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL', atleast_version='7.0.0', mandatory=True)
107 autowaf.check_pkg(conf, 'libarchive', uselib_store='ARCHIVE', atleast_version='3.0.0', mandatory=True)
108 autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.32.0', mandatory=True)
109 autowaf.check_pkg(conf, 'giomm-2.4', uselib_store='GIOMM', atleast_version='2.2', mandatory=True)
111 conf.check(function_name='getmntent', header_name='mntent.h', define_name='HAVE_GETMNTENT',mandatory=False)
112 conf.check(header_name='execinfo.h', define_name='HAVE_EXECINFO',mandatory=False)
113 conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
114 if not Options.options.ppc:
115 conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', cflags='-D_XOPEN_SOURCE=600', define_name='HAVE_POSIX_MEMALIGN', mandatory=False)
116 conf.check(function_name='localtime_r', header_name='time.h', define_name='HAVE_LOCALTIME_R',mandatory=False)
119 autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
120 autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
121 if Options.options.dist_target == 'mingw':
122 conf.check(compiler='cxx',
127 if Options.options.internal_shared_libs:
128 conf.define('INTERNAL_SHARED_LIBS', 1)
130 conf.write_config_header('libpbd-config.h', remove=False)
133 if not autowaf.is_child(): # Building standalone, install dev stuff
135 includedir = '${INCLUDEDIR}/pbd-%s/pbd' % LIBPBD_MAJOR_VERSION
136 bld.install_files(includedir, bld.path.ant_glob('pbd/*.h'))
137 bld.install_files(includedir, 'build/pbd/signals_generated.h')
140 autowaf.build_pc(bld, 'libpbd', LIBPBD_VERSION, LIBPBD_MAJOR_VERSION, [],
141 {'LIBPBD_VERSION' : LIBPBD_VERSION,
142 'LIBPBD_MAJOR_VERSION' : LIBPBD_MAJOR_VERSION})
144 # Make signals_generated.h using signals.py
145 bld(rule = sys.executable + ' ${SRC} ${TGT}', source = 'pbd/signals.py', target = 'pbd/signals_generated.h')
148 if bld.is_defined ('INTERNAL_SHARED_LIBS'):
149 obj = bld.shlib(features = 'cxx cxxshlib', source=libpbd_sources)
150 obj.defines = [ 'LIBPBD_DLL_EXPORTS=1' ]
152 obj = bld.stlib(features = 'cxx cxxstlib', source=libpbd_sources)
153 obj.cxxflags = [ '-fPIC' ]
154 obj.cflags = [ '-fPIC' ]
157 if bld.is_defined('DEBUG_RT_ALLOC'):
158 obj.source += 'debug_rt_alloc.c'
160 obj.export_includes = ['.']
164 obj.uselib = 'GLIBMM SIGCPP XML UUID SNDFILE GIOMM ARCHIVE CURL'
165 if sys.platform == 'darwin':
166 TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
167 if 'cocoa_open_uri.mm' not in obj.source:
168 obj.source += [ 'cocoa_open_uri.mm' ]
170 obj.vnum = LIBPBD_LIB_VERSION
171 obj.install_path = bld.env['LIBDIR']
172 obj.defines += [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
174 if sys.platform.startswith('netbsd'):
175 obj.linkflags = '-lexecinfo'
177 if bld.env['build_target'] == 'x86_64':
178 obj.defines += [ 'USE_X86_64_ASM' ]
179 if bld.env['build_target'] == 'mingw':
180 obj.defines += [ 'NO_POSIX_MEMALIGN' ]
181 obj.source += [ 'windows_special_dirs.cc' ]
182 obj.source += [ 'windows_timer_utils.cc' ]
183 obj.source += [ 'windows_mmcss.cc' ]
186 if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
188 testobj = bld(features = 'cxx cxxprogram')
193 test/scalar_properties.cc
195 test/string_convert_test.cc
197 test/filesystem_test.cc
199 test/reallocpool_test.cc
203 if bld.env['build_target'] == 'mingw':
204 testobj.source += [ 'test/windows_timer_utils_test.cc' ]
205 testobj.target = 'run-tests'
206 testobj.includes = obj.includes + ['test', '../pbd']
207 testobj.uselib = 'CPPUNIT XML SNDFILE'
208 testobj.use = 'libpbd'
209 testobj.name = 'libpbd-tests'
210 testobj.defines = [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
211 if sys.platform != 'darwin' and bld.env['build_target'] != 'mingw':
212 testobj.linkflags = ['-lrt']