Add -x32/-x64 suffix to boost libraries when building for Windows.
authorCarl Hetherington <cth@carlh.net>
Tue, 22 Feb 2022 22:01:23 +0000 (23:01 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 25 Feb 2022 13:55:24 +0000 (14:55 +0100)
cscript
graphics/wscript
platform/windows/wscript
src/lib/wscript
src/tools/wscript
src/wx/wscript
test/wscript
wscript

diff --git a/cscript b/cscript
index 7bf3ce5ec74715cd554fe4322615a2672aa3f563..7feb7eb036090bdadb0630583580a2ec78285eff 100644 (file)
--- a/cscript
+++ b/cscript
@@ -398,8 +398,8 @@ def dependencies(target, options):
         # Use distro-provided FFmpeg on Arch
         deps = []
 
-    deps.append(('libdcp', 'v1.8.7'))
-    deps.append(('libsub', 'v1.6.7'))
+    deps.append(('libdcp', 'v1.8.8'))
+    deps.append(('libsub', 'v1.6.8'))
     deps.append(('leqm-nrt', '93ae9e6'))
     deps.append(('rtaudio', 'f619b76'))
     # We get our OpenSSL libraries from the environment, but we
@@ -429,7 +429,7 @@ def configure_options(target, options, for_package=False):
     if target.debug:
         opt += ' --enable-debug'
     if target.platform == 'windows':
-        opt += ' --target-windows'
+        opt += f' --target-windows-{target.bits}'
     elif target.platform == 'linux':
         opt += ' --static-dcpomatic --static-wxwidgets --static-ffmpeg --static-dcp --static-sub --static-cxml'
         if target.distro == 'centos':
index 68435ea23cac99e456a7f87da9385f7cc07a6ceb..a5d477644682bb41b9888a6b8b79f15d21d313f3 100644 (file)
@@ -27,7 +27,7 @@ def build(bld):
                 bld.install_files('${PREFIX}/share/icons/hicolor/%dx%d/apps' % (r, r), 'linux/%d/%s.png' % (r, p))
 
     # Install stuff for POSIX systems
-    if not bld.env.TARGET_WINDOWS and not bld.env.DISABLE_GUI:
+    if not bld.env.TARGET_WINDOWS_64 and not bld.env.TARGET_WINDOWS_32 and not bld.env.DISABLE_GUI:
         bld.install_as('${PREFIX}/share/dcpomatic2/dcpomatic2_server_small.png', 'linux/16/dcpomatic2.png')
         bld.install_files('${PREFIX}/share/dcpomatic2', 'splash.png')
         bld.install_files('${PREFIX}/share/dcpomatic2', 'zoom.png')
index 2cc3d6453aa03b63a24facc517afa999e6d515e1..99d2216107742ca4b75a70cff76bb7e67d49d4db 100644 (file)
@@ -82,15 +82,11 @@ SetOutPath "$INSTDIR\\bin"
 WriteUninstaller "$INSTDIR\\Uninstall.exe"
 
 File "%static_deps%/bin/libintl-8.dll"
-File "%static_deps%/bin/libboost_chrono-mt.dll"
-File "%static_deps%/bin/libboost_filesystem-mt.dll"
-File "%static_deps%/bin/libboost_system-mt.dll"
-File "%static_deps%/bin/libboost_thread-mt.dll"
-File "%static_deps%/bin/libboost_date_time-mt.dll"
-File "%static_deps%/bin/libboost_locale-mt.dll"
-File "%static_deps%/bin/libboost_regex-mt.dll"
 """, file=f)
 
+    for lib in ['chrono', 'filesystem', 'system', 'thread', 'date_time', 'locale', 'regex']:
+        print('File "%%static_deps%%/bin/libboost_%s-mt-x%d.dll"' % (lib, bits), file=f)
+
     if bits == 32:
         print('File "%static_deps%/bin/libgcc_s_sjlj-1.dll"', file=f)
     else:
index 59920d6ca9060e482ce02e0612281a6d06ddabc5..2bf740c34363d1f9bf4e043dee9503ea88a1899a 100644 (file)
@@ -216,7 +216,7 @@ def build(bld):
         if bld.env.TARGET_LINUX:
             obj.uselib += ' POLKIT'
 
-    if bld.env.TARGET_WINDOWS:
+    if bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32:
         obj.uselib += ' WINSOCK2 DBGHELP SHLWAPI MSWSOCK BOOST_LOCALE SETUPAPI'
         obj.source += ' cross_windows.cc'
     if bld.env.TARGET_OSX:
index 018689e03d86058d92d3c7381b0d82bf48f99fa7..4b90995c785998e150991a07ffc235683a7ca397 100644 (file)
@@ -23,7 +23,7 @@ from waflib import Logs
 import i18n
 
 def configure(conf):
-    if conf.env.TARGET_WINDOWS:
+    if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32:
         conf.env.append_value('CXXFLAGS', ['-mconsole'])
         conf.env.append_value('LINKFLAGS', ['-mconsole'])
 
@@ -37,7 +37,7 @@ def build(bld):
             uselib += 'POLKIT '
         uselib += 'LWEXT4 NANOMSG '
 
-    if bld.env.TARGET_WINDOWS:
+    if bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32:
         uselib += 'WINSOCK2 DBGHELP SHLWAPI MSWSOCK BOOST_LOCALE WINSOCK2 OLE32 DSOUND WINMM KSUSER SETUPAPI '
     if bld.env.TARGET_LINUX:
         uselib += 'DL '
@@ -52,7 +52,7 @@ def build(bld):
         obj.includes = ['..']
         obj.use    = ['libdcpomatic2']
         obj.source = '%s.cc' % t
-        if bld.env.TARGET_WINDOWS and t == 'dcpomatic_disk_writer':
+        if (bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32) and t == 'dcpomatic_disk_writer':
             obj.source += ' ../../platform/windows/%s.rc' % t
             # Prevent a console window opening when we start dcpomatic2_disk_writer
             obj.env.append_value('LINKFLAGS', '-Wl,-subsystem,windows')
@@ -79,7 +79,7 @@ def build(bld):
         obj.includes = ['..']
         obj.use    = ['libdcpomatic2', 'libdcpomatic2-wx']
         obj.source = '%s.cc' % t
-        if bld.env.TARGET_WINDOWS:
+        if bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32:
             obj.source += ' ../../platform/windows/%s.rc' % t
         obj.target = t.replace('dcpomatic', 'dcpomatic2')
 
index 50c078f2b0f1d50a108d8707727215c19bc8d4a9..93afaeda2fd1444f9ba4e37af2871fc602ea4b41 100644 (file)
@@ -210,7 +210,7 @@ def configure(conf):
 
     if conf.env.TARGET_LINUX:
         conf.env.append_value('CXXFLAGS', ['-DGL_GLEXT_PROTOTYPES', '-DGLX_GLXEXT_PROTOTYPES'])
-    if conf.env.TARGET_WINDOWS:
+    if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32:
         conf.env.append_value('CXXFLAGS', ['-DWGL_WGLEXT_PROTOTYPES'])
 
     if conf.options.static_wxwidgets:
@@ -265,7 +265,7 @@ def configure(conf):
 
     # Some rtaudio-configs don't include rtaudio as a link library.  Go figure.
     conf.env.LIB_RTAUDIO.append('rtaudio')
-    if conf.env.TARGET_WINDOWS:
+    if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32:
         # Don't explicitly link with pthread on Windows
         conf.env.CFLAGS_RTAUDIO.remove('-pthread')
         conf.env.LINKFLAGS_RTAUDIO.remove('-pthread')
@@ -274,10 +274,10 @@ def configure(conf):
         conf.env.LIB_RTAUDIO.append('mfuuid')
         conf.env.LIB_RTAUDIO.append('wmcodecdspuuid')
 
-    if conf.env.TARGET_WINDOWS or conf.env.TARGET_LINUX:
+    if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32 or conf.env.TARGET_LINUX:
         conf.check_cfg(package='gl', args='--cflags --libs', uselib_store='GL', mandatory=True)
         conf.check_cfg(package='glu', args='--cflags --libs', uselib_store='GLU', mandatory=True)
-        if conf.env.TARGET_WINDOWS:
+        if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32:
             conf.check_cfg(package='glew', args='--cflags --libs', uselib_store='GLEW', mandatory=True)
     else:
         conf.env.STLIB_GL = 'gl'
@@ -312,7 +312,7 @@ def build(bld):
     obj.uselib = 'BOOST_FILESYSTEM BOOST_THREAD BOOST_REGEX WXWIDGETS DCP SUB ZIP CXML RTAUDIO '
     if bld.env.TARGET_LINUX:
         obj.uselib += 'GTK GL GLU '
-    if bld.env.TARGET_WINDOWS:
+    if bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32:
         obj.uselib += 'WINSOCK2 OLE32 DSOUND WINMM KSUSER GL GLU GLEW '
     if bld.env.TARGET_OSX:
         obj.framework = ['CoreAudio', 'OpenGL']
index bb6484cd83cc09aa31105bc2d91e362bb3173cfa..00461140823164cc1db50cabf36765939d87fadd 100644 (file)
 
 def configure(conf):
     boost_test_suffix=''
-    if conf.env.TARGET_WINDOWS:
-        boost_test_suffix='-mt'
+    if conf.env.TARGET_WINDOWS_64:
+        boost_test_suffix='-mt-x64'
+    elif conf.env.TARGET_WINDOWS_32:
+        boost_test_suffix='-mt-x32'
 
     conf.check_cfg(package='sndfile', args='--cflags --libs', uselib_store='SNDFILE', mandatory=True)
 
     conf.check_cxx(fragment="""
                             #define BOOST_TEST_MODULE Config test\n
-                           #include <boost/test/unit_test.hpp>\n
+                            #include <boost/test/unit_test.hpp>\n
                             int main() {}
                             """, msg = 'Checking for boost unit testing library', lib = 'boost_unit_test_framework%s' % boost_test_suffix, uselib_store = 'BOOST_TEST')
 
@@ -36,7 +38,7 @@ def build(bld):
     obj.uselib =  'BOOST_TEST BOOST_THREAD BOOST_FILESYSTEM BOOST_DATETIME SNDFILE SAMPLERATE DCP FONTCONFIG CAIROMM PANGOMM XMLPP '
     obj.uselib += 'AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE SWRESAMPLE POSTPROC CXML SUB GLIB CURL SSH XMLSEC BOOST_REGEX ICU NETTLE PNG '
     obj.uselib += 'LEQM_NRT ZIP '
-    if bld.env.TARGET_WINDOWS:
+    if bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32:
         obj.uselib += 'WINSOCK2 DBGHELP SHLWAPI MSWSOCK BOOST_LOCALE '
     if bld.env.TARGET_LINUX:
         obj.uselib += 'DL '
diff --git a/wscript b/wscript
index 239f45bf805b3b408dfb48a9737889321185f0b1..1a260652cefa241452b3179af2afcdf2dd6137fa 100644 (file)
--- a/wscript
+++ b/wscript
@@ -59,7 +59,8 @@ def options(opt):
     opt.add_option('--enable-debug',      action='store_true', default=False, help='build with debugging information and without optimisation')
     opt.add_option('--disable-gui',       action='store_true', default=False, help='disable building of GUI tools')
     opt.add_option('--disable-tests',     action='store_true', default=False, help='disable building of tests')
-    opt.add_option('--target-windows',    action='store_true', default=False, help='set up to do a cross-compile for Windows')
+    opt.add_option('--target-windows-64', action='store_true', default=False, help='set up to do a cross-compile for Windows 64-bit')
+    opt.add_option('--target-windows-32', action='store_true', default=False, help='set up to do a cross-compile for Windows 32-bit')
     opt.add_option('--target-macos-arm64', action='store_true', default=False, help='set up to do a cross-compile for macOS arm64')
     opt.add_option('--static-dcpomatic',  action='store_true', default=False, help='link to components of DCP-o-matic statically')
     opt.add_option('--static-boost',      action='store_true', default=False, help='link statically to Boost')
@@ -81,15 +82,16 @@ def options(opt):
 def configure(conf):
     conf.load('compiler_cxx')
     conf.load('clang_compilation_database', tooldir=['waf-tools'])
-    if conf.options.target_windows:
+    if conf.options.target_windows_64 or conf.options.target_windows_32:
         conf.load('winres')
 
     # 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
-    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_64
     conf.env.TARGET_OSX = sys.platform == 'darwin'
-    conf.env.TARGET_LINUX = not conf.env.TARGET_WINDOWS and not conf.env.TARGET_OSX
+    conf.env.TARGET_LINUX = not conf.env.TARGET_WINDOWS_64 and not conf.env.TARGET_WINDOWS_32 and not conf.env.TARGET_OSX
     conf.env.VERSION = VERSION
     conf.env.DEBUG = conf.options.enable_debug
     conf.env.STATIC_DCPOMATIC = conf.options.static_dcpomatic
@@ -149,7 +151,7 @@ def configure(conf):
     #
 
     # Windows
-    if conf.env.TARGET_WINDOWS:
+    if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32:
         conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_WINDOWS')
         conf.env.append_value('CXXFLAGS', '-DWIN32_LEAN_AND_MEAN')
         conf.env.append_value('CXXFLAGS', '-DBOOST_USE_WINDOWS_H')
@@ -170,8 +172,8 @@ def configure(conf):
         conf.check(lib='winmm', uselib_store='WINMM', msg="Checking for library winmm")
         conf.check(lib='ksuser', uselib_store='KSUSER', msg="Checking for library ksuser")
         conf.check(lib='setupapi', uselib_store='SETUPAPI', msg="Checking for library setupapi")
-        boost_lib_suffix = '-mt'
-        boost_thread = 'boost_thread-mt'
+        boost_lib_suffix = '-mt-x32' if conf.options.target_windows_32 else '-mt-x64'
+        boost_thread = 'boost_thread' + boost_lib_suffix
         conf.check_cxx(fragment="""
                                #include <boost/locale.hpp>\n
                                int main() { std::locale::global (boost::locale::generator().generate ("")); }\n
@@ -530,7 +532,7 @@ def configure(conf):
         # program has to link with boost_system so I'm doing it this way.
         if conf.options.enable_disk:
             deps = ['boost_system%s' % boost_lib_suffix]
-            if conf.env.TARGET_WINDOWS:
+            if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32:
                 deps.append('ws2_32')
                 deps.append('boost_filesystem%s' % boost_lib_suffix)
             conf.check_cxx(fragment="""
@@ -559,7 +561,7 @@ def configure(conf):
         conf.recurse('test')
 
     Logs.pprint('YELLOW', '')
-    if conf.env.TARGET_WINDOWS:
+    if conf.env.TARGET_WINDOWS_64 or conf.env.TARGET_WINDOWS_32:
         Logs.pprint('YELLOW', '\t' + 'Target'.ljust(25) + ': Windows')
     elif conf.env.TARGET_LINUX:
         Logs.pprint('YELLOW', '\t' + 'Target'.ljust(25) + ': Linux')
@@ -595,14 +597,14 @@ def build(bld):
 
     if not bld.env.DISABLE_TESTS:
         bld.recurse('test')
-    if bld.env.TARGET_WINDOWS:
+    if bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32:
         bld.recurse('platform/windows')
     if bld.env.TARGET_LINUX:
         bld.recurse('platform/linux')
     if bld.env.TARGET_OSX:
         bld.recurse('platform/osx')
 
-    if not bld.env.TARGET_WINDOWS:
+    if not bld.env.TARGET_WINDOWS_64 and not bld.env.TARGET_WINDOWS_32:
         bld.install_files('${PREFIX}/share/dcpomatic2', 'fonts/LiberationSans-Regular.ttf')
         bld.install_files('${PREFIX}/share/dcpomatic2', 'fonts/LiberationSans-Italic.ttf')
         bld.install_files('${PREFIX}/share/dcpomatic2', 'fonts/LiberationSans-Bold.ttf')