import subprocess import os import sys import distutils.spawn from waflib import Logs, Context APPNAME = 'j2kbench' def options(opt): opt.load('compiler_cxx') opt.add_option('--enable-debug', action='store_true', default=False, help='build with debugging information and without optimisation') def configure(conf): conf.load('compiler_cxx') conf.env.append_value('CXXFLAGS', ['-Wall', '-Wextra', '-D_FILE_OFFSET_BITS=64', '-D__STDC_FORMAT_MACROS']) conf.env.ENABLE_DEBUG = conf.options.enable_debug conf.check_cfg(package='libdcp-1.0', args='--cflags --libs', uselib_store='LIBDCP', mandatory=True) # ImageMagick / GraphicsMagick if distutils.spawn.find_executable('Magick++-config'): conf.check_cfg(package='', path='Magick++-config', args='--cppflags --cxxflags --libs', uselib_store='MAGICK', mandatory=True) else: image = conf.check_cfg(package='ImageMagick++', args='--cflags --libs', uselib_store='MAGICK', mandatory=False) graphics = conf.check_cfg(package='GraphicsMagick++', args='--cflags --libs', uselib_store='MAGICK', mandatory=False) if image is None and graphics is None: Logs.error('Neither ImageMagick++ nor GraphicsMagick++ found: one or the other is required') # Remove erroneous escaping of quotes from xmlsec1 defines conf.env.DEFINES_LIBDCP = [f.replace('\\', '') for f in conf.env.DEFINES_LIBDCP] conf.check_cxx(fragment=""" #include \n int main() { boost::filesystem::copy_file ("a", "b"); }\n """, msg='Checking for boost filesystem library', libpath='/usr/local/lib', lib=['boost_filesystem', 'boost_system'], uselib_store='BOOST_FILESYSTEM') conf.check_cxx(fragment=""" #include \n int main() { boost::thread t (); }\n """, msg='Checking for boost threading library', libpath='/usr/local/lib', lib=['boost_thread', 'boost_system'], uselib_store='BOOST_THREAD') if conf.options.enable_debug: conf.env.append_value('CXXFLAGS', '-g') def build(bld): obj = bld(features='cxx cxxprogram') obj.name = 'j2kbench' obj.target = 'j2kbench' obj.use = 'LIBDCP MAGICK BOOST_FILESYSTEM BOOST_THREAD' obj.source = 'j2kbench.cc'