Use a .tiff file as input rather than an artificial image.
[j2kbench.git] / wscript
1 import subprocess
2 import os
3 import sys
4 import distutils.spawn
5 from waflib import Logs, Context
6
7 APPNAME = 'j2kbench'
8
9 def options(opt):
10     opt.load('compiler_cxx')
11     opt.add_option('--enable-debug', action='store_true', default=False, help='build with debugging information and without optimisation')
12
13 def configure(conf):
14     conf.load('compiler_cxx')
15     conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-D_FILE_OFFSET_BITS=64', '-D__STDC_FORMAT_MACROS'])
16
17     conf.env.ENABLE_DEBUG = conf.options.enable_debug
18
19     conf.check_cfg(package='libdcp-1.0', args='--cflags --libs', uselib_store='LIBDCP', mandatory=True)
20
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)
24     else:
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')
29
30     # Remove erroneous escaping of quotes from xmlsec1 defines
31     conf.env.DEFINES_LIBDCP = [f.replace('\\', '') for f in conf.env.DEFINES_LIBDCP]
32
33     conf.check_cxx(fragment="""
34                             #include <boost/filesystem.hpp>\n
35                             int main() { boost::filesystem::copy_file ("a", "b"); }\n
36                             """,
37                    msg='Checking for boost filesystem library',
38                    libpath='/usr/local/lib',
39                    lib=['boost_filesystem', 'boost_system'],
40                    uselib_store='BOOST_FILESYSTEM')
41
42     conf.check_cxx(fragment="""
43                             #include <boost/thread.hpp>\n
44                             int main() { boost::thread t (); }\n
45                             """,
46                    msg='Checking for boost threading library',
47                    libpath='/usr/local/lib',
48                    lib=['boost_thread', 'boost_system'],
49                    uselib_store='BOOST_THREAD')
50
51     if conf.options.enable_debug:
52         conf.env.append_value('CXXFLAGS', '-g')
53
54 def build(bld):
55     obj = bld(features='cxx cxxprogram')
56     obj.name = 'j2kbench'
57     obj.target = 'j2kbench'
58     obj.use = 'LIBDCP MAGICK BOOST_FILESYSTEM BOOST_THREAD'
59     obj.source = 'j2kbench.cc'