fixup! FIXME: test new asdcplib via libdcp
[dcpomatic.git] / wscript
diff --git a/wscript b/wscript
index ed7f9cc328ba82ec4b4f8ba1026fc92182a1b28c..fb2598dc9ae2acc9ab2baace71f6a1dcd216f402 100644 (file)
--- a/wscript
+++ b/wscript
@@ -81,6 +81,7 @@ def options(opt):
     opt.add_option('--wx-config',         help='path to wx-config')
     opt.add_option('--enable-asan',       action='store_true', help='build with asan')
     opt.add_option('--disable-more-warnings', action='store_true', default=False, help='disable some warnings raised by Xcode 15 with the 2.16 branch')
+    opt.add_option('--c++17', action='store_true', default=False, help='build with C++17 and libxml++-4.0')
 
 def configure(conf):
     conf.load('compiler_cxx')
@@ -88,6 +89,17 @@ def configure(conf):
     if conf.options.target_windows_64 or conf.options.target_windows_32:
         conf.load('winres')
 
+    if vars(conf.options)['c++17']:
+        cpp_std = '17'
+        conf.env.XMLPP_API = '4.0'
+        conf.env.PANGOMM_API = '2.48'
+        conf.env.CAIROMM_API = '1.16'
+    else:
+        cpp_std = '11'
+        conf.env.XMLPP_API = '2.6'
+        conf.env.PANGOMM_API = '1.4'
+        conf.env.CAIROMM_API = '1.0'
+
     # Save conf.options that we need elsewhere in conf.env
     conf.env.DISABLE_GUI = conf.options.disable_gui
     conf.env.DISABLE_TESTS = conf.options.disable_tests
@@ -119,7 +131,7 @@ def configure(conf):
                                        # I tried and failed to ignore these with _Pragma
                                        '-Wno-ignored-qualifiers',
                                        '-D_FILE_OFFSET_BITS=64',
-                                       '-std=c++11'])
+                                       '-std=c++' + cpp_std])
 
     if conf.options.disable_more_warnings:
         # These are for Xcode 15.0.1 with the v2.16.x-era
@@ -290,6 +302,15 @@ def configure(conf):
                    uselib="ZIP",
                    define_name='DCPOMATIC_HAVE_ZIP_FILE_ADD'
                    )
+    conf.check_cxx(fragment="""
+                            #include <zip.h>
+                            int main() { int error; zip_open("foo", ZIP_RDONLY, &error); }
+                            """,
+                   mandatory=False,
+                   msg="Checking for ZIP_RDONLY",
+                   uselib="ZIP",
+                   define_name='DCPOMATIC_HAVE_ZIP_RDONLY'
+                   )
 
     # libbz2; must be explicitly linked on macOS for some reason
     conf.check_cxx(fragment="""
@@ -319,10 +340,10 @@ def configure(conf):
     conf.check_cfg(package='fontconfig', args='--cflags --libs', uselib_store='FONTCONFIG', mandatory=True)
 
     # pangomm
-    conf.check_cfg(package='pangomm-1.4', args='--cflags --libs', uselib_store='PANGOMM', mandatory=True)
+    conf.check_cfg(package='pangomm-' + conf.env.PANGOMM_API, args='--cflags --libs', uselib_store='PANGOMM', mandatory=True)
 
     # cairomm
-    conf.check_cfg(package='cairomm-1.0', args='--cflags --libs', uselib_store='CAIROMM', mandatory=True)
+    conf.check_cfg(package='cairomm-' + conf.env.CAIROMM_API, args='--cflags --libs', uselib_store='CAIROMM', mandatory=True)
 
     # leqm_nrt
     conf.check_cfg(package='leqm_nrt', args='--cflags --libs', uselib_store='LEQM_NRT', mandatory=True)
@@ -356,7 +377,7 @@ def configure(conf):
     if conf.options.static_dcp:
         conf.check_cfg(package='libdcp-1.0', args='libdcp-1.0 >= %s --cflags' % libdcp_version, uselib_store='DCP', mandatory=True)
         conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
-        conf.env.STLIB_DCP = ['dcp-1.0', 'asdcp-carl', 'kumu-carl', 'openjp2']
+        conf.env.STLIB_DCP = ['dcp-1.0', 'asdcp-dcpomatic', 'kumu-dcpomatic', 'openjp2']
         conf.env.LIB_DCP = ['glibmm-2.4', 'ssl', 'crypto', 'bz2', 'xslt', 'xerces-c']
     else:
         conf.check_cfg(package='libdcp-1.0', args='libdcp-1.0 >= %s --cflags --libs' % libdcp_version, uselib_store='DCP', mandatory=True)
@@ -373,10 +394,10 @@ def configure(conf):
 
     # libxml++
     if conf.options.static_xmlpp:
-        conf.env.STLIB_XMLPP = ['xml++-2.6']
+        conf.env.STLIB_XMLPP = ['xml++-' + conf.env.XMLPP_API]
         conf.env.LIB_XMLPP = ['xml2']
     else:
-        conf.check_cfg(package='libxml++-2.6', args='--cflags --libs', uselib_store='XMLPP', mandatory=True)
+        conf.check_cfg(package='libxml++-' + conf.env.XMLPP_API, args='--cflags --libs', uselib_store='XMLPP', mandatory=True)
 
     # libxmlsec
     if conf.options.static_xmlsec: