Try comparing images using RMS error metric.
[dcpomatic.git] / wscript
diff --git a/wscript b/wscript
index 2cda1596fc9984ae7e12fea09ed74443f26854f9..a5273e9970fbf7a8a8aa511342242f3b940f6d47 100644 (file)
--- a/wscript
+++ b/wscript
@@ -27,7 +27,7 @@ import distutils.spawn
 from waflib import Logs, Context
 
 APPNAME = 'dcpomatic'
-VERSION = '2.9.32devel'
+VERSION = '2.11.31devel'
 
 def options(opt):
     opt.load('compiler_cxx')
@@ -50,6 +50,7 @@ def options(opt):
     opt.add_option('--static-sub',        action='store_true', default=False, help='link statically to libsub')
     opt.add_option('--static-curl',       action='store_true', default=False, help='link statically to libcurl')
     opt.add_option('--workaround-gssapi', action='store_true', default=False, help='link to gssapi_krb5')
+    opt.add_option('--force-cpp11',       action='store_true', default=False, help='force use of C++11')
 
 def configure(conf):
     conf.load('compiler_cxx')
@@ -83,9 +84,13 @@ def configure(conf):
                                        '-Wno-deprecated-declarations',
                                        '-D_FILE_OFFSET_BITS=64'])
 
+    if conf.options.force_cpp11:
+        conf.env.append_value('CXXFLAGS', ['-std=c++11', '-DBOOST_NO_CXX11_SCOPED_ENUMS'])
+
     gcc = conf.env['CC_VERSION']
     if int(gcc[0]) >= 4 and int(gcc[1]) > 1:
         conf.env.append_value('CXXFLAGS', ['-Wno-unused-result'])
+    have_c11 = int(gcc[0]) >= 4 and int(gcc[1]) >= 8 and int(gcc[2]) >= 1
 
     if conf.options.enable_debug:
         conf.env.append_value('CXXFLAGS', ['-g', '-DDCPOMATIC_DEBUG', '-fno-omit-frame-pointer'])
@@ -104,19 +109,22 @@ def configure(conf):
         conf.env.append_value('CXXFLAGS', '-DUNICODE')
         conf.env.append_value('CXXFLAGS', '-DBOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN')
         conf.env.append_value('CXXFLAGS', '-mfpmath=sse')
+        conf.env.append_value('CXXFLAGS', '-std=c++11')
         wxrc = os.popen('wx-config --rescomp').read().split()[1:]
         conf.env.append_value('WINRCFLAGS', wxrc)
         if conf.options.enable_debug:
             conf.env.append_value('CXXFLAGS', ['-mconsole'])
             conf.env.append_value('LINKFLAGS', ['-mconsole'])
         conf.check(lib='ws2_32', uselib_store='WINSOCK2', msg="Checking for library winsock2")
-        conf.check(lib='bfd', uselib_store='BFD', msg="Checking for library bfd")
         conf.check(lib='dbghelp', uselib_store='DBGHELP', msg="Checking for library dbghelp")
-        conf.check(lib='iberty', uselib_store='IBERTY', msg="Checking for library iberty")
         conf.check(lib='shlwapi', uselib_store='SHLWAPI', msg="Checking for library shlwapi")
         conf.check(lib='mswsock', uselib_store='MSWSOCK', msg="Checking for library mswsock")
+        conf.check(lib='ole32', uselib_store='OLE32', msg="Checking for library ole32")
+        conf.check(lib='dsound', uselib_store='DSOUND', msg="Checking for library dsound")
+        conf.check(lib='winmm', uselib_store='WINMM', msg="Checking for library winmm")
+        conf.check(lib='ksuser', uselib_store='KSUSER', msg="Checking for library ksuser")
         boost_lib_suffix = '-mt'
-        boost_thread = 'boost_thread-mt'
+        boost_thread = 'boost_thread_win32-mt'
         conf.check_cxx(fragment="""
                                #include <boost/locale.hpp>\n
                                int main() { std::locale::global (boost::locale::generator().generate ("")); }\n
@@ -144,7 +152,7 @@ def configure(conf):
 
     # OSX
     if conf.env.TARGET_OSX:
-        conf.env.append_value('CXXFLAGS', ['-DDCPOMATIC_OSX', '-Wno-unused-function', '-Wno-unused-parameter', '-Wno-unused-local-typedef'])
+        conf.env.append_value('CXXFLAGS', ['-DDCPOMATIC_OSX', '-Wno-unused-function', '-Wno-unused-parameter', '-Wno-unused-local-typedef', '-Wno-potentially-evaluated-expression'])
         conf.env.append_value('LINKFLAGS', '-headerpad_max_install_names')
 
     #
@@ -225,6 +233,29 @@ def configure(conf):
                    includes=conf.env['INCLUDES_MAGICK'],
                    define_name='DCPOMATIC_HAVE_MAGICKLIB_NAMESPACE')
 
+    # See where MagickCore.h is
+    conf.check_cxx(fragment="""
+                            #include <magick/MagickCore.h>\n
+                            int main() { return 0; }\n
+                            """,
+                   mandatory=False,
+                   msg='Checking for MagickCore.h location',
+                   okmsg='magick',
+                   errmsg='not magick',
+                   includes=conf.env['INCLUDES_MAGICK'],
+                   define_name='DCPOMATIC_MAGICKCORE_MAGICK')
+
+    conf.check_cxx(fragment="""
+                            #include <MagickCore/MagickCore.h>\n
+                            int main() { return 0; }\n
+                            """,
+                   mandatory=False,
+                   msg='Checking for MagickCore.h location',
+                   okmsg='MagickCore',
+                   errmsg='not MagickCore',
+                   includes=conf.env['INCLUDES_MAGICK'],
+                   define_name='DCPOMATIC_MAGICKCORE_MAGICKCORE')
+
     # libzip
     conf.check_cfg(package='libzip', args='--cflags --libs', uselib_store='ZIP', mandatory=True)
 
@@ -237,19 +268,43 @@ def configure(conf):
     # cairomm
     conf.check_cfg(package='cairomm-1.0', args='--cflags --libs', uselib_store='CAIROMM', mandatory=True)
 
-    # See if we have Cairo::ImageSurface::format_stride_for_width
+    test_cxxflags = ''
+    if have_c11:
+        test_cxxflags = '-std=c++11'
+
+    # See if we have Cairo::ImageSurface::format_stride_for_width; Centos 5 does not
     conf.check_cxx(fragment="""
                             #include <cairomm/cairomm.h>
                             int main(void) {
-                                Cairo::ImageSurface::format_stride_for_width (Cairo::FORMAT_ARGB, 1024);\n
+                                Cairo::ImageSurface::format_stride_for_width (Cairo::FORMAT_ARGB32, 1024);\n
                                 return 0; }\n
                             """,
                        mandatory=False,
+                       cxxflags=test_cxxflags,
                        msg='Checking for format_stride_for_width',
                        okmsg='yes',
                        includes=conf.env['INCLUDES_CAIROMM'],
+                       uselib='CAIROMM',
                        define_name='DCPOMATIC_HAVE_FORMAT_STRIDE_FOR_WIDTH')
 
+    # See if we have Pango::Layout::show_in_cairo_context; Centos 5 does not
+    conf.check_cxx(fragment="""
+                            #include <pangomm.h>
+                            int main(void) {
+                                Cairo::RefPtr<Cairo::Context> context;
+                                Glib::RefPtr<Pango::Layout> layout;
+                                layout->show_in_cairo_context (context);
+                                return 0; }\n
+                            """,
+                       mandatory=False,
+                       msg='Checking for show_in_cairo_context',
+                       cxxflags=test_cxxflags,
+                       okmsg='yes',
+                       includes=conf.env['INCLUDES_PANGOMM'],
+                       uselib='PANGOMM',
+                       define_name='DCPOMATIC_HAVE_SHOW_IN_CAIRO_CONTEXT')
+
+
     # libcxml
     if conf.options.static_cxml:
         conf.check_cfg(package='libcxml', atleast_version='0.15.1', args='--cflags', uselib_store='CXML', mandatory=True)
@@ -277,21 +332,21 @@ def configure(conf):
 
     # libdcp
     if conf.options.static_dcp:
-        conf.check_cfg(package='libdcp-1.0', atleast_version='1.3.4', args='--cflags', uselib_store='DCP', mandatory=True)
+        conf.check_cfg(package='libdcp-1.0', atleast_version='1.4.1', args='--cflags', 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-cth', 'kumu-cth', 'openjp2']
         conf.env.LIB_DCP = ['glibmm-2.4', 'ssl', 'crypto', 'bz2', 'xslt']
     else:
-        conf.check_cfg(package='libdcp-1.0', atleast_version='1.3.4', args='--cflags --libs', uselib_store='DCP', mandatory=True)
+        conf.check_cfg(package='libdcp-1.0', atleast_version='1.4.1', args='--cflags --libs', uselib_store='DCP', mandatory=True)
         conf.env.DEFINES_DCP = [f.replace('\\', '') for f in conf.env.DEFINES_DCP]
 
     # libsub
     if conf.options.static_sub:
-        conf.check_cfg(package='libsub-1.0', atleast_version='1.1.13', args='--cflags', uselib_store='SUB', mandatory=True)
+        conf.check_cfg(package='libsub-1.0', atleast_version='1.2.1', args='--cflags', uselib_store='SUB', mandatory=True)
         conf.env.DEFINES_SUB = [f.replace('\\', '') for f in conf.env.DEFINES_SUB]
         conf.env.STLIB_SUB = ['sub-1.0']
     else:
-        conf.check_cfg(package='libsub-1.0', atleast_version='1.1.13', args='--cflags --libs', uselib_store='SUB', mandatory=True)
+        conf.check_cfg(package='libsub-1.0', atleast_version='1.2.1', args='--cflags --libs', uselib_store='SUB', mandatory=True)
         conf.env.DEFINES_SUB = [f.replace('\\', '') for f in conf.env.DEFINES_SUB]
 
     # libxml++
@@ -315,7 +370,7 @@ def configure(conf):
 
     # FFmpeg
     if conf.options.static_ffmpeg:
-        names = ['avformat', 'avfilter', 'avcodec', 'avutil', 'swscale', 'postproc']
+        names = ['avformat', 'avfilter', 'avcodec', 'avutil', 'swscale', 'postproc', 'swresample']
         for name in names:
             static = subprocess.Popen(shlex.split('pkg-config --static --libs lib%s' % name), stdout=subprocess.PIPE).communicate()[0].decode('utf-8')
             libs = []
@@ -344,6 +399,7 @@ def configure(conf):
         conf.check_cfg(package='libavutil', args='--cflags --libs', uselib_store='AVUTIL', mandatory=True)
         conf.check_cfg(package='libswscale', args='--cflags --libs', uselib_store='SWSCALE', mandatory=True)
         conf.check_cfg(package='libpostproc', args='--cflags --libs', uselib_store='POSTPROC', mandatory=True)
+        conf.check_cfg(package='libswresample', args='--cflags --libs', uselib_store='SWRESAMPLE', mandatory=True)
 
     # Check to see if we have our version of FFmpeg that allows us to get at EBUR128 results
     conf.check_cxx(fragment="""
@@ -540,6 +596,8 @@ def git_revision():
 
     cmd = "LANG= git log --abbrev HEAD^..HEAD ."
     output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
+    if len(output) == 0:
+        return None
     o = output[0].decode('utf-8')
     return o.replace("commit ", "")[0:10]