From f2ac007191de32e17b4c3b7a6e9780e147daea41 Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 14 Apr 2022 10:15:56 +0200 Subject: [PATCH 1/3] cppcheck.vcxproj: added copying of addons to post-build step --- lib/cppcheck.vcxproj | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/cppcheck.vcxproj b/lib/cppcheck.vcxproj index 4029a01efd5..c450d6c7a08 100644 --- a/lib/cppcheck.vcxproj +++ b/lib/cppcheck.vcxproj @@ -1,4 +1,4 @@ - + Debug-PCRE @@ -317,7 +317,8 @@ 8000000 - xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y + xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y +xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y @@ -348,7 +349,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y 8000000 - xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y + xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y +xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y @@ -377,7 +379,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y 8000000 - xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y + xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y +xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y @@ -407,7 +410,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y 8000000 - xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y + xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y +xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y @@ -446,7 +450,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y 8000000 - xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y + xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y +xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y @@ -486,7 +491,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y 8000000 - xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y + xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y +xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y @@ -524,7 +530,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y 8000000 - xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y + xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y +xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y @@ -563,7 +570,8 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y 8000000 - xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y + xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y +xcopy "$(SolutionDir)cfg" "$(OutDir)cfg" /E /I /D /Y xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y From 90a6f88c4cc3784e490d631a0c36ca014f12e07d Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 14 Apr 2022 10:17:51 +0200 Subject: [PATCH 2/3] aligned all options between the various Visual Studio configurations --- cli/cli.vcxproj | 22 ++++++++++++++-------- lib/cppcheck.vcxproj | 29 +++++++++++++++++------------ test/testrunner.vcxproj | 5 ++++- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/cli/cli.vcxproj b/cli/cli.vcxproj index 613e4e61fcc..c242bad0967 100644 --- a/cli/cli.vcxproj +++ b/cli/cli.vcxproj @@ -160,7 +160,7 @@ true ProgramDatabase Disabled - CPPCHECKLIB_IMPORT;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) + CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) MultiThreadedDebugDLL Level4 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 @@ -175,7 +175,7 @@ true Console true - $(TargetDir)cli.pdb + $(OutDir)$(TargetName).pdb true 8000000 8000000 @@ -214,7 +214,7 @@ true ProgramDatabase Disabled - CPPCHECKLIB_IMPORT;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions) + CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions) MultiThreadedDebugDLL Level4 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 @@ -231,6 +231,7 @@ true 8000000 8000000 + true @@ -256,6 +257,7 @@ true 8000000 8000000 + true @@ -263,7 +265,7 @@ ..\lib;..\externals;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories) false MaxSpeed - CPPCHECKLIB_IMPORT;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) + CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) MultiThreadedDLL Level4 AnySuitable @@ -277,11 +279,12 @@ /Zc:throwingNew /Zc:__cplusplus %(AdditionalOptions) true stdcpp14 + true shlwapi.lib;%(AdditionalDependencies) ../externals;%(AdditionalLibraryDirectories) - false + true Console true true @@ -311,11 +314,12 @@ /Zc:throwingNew /Zc:__cplusplus %(AdditionalOptions) true stdcpp14 + true shlwapi.lib;%(AdditionalDependencies) ../externals;%(AdditionalLibraryDirectories) - false + true Console true true @@ -331,7 +335,7 @@ ..\lib;..\externals;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories) false MaxSpeed - CPPCHECKLIB_IMPORT;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions) + CPPCHECKLIB_IMPORT;TINYXML2_IMPORT;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions) MultiThreadedDLL Level4 AnySuitable @@ -358,6 +362,7 @@ true 8000000 8000000 + true @@ -384,7 +389,7 @@ shlwapi.lib;%(AdditionalDependencies) ../externals;%(AdditionalLibraryDirectories) - false + true Console true true @@ -392,6 +397,7 @@ true 8000000 8000000 + true diff --git a/lib/cppcheck.vcxproj b/lib/cppcheck.vcxproj index c450d6c7a08..28cc5b3ed65 100644 --- a/lib/cppcheck.vcxproj +++ b/lib/cppcheck.vcxproj @@ -298,7 +298,7 @@ CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) Level4 ..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories) - 4018;4146;4127;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 + 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 MultiThreadedDebugDLL Use precompiled.h @@ -311,7 +311,8 @@ ../externals;%(AdditionalLibraryDirectories) true true - false + + true 8000000 8000000 @@ -330,7 +331,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;TIXML_USE_STL;%(PreprocessorDefinitions) Level4 ..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories) - 4018;4146;4127;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 + 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 MultiThreadedDebugDLL Use precompiled.h @@ -362,7 +363,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions) Level4 ..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories) - 4018;4146;4127;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 + 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 MultiThreadedDebugDLL Use precompiled.h @@ -377,6 +378,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y true 8000000 8000000 + true xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y @@ -392,7 +394,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions) Level4 ..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories) - 4018;4146;4127;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 + 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 MultiThreadedDebugDLL Use precompiled.h @@ -408,6 +410,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y true 8000000 8000000 + true xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y @@ -426,7 +429,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y true true ..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories) - 4018;4146;4127;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 + 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions) MultiThreadedDLL ProgramDatabase @@ -441,7 +444,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y ../externals;%(AdditionalLibraryDirectories) - false + true true true true @@ -466,7 +469,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y true true ..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories) - 4018;4146;4127;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 + 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;NDEBUG;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;TIXML_USE_STL;%(PreprocessorDefinitions) MultiThreadedDLL ProgramDatabase @@ -482,7 +485,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y pcre.lib;%(AdditionalDependencies) ../externals;%(AdditionalLibraryDirectories) - false + true true true true @@ -507,7 +510,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y true true ..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories) - 4018;4146;4127;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 + 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;NDEBUG;WIN32;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions) MultiThreadedDLL ProgramDatabase @@ -528,6 +531,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y true 8000000 8000000 + true xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y @@ -546,7 +550,7 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y true true ..\externals;..\externals\picojson;..\externals\simplecpp;..\externals\tinyxml2;%(AdditionalIncludeDirectories) - 4018;4146;4127;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 + 4018;4127;4146;4244;4251;4267;4389;4482;4512;4701;4706;4800;4805 CPPCHECKLIB_EXPORT;TINYXML2_EXPORT;SIMPLECPP_EXPORT;NDEBUG;WIN32;HAVE_RULES;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WIN64;%(PreprocessorDefinitions) MultiThreadedDLL ProgramDatabase @@ -562,12 +566,13 @@ xcopy "$(SolutionDir)platforms" "$(OutDir)platforms" /E /I /D /Y pcre64.lib;%(AdditionalDependencies) ../externals;%(AdditionalLibraryDirectories) - false + true true true true 8000000 8000000 + true xcopy "$(SolutionDir)addons" "$(OutDir)addons" /E /I /D /Y diff --git a/test/testrunner.vcxproj b/test/testrunner.vcxproj index f21a542aec2..10994701acb 100755 --- a/test/testrunner.vcxproj +++ b/test/testrunner.vcxproj @@ -229,6 +229,7 @@ true 8000000 8000000 + true @@ -267,6 +268,7 @@ true 8000000 8000000 + true @@ -306,8 +308,9 @@ true 8000000 8000000 + true - + \ No newline at end of file From 27a1ea75a4e46f97c3c12c2cf6c0ef3ee77d72bd Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 14 Apr 2022 10:18:20 +0200 Subject: [PATCH 3/3] added all custom options from Visual Studio project to CMake --- cmake/compilerDefinitions.cmake | 5 +++ cmake/compileroptions.cmake | 70 +++++++++++++++++++++++++++++++-- 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/cmake/compilerDefinitions.cmake b/cmake/compilerDefinitions.cmake index 3ae13949123..e7117fc0ef1 100644 --- a/cmake/compilerDefinitions.cmake +++ b/cmake/compilerDefinitions.cmake @@ -4,7 +4,12 @@ if (MSVC) add_definitions(-DDEBUG) endif() + #add_definitions(-DCPPCHECKLIB_IMPORT) + #add_definitions(-DTINYXML2_IMPORT) + add_definitions(-DWIN32) add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_definitions(-DWIN32_LEAN_MEAN) + add_definitions(-D_WIN64) endif() # TODO: this should probably apply to the compiler and not the platform diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index 95ba5db5e5f..684c93ce076 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -101,7 +101,48 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif() if (MSVC) - add_compile_options(/W4) + # General + add_compile_options(/W4) # Warning Level + add_compile_options(/Zi) # Debug Information Format - Program Database + if (WARNINGS_ARE_ERRORS) + add_compile_options(/WX) # Treat Warning As Errors + endif() + add_compile_options(/MP) # Multi-processor Compilation + + # Advanced + # Character Set - Use Unicode Character Set + # No Whole Program Optimization + + # C/C++ - Optimization + if(CMAKE_BUILD_TYPE MATCHES "Release" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") + add_compile_options(/O2) # Optimization - Maximum Optimization (Favor Speed) + add_compile_options(/Ob2) # Inline Function Expansion - Any Suitable + add_compile_options(/Oi) # Enable Intrinsic Functions + add_compile_options(/Ot) # Favor fast code + add_compile_options(/Oy) # Omit Frame Pointers + else() + add_compile_options(/Od) # Optimization - Disabled + endif() + + # C/C++ - Code Generation + if(CMAKE_BUILD_TYPE MATCHES "Release" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") + add_compile_options(/GF) # Enable String Pooling + add_compile_options(/MD) # Runtime Library - Multi-threaded DLL + add_compile_options(/GS-) # Disable Security Check + add_compile_options(/Gy) # Enable Function-Level Linking + else() + add_compile_options(/MDd) # Runtime Library - Multi-threaded Debug DLL + add_compile_options(/GS) # Enable Security Check + endif() + + # C/C++ - Language + add_compile_options(/Zc:rvalueCast) # Enforce type conversion rules + add_compile_options(/std:c++14) # C++ Langage Standard - ISO C++14 Standard + + # C/C++ - Browse Information + # Enable Browse Information - No + + # C/C++ - Advanced add_compile_options(/wd4018) # warning C4018: '>': signed/unsigned mismatch add_compile_options(/wd4127) # warning C4127: conditional expression is constant add_compile_options(/wd4146) # warning C4146: unary minus operator applied to unsigned type, result still unsigned @@ -117,8 +158,31 @@ if (MSVC) add_compile_options(/wd4800) # warning C4800: 'const SymbolDatabase *' : forcing value to bool 'true' or 'false' (performance warning) add_compile_options(/wd4805) # warning C4805: '==' : unsafe mix of type 'bool' and type 'long long' in operation - if (WARNINGS_ARE_ERRORS) - add_compile_options(/WX) + # C/C++ - All Options + add_compile_options(/Zc:throwingNew /Zc:__cplusplus) # Additional Options + + # Linker - General + if(CMAKE_BUILD_TYPE MATCHES "Debug") + add_link_options(/INCREMENTAL) # Enable Incremental Linking - Yes + endif() + add_link_options(/NOLOGO) # SUppress Startup Banner - Yes + # Ignore Import Library - Yes + + # Linker - Debugging + add_link_options(/DEBUG) # Generate Debug Information + + # Linker - System + # Stack Reserve Size - 8000000 + # Stack Commit Size - 8000000 + add_link_options(/LARGEADDRESSAWARE) # Enbale Large Addresses - Yes + + # Linker - Optimization + add_link_options(/OPT:REF) # References - Yes + add_link_options(/OPT:ICF) # Enable COMDAT Folding - Yes + + # Linker - Advanced + if(CMAKE_BUILD_TYPE MATCHES "Release" OR CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") + add_link_options(/RELEASE) # Set Checksum - Yes endif() endif()