5 from waflib import Logs, Context
10 opt.load('compiler_cxx')
11 opt.add_option('--enable-debug', action='store_true', default=False, help='build with debugging information and without optimisation')
14 conf.load('compiler_cxx')
15 conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-D_FILE_OFFSET_BITS=64', '-D__STDC_FORMAT_MACROS'])
17 conf.env.ENABLE_DEBUG = conf.options.enable_debug
19 conf.check_cfg(package='libdcp-1.0', args='--cflags --libs', uselib_store='LIBDCP', mandatory=True)
21 # ImageMagick / GraphicsMagick
22 if distutils.spawn.find_executable('Magick++-config'):
23 conf.check_cfg(package='', path='Magick++-config', args='--cppflags --cxxflags --libs', uselib_store='MAGICK', mandatory=True)
25 image = conf.check_cfg(package='ImageMagick++', args='--cflags --libs', uselib_store='MAGICK', mandatory=False)
26 graphics = conf.check_cfg(package='GraphicsMagick++', args='--cflags --libs', uselib_store='MAGICK', mandatory=False)
27 if image is None and graphics is None:
28 Logs.error('Neither ImageMagick++ nor GraphicsMagick++ found: one or the other is required')
30 # Remove erroneous escaping of quotes from xmlsec1 defines
31 conf.env.DEFINES_LIBDCP = [f.replace('\\', '') for f in conf.env.DEFINES_LIBDCP]
33 conf.check_cxx(fragment="""
34 #include <boost/filesystem.hpp>\n
35 int main() { boost::filesystem::copy_file ("a", "b"); }\n
37 msg='Checking for boost filesystem library',
38 libpath='/usr/local/lib',
39 lib=['boost_filesystem', 'boost_system'],
40 uselib_store='BOOST_FILESYSTEM')
42 conf.check_cxx(fragment="""
43 #include <boost/thread.hpp>\n
44 int main() { boost::thread t (); }\n
46 msg='Checking for boost threading library',
47 libpath='/usr/local/lib',
48 lib=['boost_thread', 'boost_system'],
49 uselib_store='BOOST_THREAD')
51 if conf.options.enable_debug:
52 conf.env.append_value('CXXFLAGS', '-g')
55 obj = bld(features='cxx cxxprogram')
57 obj.target = 'j2kbench'
58 obj.use = 'LIBDCP MAGICK BOOST_FILESYSTEM BOOST_THREAD'
59 obj.source = 'j2kbench.cc'