Missing warning ignore with older GCCs.
[libdcp.git] / wscript
diff --git a/wscript b/wscript
index 83344d072c5a9d4eca7dac2bd7a600baf31c20e5..acb2a93eb31e78a39dc31fb27ad4d25088a7e4f0 100644 (file)
--- a/wscript
+++ b/wscript
@@ -1,5 +1,5 @@
 #
-#    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+#    Copyright (C) 2012-2022 Carl Hetherington <cth@carlh.net>
 #
 #    This file is part of libdcp.
 #
@@ -52,12 +52,13 @@ API_VERSION = '-1.0'
 
 def options(opt):
     opt.load('compiler_cxx')
-    opt.add_option('--target-windows', action='store_true', default=False, help='set up to do a cross-compile to Windows')
+    opt.add_option('--target-windows-64', action='store_true', default=False, help='set up to do a cross-compile to Windows 64-bit')
+    opt.add_option('--target-windows-32', action='store_true', default=False, help='set up to do a cross-compile to Windows 32-bit')
     opt.add_option('--enable-debug', action='store_true', default=False, help='build with debugging information and without optimisation')
     opt.add_option('--static', action='store_true', default=False, help='build libdcp statically, and link statically to openjpeg, cxml, asdcplib-carl')
     opt.add_option('--disable-tests', action='store_true', default=False, help='disable building of tests')
     opt.add_option('--disable-benchmarks', action='store_true', default=False, help='disable building of benchmarks')
-    opt.add_option('--disable-gcov', action='store_true', default=False, help='don''t use gcov in tests')
+    opt.add_option('--enable-gcov', action='store_true', default=False, help='use gcov in tests')
     opt.add_option('--disable-examples', action='store_true', default=False, help='disable building of examples')
     opt.add_option('--enable-openmp', action='store_true', default=False, help='enable use of OpenMP')
     opt.add_option('--openmp', default='gomp', help='specify OpenMP Library to use: omp, gomp (default), iomp')
@@ -72,7 +73,8 @@ def configure(conf):
         conf.env.append_value('CXXFLAGS', ['-Wno-maybe-uninitialized'])
     conf.env.append_value('CXXFLAGS', ['-DLIBDCP_VERSION="%s"' % VERSION])
 
-    conf.env.TARGET_WINDOWS = conf.options.target_windows
+    conf.env.TARGET_WINDOWS_64 = conf.options.target_windows_64
+    conf.env.TARGET_WINDOWS_32 = conf.options.target_windows_32
     conf.env.TARGET_OSX = sys.platform == 'darwin'
     conf.env.TARGET_LINUX = not conf.env.TARGET_WINDOWS and not conf.env.TARGET_OSX
     conf.env.ENABLE_DEBUG = conf.options.enable_debug
@@ -82,7 +84,7 @@ def configure(conf):
     conf.env.STATIC = conf.options.static
     conf.env.API_VERSION = API_VERSION
 
-    if conf.env.TARGET_WINDOWS:
+    if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32:
         conf.env.append_value('CXXFLAGS', '-DLIBDCP_WINDOWS')
     if conf.env.TARGET_OSX:
         conf.env.append_value('CXXFLAGS', '-DLIBDCP_OSX')
@@ -91,6 +93,9 @@ def configure(conf):
 
     if conf.env.TARGET_OSX:
         conf.env.append_value('CXXFLAGS', ['-Wno-unused-result', '-Wno-unused-parameter', '-Wno-unused-local-typedef'])
+        conf.env.append_value('LINKFLAGS', '-headerpad_max_install_names')
+    elif int(gcc[0]) > 4:
+        conf.env.append_value('CXXFLAGS', ['-Wsuggest-override'])
 
     # Disable libxml++ deprecation warnings for now
     conf.env.append_value('CXXFLAGS', ['-Wno-deprecated-declarations'])
@@ -101,7 +106,7 @@ def configure(conf):
         conf.env.append_value('LDFLAGS', ['-l%s' % conf.options.openmp])
         conf.check_cxx(cxxflags='-fopenmp', msg='Checking that compiler supports -fopenmp')
 
-    if not conf.env.TARGET_WINDOWS:
+    if not conf.env.TARGET_WINDOWS_64 and not conf.env.TARGET_WINDOWS_32:
         conf.env.append_value('LINKFLAGS', '-pthread')
 
     if conf.env.TARGET_LINUX:
@@ -121,13 +126,14 @@ def configure(conf):
     conf.env.DEFINES_XMLSEC1 = [f.replace('\\', '') for f in conf.env.DEFINES_XMLSEC1]
 
     # 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, msg='Checking for ImageMagick/GraphicsMagick')
-    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')
+    if not conf.options.disable_examples:
+        if distutils.spawn.find_executable('Magick++-config'):
+            conf.check_cfg(package='', path='Magick++-config', args='--cppflags --cxxflags --libs', uselib_store='MAGICK', mandatory=True, msg='Checking for ImageMagick/GraphicsMagick')
+        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')
 
     conf.check_cfg(package='sndfile', args='--cflags --libs', uselib_store='SNDFILE', mandatory=False)
 
@@ -155,13 +161,15 @@ def configure(conf):
         conf.check_cfg(package='libcxml', atleast_version='0.17.0', args='--cflags --libs', uselib_store='CXML', mandatory=True)
         conf.check_cfg(package='xerces-c', args='--cflags --libs', uselib_store='XERCES', mandatory=True)
 
-    if conf.options.target_windows:
+    if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32:
         # XXX: it feels like there should be a more elegant way to get these included
         conf.env.LIB_XERCES.append('curl')
         conf.env.LIB_XERCES.append('ws2_32')
 
-    if conf.options.target_windows:
-        boost_lib_suffix = '-mt'
+    if conf.options.target_windows_64:
+        boost_lib_suffix = '-mt-x64'
+    elif conf.options.target_windows_32:
+        boost_lib_suffix = '-mt-x32'
     else:
         boost_lib_suffix = ''
 
@@ -215,15 +223,17 @@ def configure(conf):
 
     if not conf.env.DISABLE_TESTS:
         conf.recurse('test')
-        if not conf.options.disable_gcov:
+        if conf.options.enable_gcov:
             conf.check(lib='gcov', define_name='HAVE_GCOV', mandatory=False)
             conf.env.append_value('LINKFLAGS', '-fprofile-arcs')
 
 def build(bld):
     create_version_cc(bld, VERSION)
 
-    if bld.env.TARGET_WINDOWS:
-        boost_lib_suffix = '-mt'
+    if bld.env.TARGET_WINDOWS_64:
+        boost_lib_suffix = '-mt-x64'
+    elif bld.env.TARGET_WINDOWS_32:
+        boost_lib_suffix = '-mt-x32'
     else:
         boost_lib_suffix = ''
 
@@ -249,9 +259,11 @@ def build(bld):
     for i in os.listdir('xsd'):
         bld.install_files('${PREFIX}/share/libdcp/xsd', os.path.join('xsd', i))
 
-    for i in ['language', 'region', 'script', 'variant', 'extlang']:
+    for i in ['language', 'region', 'script', 'variant', 'extlang', 'dcnc']:
         bld.install_files('${PREFIX}/share/libdcp/tags', os.path.join('tags', i))
 
+    bld.install_files('${PREFIX}/share/libdcp', 'ratings')
+
     bld.add_post_fun(post)
 
 def dist(ctx):