summaryrefslogtreecommitdiff
path: root/wscript
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-04-06 22:34:10 +0200
committerCarl Hetherington <cth@carlh.net>2024-04-07 19:06:24 +0200
commitd8504c2d684128af07589ebe99f69321daeef37a (patch)
tree46088f0722aba99e81f49f1cbca02d01bdb94c30 /wscript
parent0eff1f460e187c5d0e3f3829a266d8dc9ee000db (diff)
Re-add option to build with openjpeg 1.5.x.
Diffstat (limited to 'wscript')
-rw-r--r--wscript33
1 files changed, 27 insertions, 6 deletions
diff --git a/wscript b/wscript
index ba74aa0f..b1f867a9 100644
--- a/wscript
+++ b/wscript
@@ -66,6 +66,7 @@ def options(opt):
opt.add_option('--disable-examples', action='store_true', default=False, help='disable building of examples')
opt.add_option('--disable-dumpimage', action='store_true', default=False, help='disable building of dcpdumpimage')
opt.add_option('--enable-openmp', action='store_true', default=False, help='enable use of OpenMP')
+ opt.add_option('--jpeg', default='oj2', help='specify JPEG library to build with: oj1 or oj2 for OpenJPEG 1.5.x or OpenJPEG 2.x.y respectively')
opt.add_option('--openmp', default='gomp', help='specify OpenMP Library to use: omp, gomp (default), iomp')
def configure(conf):
@@ -88,6 +89,7 @@ def configure(conf):
conf.env.DISABLE_DUMPIMAGE = conf.options.disable_dumpimage
conf.env.STATIC = conf.options.static
conf.env.API_VERSION = API_VERSION
+ conf.env.JPEG = conf.options.jpeg
if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32:
conf.env.append_value('CXXFLAGS', '-DLIBDCP_WINDOWS')
@@ -114,6 +116,13 @@ def configure(conf):
if not conf.env.TARGET_WINDOWS_64 and not conf.env.TARGET_WINDOWS_32:
conf.env.append_value('LINKFLAGS', '-pthread')
+ if conf.options.jpeg == 'oj1':
+ conf.env.append_value('CXXFLAGS', ['-DLIBDCP_OPENJPEG1'])
+ elif conf.options.jpeg == 'oj2':
+ conf.env.append_value('CXXFLAGS', ['-DLIBDCP_OPENJPEG2'])
+ else:
+ Logs.error('Invalid --jpeg value %s' % conf.options.jpeg)
+
if conf.env.TARGET_LINUX:
conf.check(lib='dl', uselib_store='DL', msg='Checking for library dl')
@@ -137,10 +146,16 @@ def configure(conf):
conf.check_cfg(package='sndfile', args='--cflags --libs', uselib_store='SNDFILE', mandatory=False)
# Find openjpeg so that we can test to see if it's the right version
- if conf.options.static:
- conf.check_cfg(package='libopenjp2', args='--cflags', uselib_store='OPENJPEG', mandatory=True, msg='Checking for any version of libopenjp2')
+ if conf.options.jpeg == 'oj2':
+ if conf.options.static:
+ conf.check_cfg(package='libopenjp2', args='--cflags', uselib_store='OPENJPEG', mandatory=True, msg='Checking for any version of libopenjp2')
+ else:
+ conf.check_cfg(package='libopenjp2', args='--cflags --libs', uselib_store='OPENJPEG', mandatory=True, msg='Checking for any version of libopenjp2')
else:
- conf.check_cfg(package='libopenjp2', args='--cflags --libs', uselib_store='OPENJPEG', mandatory=True, msg='Checking for any version of libopenjp2')
+ if conf.options.static:
+ conf.check_cfg(package='libopenjpeg1', args='--cflags', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True)
+ else:
+ conf.check_cfg(package='libopenjpeg1', args='--cflags --libs', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True)
patched_openjpeg = conf.check_cxx(fragment="""
#include <openjpeg.h>
@@ -151,12 +166,17 @@ def configure(conf):
mandatory=False,
define_name='LIBDCP_HAVE_NUMGBITS')
- if not patched_openjpeg:
+ if not patched_openjpeg and conf.options.jpeg == 'oj2':
# We don't have our patched version so we need 2.5.0 to get the GUARD_BITS option
conf.check_cfg(package='libopenjp2', args='libopenjp2 >= 2.5.0', uselib_store='OPENJPEG', mandatory=True, msg='Checking for libopenjp2 >= 2.5.0')
+ conf.env.append_value('CXXFLAGS', '-DLIBDCP_HAVE_GUARD_BITS')
if conf.options.static:
- conf.env.STLIB_OPENJPEG = ['openjp2']
+ if conf.options.jpeg == 'oj2':
+ conf.env.STLIB_OPENJPEG = ['openjp2']
+ else:
+ conf.env.STLIB_OPENJPEG = ['openjpeg']
+
conf.check_cfg(package='libasdcp-carl', args='libasdcp-carl >= 0.1.3 --cflags', uselib_store='ASDCPLIB_CTH', mandatory=True)
conf.env.HAVE_ASDCPLIB_CTH = 1
conf.env.STLIB_ASDCPLIB_CTH = ['asdcp-carl', 'kumu-carl']
@@ -263,7 +283,8 @@ def build(bld):
version=VERSION,
includedir='%s/include/libdcp%s' % (bld.env.PREFIX, bld.env.API_VERSION),
libs=libs,
- install_path='${LIBDIR}/pkgconfig')
+ install_path='${LIBDIR}/pkgconfig',
+ openjpeg='libopenjp2' if bld.env.JPEG == 'oj1' else 'libopenjpeg1')
bld.recurse('src')
bld.recurse('tools')