5 from waflib import Logs
7 APPNAME = 'libasdcp-cth'
11 opt.load('compiler_cxx')
12 opt.add_option('--target-windows', action='store_true', default=False, help='set up to do a cross-compile to Windows')
13 opt.add_option('--enable-debug', action='store_true', default=False, help='build with debugging information and without optimisation')
14 opt.add_option('--static', action='store_true', default=False, help='build statically')
17 conf.load('compiler_cxx')
18 conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-D_FILE_OFFSET_BITS=64', '-D__STDC_FORMAT_MACROS'])
20 conf.env.TARGET_WINDOWS = conf.options.target_windows
21 conf.env.TARGET_OSX = sys.platform == 'darwin'
22 conf.env.TARGET_LINUX = not conf.env.TARGET_WINDOWS and not conf.env.TARGET_OSX
23 conf.env.STATIC = conf.options.static
24 conf.env.VERSION = VERSION
26 if conf.env.TARGET_OSX:
27 conf.env.append_value('CXXFLAGS', ['-Wno-unused-result', '-Wno-unused-parameter', '-Wno-unused-local-typedef'])
29 if conf.env.TARGET_LINUX:
30 conf.env.append_value('CXXFLAGS', ['-Wno-unused-result'])
32 conf.check_cfg(package='openssl', args='--cflags --libs', uselib_store='OPENSSL', mandatory=True)
34 if conf.options.target_windows:
35 boost_lib_suffix = '-mt'
39 if conf.options.enable_debug:
40 conf.env.append_value('CXXFLAGS', '-g')
42 conf.env.append_value('CXXFLAGS', '-O2')
44 conf.check_cxx(fragment="""
45 #include <boost/version.hpp>\n
46 #if BOOST_VERSION < 104500\n
47 #error boost too old\n
49 int main(void) { return 0; }\n
52 msg='Checking for boost library >= 1.45',
54 errmsg='too old\nPlease install boost version 1.45 or higher.')
56 conf.check_cxx(fragment="""
57 #include <boost/filesystem.hpp>\n
58 int main() { boost::filesystem::copy_file ("a", "b"); }\n
60 msg='Checking for boost filesystem library',
61 libpath='/usr/local/lib',
62 lib=['boost_filesystem%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
63 uselib_store='BOOST_FILESYSTEM')
68 if bld.env.TARGET_WINDOWS:
69 boost_lib_suffix = '-mt'
75 bld(source='libasdcp-cth.pc.in',
77 includedir='%s/include/libasdcp-cth' % bld.env.PREFIX,
78 libs="-L${libdir} -lasdcp-cth -lkumu-cth -lboost_system%s" % boost_lib_suffix,
80 install_path='${LIBDIR}/pkgconfig')
84 bld.add_post_fun(post)
87 if ctx.cmd == 'install':
88 ctx.exec_command('/sbin/ldconfig')
91 os.system('etags src/*.cc src/*.h')