From 1083e89da3f8182d377a48d0c46cf2308795f974 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 1 Jun 2024 11:45:39 +0200 Subject: Build: Remove unneccessary /MP compile option when using ninja --- cmake/compiler/msvc/settings.cmake | 34 +++++++++++++++++++++------------- cmake/showoptions.cmake | 2 +- 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'cmake') diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake index 18ab8328fbb..2611cdc65e1 100644 --- a/cmake/compiler/msvc/settings.cmake +++ b/cmake/compiler/msvc/settings.cmake @@ -65,17 +65,23 @@ if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild") target_compile_definitions(trinity-compile-option-interface INTERFACE -D_BUILD_DIRECTIVE="$(ConfigurationName)") + + # multithreaded compiling on VS + target_compile_options(trinity-compile-option-interface + INTERFACE + /MP) else() # while all make-like generators do (nmake, ninja) target_compile_definitions(trinity-compile-option-interface INTERFACE -D_BUILD_DIRECTIVE="$") -endif() -# multithreaded compiling on VS -target_compile_options(trinity-compile-option-interface - INTERFACE - /MP) + # Forces writes to the PDB file to be serialized through mspdbsrv.exe (/FS) + # Enable faster PDB generation in parallel builds by minimizing RPC calls to mspdbsrv.exe (/Zf) + target_compile_options(trinity-compile-option-interface + INTERFACE + $<$:/FS /Zf>) +endif() if((PLATFORM EQUAL 64) OR (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.23026.0) OR BUILD_SHARED_LIBS) # Enable extended object support @@ -86,14 +92,16 @@ if((PLATFORM EQUAL 64) OR (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.2302 message(STATUS "MSVC: Enabled increased number of sections in object files") endif() -# /Zc:throwingNew. -# When you specify Zc:throwingNew on the command line, it instructs the compiler to assume -# that the program will eventually be linked with a conforming operator new implementation, -# and can omit all of these extra null checks from your program. -# http://blogs.msdn.com/b/vcblog/archive/2015/08/06/new-in-vs-2015-zc-throwingnew.aspx -target_compile_options(trinity-compile-option-interface - INTERFACE - /Zc:throwingNew) +if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + # /Zc:throwingNew. + # When you specify Zc:throwingNew on the command line, it instructs the compiler to assume + # that the program will eventually be linked with a conforming operator new implementation, + # and can omit all of these extra null checks from your program. + # http://blogs.msdn.com/b/vcblog/archive/2015/08/06/new-in-vs-2015-zc-throwingnew.aspx + target_compile_options(trinity-compile-option-interface + INTERFACE + /Zc:throwingNew) +endif() # Define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - eliminates the warning by changing the strcpy call to strcpy_s, which prevents buffer overruns target_compile_definitions(trinity-compile-option-interface diff --git a/cmake/showoptions.cmake b/cmake/showoptions.cmake index dea6ef01ed4..0cf0862dd00 100644 --- a/cmake/showoptions.cmake +++ b/cmake/showoptions.cmake @@ -1,7 +1,7 @@ # output generic information about the core and buildtype chosen message("") message("* TrinityCore revision : ${rev_hash} ${rev_date} (${rev_branch} branch)") -if(UNIX) +if(NOT "${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild") message("* TrinityCore buildtype : ${CMAKE_BUILD_TYPE}") endif() message("") -- cgit v1.2.3