From b1406e8ecdd958ec186bb0487ce3cf13308bd161 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 26 Jun 2019 16:41:58 +0300 Subject: [PATCH] waf: fix multiprocess compilation with msvc --- scripts/build_windows_engine.sh | 2 +- scripts/waifulib/msvcfix.py | 10 ++++++++++ wscript | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 scripts/waifulib/msvcfix.py diff --git a/scripts/build_windows_engine.sh b/scripts/build_windows_engine.sh index e30d92ec..470041dc 100644 --- a/scripts/build_windows_engine.sh +++ b/scripts/build_windows_engine.sh @@ -8,7 +8,7 @@ cd $TRAVIS_BUILD_DIR # NOTE: to build with other version use --msvc_version during configuration # NOTE: sometimes you may need to add WinSDK to %PATH% ./waf.bat configure -s "$TRAVIS_BUILD_DIR/SDL2_VC" -T "debug" --prefix=`pwd` || die -./waf.bat build -j1 || die +./waf.bat build || die echo After build ./waf.bat install || die diff --git a/scripts/waifulib/msvcfix.py b/scripts/waifulib/msvcfix.py new file mode 100644 index 00000000..0f69fa92 --- /dev/null +++ b/scripts/waifulib/msvcfix.py @@ -0,0 +1,10 @@ +#!/usr/bin/env +from waflib.TaskGen import feature, after_method + +@feature('c', 'cxx') +@after_method('apply_flags_msvc') +def make_pdb_unique(self): + for t in self.compiled_tasks: + pdb_unique_cflag = '/Fd' + t.outputs[0].change_ext('.pdb').abspath() + t.env.append_value('CFLAGS', pdb_unique_cflag) + t.env.append_value('CXXFLAGS', pdb_unique_cflag) diff --git a/wscript b/wscript index f450a497..9ac9bce5 100644 --- a/wscript +++ b/wscript @@ -89,7 +89,7 @@ def configure(conf): conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01' conf.env.MSVC_TARGETS = ['x86'] # explicitly request x86 target for MSVC if sys.platform == 'win32': - conf.load('msvc msdev msvs') + conf.load('msvc msvcfix msdev msvs') conf.load('xcompile compiler_c compiler_cxx gitversion clang_compilation_database') # Every static library must have fPIC