From 8f955150ff2b642109552dd234089f9a038bb3d6 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 22 Feb 2022 23:01:23 +0100 Subject: [PATCH] Add -x32/-x64 suffix to boost libraries when building for Windows. --- cscript | 6 +++--- graphics/wscript | 2 +- platform/windows/wscript | 10 +++------- src/lib/wscript | 2 +- src/tools/wscript | 8 ++++---- src/wx/wscript | 10 +++++----- test/wscript | 10 ++++++---- wscript | 24 +++++++++++++----------- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/cscript b/cscript index 7bf3ce5ec..7feb7eb03 100644 --- 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': diff --git a/graphics/wscript b/graphics/wscript index 68435ea23..a5d477644 100644 --- a/graphics/wscript +++ b/graphics/wscript @@ -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') diff --git a/platform/windows/wscript b/platform/windows/wscript index 2cc3d6453..99d221610 100644 --- a/platform/windows/wscript +++ b/platform/windows/wscript @@ -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: diff --git a/src/lib/wscript b/src/lib/wscript index 59920d6ca..2bf740c34 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -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: diff --git a/src/tools/wscript b/src/tools/wscript index 018689e03..4b90995c7 100644 --- a/src/tools/wscript +++ b/src/tools/wscript @@ -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') diff --git a/src/wx/wscript b/src/wx/wscript index 50c078f2b..93afaeda2 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -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'] diff --git a/test/wscript b/test/wscript index bb6484cd8..004611408 100644 --- a/test/wscript +++ b/test/wscript @@ -19,14 +19,16 @@ 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 \n + #include \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 239f45bf8..1a260652c 100644 --- 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 \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') -- 2.30.2