8 opt.load('compiler_cxx')
9 opt.add_option('--target-windows', action='store_true', default = False, help = 'set up to do a cross-compile to Windows')
10 opt.add_option('--enable-debug', action='store_true', default = False, help = 'build with debugging information and without optimisation')
13 conf.load('compiler_cxx')
14 conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-Wno-unused-result', '-O2', '-D_FILE_OFFSET_BITS=64'])
15 conf.env.append_value('CXXFLAGS', ['-DLIBDCP_VERSION="%s"' % VERSION])
17 if conf.options.target_windows:
18 conf.env.append_value('CXXFLAGS', '-DLIBDCP_WINDOWS')
20 conf.env.append_value('CXXFLAGS', '-DLIBDCP_POSIX')
22 conf.check_cfg(package = 'openssl', args = '--cflags --libs', uselib_store = 'OPENSSL', mandatory = True)
23 conf.check_cfg(package = 'sigc++-2.0', args = '--cflags --libs', uselib_store = 'SIGC++', mandatory = True)
24 conf.check_cfg(package = 'libxml++-2.6', args = '--cflags --libs', uselib_store = 'LIBXML++', mandatory = True)
26 if conf.options.target_windows:
27 boost_lib_suffix = '-mt'
31 if conf.options.enable_debug:
32 conf.env.append_value('CXXFLAGS', '-g')
34 conf.env.append_value('CXXFLAGS', '-O3')
36 conf.check_cxx(fragment = """
37 #include <boost/filesystem.hpp>\n
38 int main() { boost::filesystem::copy_file ("a", "b"); }\n
40 msg = 'Checking for boost filesystem library',
41 libpath = '/usr/local/lib',
42 lib = ['boost_filesystem%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
43 uselib_store = 'BOOST_FILESYSTEM')
46 conf.recurse('asdcplib')
49 create_version_cc(VERSION)
51 bld(source = 'libdcp.pc.in',
53 includedir = '%s/include' % bld.env.PREFIX,
54 libs = "-L${libdir} -ldcp -lkumu-libdcp -lasdcp-libdcp",
55 install_path = '${LIBDIR}/pkgconfig')
60 bld.recurse('asdcplib')
63 ctx.excl = 'TODO core *~ .git build .waf* .lock* doc/*~ src/*~ test/ref/*~'
65 def create_version_cc(version):
66 if os.path.exists('.git'):
67 cmd = "LANG= git log --abbrev HEAD^..HEAD ."
68 output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
69 o = output[0].decode('utf-8')
70 commit = o.replace ("commit ", "")[0:10]
75 text = '#include "version.h"\n'
76 text += 'char const * libdcp::git_commit = \"%s\";\n' % commit
77 text += 'char const * libdcp::version = \"%s\";\n' % version
78 print('Writing version information to src/version.cc')
79 o = open('src/version.cc', 'w')
83 print('Could not open src/version.cc for writing\n')