From 6328b3fd56fc0c97757917b957e39e3eaafa2281 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 28 Aug 2010 14:56:29 +0200 Subject: [PATCH] Changed: Tweaked CMake default flags to use identical settings as VC++ projects --- code/nel/CMakeModules/nel.cmake | 34 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/code/nel/CMakeModules/nel.cmake b/code/nel/CMakeModules/nel.cmake index c58b5a1a0..2f41e5d77 100644 --- a/code/nel/CMakeModules/nel.cmake +++ b/code/nel/CMakeModules/nel.cmake @@ -226,12 +226,25 @@ MACRO(NL_SETUP_BUILD) ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug") IF(WIN32) - SET(NL_DEBUG_CFLAGS "/EHa /Ob1 /Zi") - SET(NL_RELEASE_CFLAGS "/EHa /Zi /Ox /Ob2 /Oi /Ot /Oy /GT /GF /GS-") - SET(NL_RELEASEDEBUG_CFLAGS "/EHa /DNL_RELEASE_DEBUG /Zi /Ob2 /GF") + # don't use a /O[012x] flag if you want custom optimizations + SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-") + SET(SIZE_OPTIMIZATIONS "/O1") + # without inlining it's unusable, use custom optimizations again + SET(MIN_OPTIMIZATIONS "/Ob1") + + SET(CMAKE_C_FLAGS_DEBUG "/MDd /Zi /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS}") + SET(CMAKE_C_FLAGS_RELEASE "/MD /Zi /D NDEBUG ${SPEED_OPTIMIZATIONS}") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Zi /D NDEBUG ${SPEED_OPTIMIZATIONS}") + SET(CMAKE_C_FLAGS_MINSIZEREL "/MD /D NDEBUG ${SIZE_OPTIMIZATIONS}") + SET(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) + SET(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO}) + SET(CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_MINSIZEREL}) + + SET(NL_DEBUG_CFLAGS "/EHa /Zi") + SET(NL_RELEASE_CFLAGS "/EHa /Zi") SET(NL_DEBUG_LINK_FLAGS "/NODEFAULTLIB:msvcrt") SET(NL_RELEASE_LINK_FLAGS "/OPT:REF /OPT:ICF") - SET(NL_RELEASEDEBUG_LINK_FLAGS "/OPT:REF /OPT:ICF") ELSE(WIN32) SET(PLATFORM_CFLAGS "-ftemplate-depth-24 -D_REENTRANT -Wall -ansi -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-long-long -Wno-unused") IF(WITH_COVERAGE) @@ -243,7 +256,6 @@ MACRO(NL_SETUP_BUILD) ENDIF(NOT APPLE) SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -g") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6 -g") - SET(NL_RELEASEDEBUG_CFLAGS "-DNL_RELEASE_DEBUG -g -finline-functions -O3 ") SET(NL_NONE_CFLAGS "-DNL_RELEASE -g -finline-functions -O2 ") ENDIF(WIN32) @@ -286,14 +298,14 @@ MACRO(NL_SETUP_BUILD_FLAGS) SET(CMAKE_LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE} ${NL_RELEASE_LINK_FLAGS} ${PLATFORM_LINKFLAGS} ") ## RelWithDebInfo - SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${NL_RELEASEDEBUG_CFLAGS} ${PLATFORM_CFLAGS} ") - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${NL_RELEASEDEBUG_CFLAGS} ${PLATFORM_CFLAGS} ") - SET(CMAKE_LINK_FLAGS_RELWITHDEBINFO "${CMAKE_LINK_FLAGS_RELWITHDEBINFO} ${NL_RELEASEDEBUG_LINK_FLAGS} ${PLATFORM_LINKFLAGS} ") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${NL_RELEASE_CFLAGS} ${PLATFORM_CFLAGS} ") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${NL_RELEASE_CFLAGS} ${PLATFORM_CFLAGS} ") + SET(CMAKE_LINK_FLAGS_RELWITHDEBINFO "${CMAKE_LINK_FLAGS_RELWITHDEBINFO} ${NL_RELEASE_LINK_FLAGS} ${PLATFORM_LINKFLAGS} ") ## MinSizeRel - SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${NL_RELEASEDEBUG_CFLAGS} ${PLATFORM_CFLAGS} ") - SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${NL_RELEASEDEBUG_CFLAGS} ${PLATFORM_CFLAGS} ") - SET(CMAKE_LINK_FLAGS_MINSIZEREL "${CMAKE_LINK_FLAGS_MINSIZEREL} ${NL_RELEASEDEBUG_LINK_CFLAGS} ${PLATFORM_LINKFLAGS} ") + SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${NL_RELEASE_CFLAGS} ${PLATFORM_CFLAGS} ") + SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${NL_RELEASE_CFLAGS} ${PLATFORM_CFLAGS} ") + SET(CMAKE_LINK_FLAGS_MINSIZEREL "${CMAKE_LINK_FLAGS_MINSIZEREL} ${NL_RELEASE_LINK_CFLAGS} ${PLATFORM_LINKFLAGS} ") ENDMACRO(NL_SETUP_BUILD_FLAGS) MACRO(NL_SETUP_PREFIX_PATHS)