From b3285edb5644d534854b5a9786e82dcd5d0bb2ae Mon Sep 17 00:00:00 2001 From: Dimon4eg Date: Mon, 29 Jan 2018 10:36:38 +0200 Subject: [PATCH] Speed up windows build (#18662) * added precompiled headers * Configure Visual Studio projects to use precompiled headers --- cocos/2d/libcocos2d.vcxproj | 17 +- cocos/2d/libcocos2d.vcxproj.filters | 2 + cocos/precheader.cpp | 2 + cocos/precheader.h | 5 + cocos/scripting/js-bindings/precheader.cpp | 2 + cocos/scripting/js-bindings/precheader.h | 5 + .../proj.win32/libjscocos2d.vcxproj | 17 +- .../proj.win32/libjscocos2d.vcxproj.filters | 4 +- tests/cpp-tests/Classes/precheader.cpp | 2 + tests/cpp-tests/Classes/precheader.h | 7 + tests/cpp-tests/proj.win32/cpp-tests.vcxproj | 14 +- .../proj.win32/cpp-tests.vcxproj.filters | 194 +++++++++++++----- 12 files changed, 213 insertions(+), 58 deletions(-) create mode 100644 cocos/precheader.cpp create mode 100644 cocos/precheader.h create mode 100644 cocos/scripting/js-bindings/precheader.cpp create mode 100644 cocos/scripting/js-bindings/precheader.h create mode 100644 tests/cpp-tests/Classes/precheader.cpp create mode 100644 tests/cpp-tests/Classes/precheader.h diff --git a/cocos/2d/libcocos2d.vcxproj b/cocos/2d/libcocos2d.vcxproj index 988322cbf5..8f2c32b99e 100644 --- a/cocos/2d/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d.vcxproj @@ -84,13 +84,14 @@ false EnableFastChecks MultiThreadedDebugDLL - - + Use Level3 OldStyle 4267;4251;4244;%(DisableSpecificWarnings) true CompileAsCpp + precheader.h + precheader.h if not exist "$(OutDir)" mkdir "$(OutDir)" @@ -140,8 +141,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\openssl\prebuilt\win32\*.*" "$(OutDir)" $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\MP3Decoder\include;$(EngineRoot)external\win32-specific\OggDecoder\include;$(EngineRoot)external\win32-specific\OpenalSoft\include;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\Box2D\include;$(EngineRoot)external\curl\include\win32;$(EngineRoot)external\websockets\include\win32\;$(EngineRoot)external\poly2tri\common;$(EngineRoot)external\poly2tri\sweep;$(EngineRoot)external\poly2tri;$(EngineRoot)external;$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\platform\win8.1-universal;$(EngineRoot)extensions;$(EngineRoot);$(EngineRoot)external/bullet/include;$(EngineRoot)external/bullet/include/bullet;%(AdditionalIncludeDirectories) WIN32;_USRDLL;NDEBUG;_WINDOWS;_LIB;LWS_DLL;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;PROTOBUF_USE_DLLS;LIBPROTOBUF_EXPORTS;%(PreprocessorDefinitions) MultiThreadedDLL - - + Use Level3 None 4267;4251;4244;%(DisableSpecificWarnings) @@ -149,6 +149,8 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\openssl\prebuilt\win32\*.*" "$(OutDir)" CompileAsCpp false MinSpace + precheader.h + precheader.h if not exist "$(OutDir)" mkdir "$(OutDir)" @@ -627,6 +629,12 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\openssl\prebuilt\win32\*.*" "$(OutDir)" + + Create + precheader.h + Create + precheader.h + @@ -1267,6 +1275,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\openssl\prebuilt\win32\*.*" "$(OutDir)" + diff --git a/cocos/2d/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d.vcxproj.filters index bee3f84d94..adcbd4a865 100644 --- a/cocos/2d/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d.vcxproj.filters @@ -2000,6 +2000,7 @@ + @@ -3911,6 +3912,7 @@ + diff --git a/cocos/precheader.cpp b/cocos/precheader.cpp new file mode 100644 index 0000000000..41a73e0742 --- /dev/null +++ b/cocos/precheader.cpp @@ -0,0 +1,2 @@ +// do not delete +// this file required for precompiled header feature diff --git a/cocos/precheader.h b/cocos/precheader.h new file mode 100644 index 0000000000..a7f767f7f8 --- /dev/null +++ b/cocos/precheader.h @@ -0,0 +1,5 @@ +// precompiled header +// include here heavy headers which are included in many files +// this will speed-up build a lot + +#include "cocos2d.h" diff --git a/cocos/scripting/js-bindings/precheader.cpp b/cocos/scripting/js-bindings/precheader.cpp new file mode 100644 index 0000000000..41a73e0742 --- /dev/null +++ b/cocos/scripting/js-bindings/precheader.cpp @@ -0,0 +1,2 @@ +// do not delete +// this file required for precompiled header feature diff --git a/cocos/scripting/js-bindings/precheader.h b/cocos/scripting/js-bindings/precheader.h new file mode 100644 index 0000000000..a7f767f7f8 --- /dev/null +++ b/cocos/scripting/js-bindings/precheader.h @@ -0,0 +1,5 @@ +// precompiled header +// include here heavy headers which are included in many files +// this will speed-up build a lot + +#include "cocos2d.h" diff --git a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj index 022791ce3e..d1a41f005c 100644 --- a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj +++ b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj @@ -54,6 +54,12 @@ + + Create + precheader.h + Create + precheader.h + @@ -107,6 +113,7 @@ + @@ -167,8 +174,7 @@ - - + Use Level3 Disabled WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_USRJSSTATIC;%(PreprocessorDefinitions) @@ -177,6 +183,8 @@ true false ProgramDatabase + precheader.h + precheader.h Windows @@ -192,8 +200,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\spidermonkey\prebuilt\win32\*.*" Level3 - - + Use MinSpace true true @@ -202,6 +209,8 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\spidermonkey\prebuilt\win32\*.*" 4068;4101;4800;4251;4244;4099;4083;4700;%(DisableSpecificWarnings) true None + precheader.h + precheader.h Windows diff --git a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters index a1ad5ba03c..a1dcc11afb 100644 --- a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters +++ b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj.filters @@ -176,6 +176,7 @@ manual + @@ -331,5 +332,6 @@ manual + - + \ No newline at end of file diff --git a/tests/cpp-tests/Classes/precheader.cpp b/tests/cpp-tests/Classes/precheader.cpp new file mode 100644 index 0000000000..41a73e0742 --- /dev/null +++ b/tests/cpp-tests/Classes/precheader.cpp @@ -0,0 +1,2 @@ +// do not delete +// this file required for precompiled header feature diff --git a/tests/cpp-tests/Classes/precheader.h b/tests/cpp-tests/Classes/precheader.h new file mode 100644 index 0000000000..b9eb21c21f --- /dev/null +++ b/tests/cpp-tests/Classes/precheader.h @@ -0,0 +1,7 @@ +// precompiled header +// include here heavy headers which are included in many files +// this will speed-up build a lot + +#include "cocos2d.h" +#include "ui/CocosGUI.h" +#include "extensions/cocos-ext.h" diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj index b923cb9076..08707d913e 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj @@ -79,12 +79,13 @@ WIN32;_DEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES;CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;COCOS2DXWIN32_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL - - + Use Level3 OldStyle 4267;4251;4244;%(DisableSpecificWarnings) true + precheader.h + precheader.h $(OutDir)$(ProjectName).exe @@ -123,6 +124,9 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y 4267;4251;4244;%(DisableSpecificWarnings) true false + Use + precheader.h + precheader.h libcurl.lib;libssl.lib;libcrypto.lib;opengl32.lib;glew32.lib;%(AdditionalDependencies) @@ -186,6 +190,11 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y + + Create + precheader.h + Create + @@ -326,6 +335,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y + diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters index ee620e9a2f..54ed41aaf4 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj.filters @@ -546,7 +546,6 @@ Classes\BugsTest - Classes\BugsTest @@ -562,35 +561,87 @@ Classes\DownloaderTest - - - - - - - - - - - - - - - - - - - - - - - Classes\VRTests Classes\WindowTest + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes + @@ -1070,34 +1121,83 @@ Classes\DownloaderTest - - - - - - - - - - - - - - - - - - - - - - - Classes\VRTests Classes\WindowTest + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes\UITest + + + Classes + \ No newline at end of file