From a66c911fed78645ba1581448f78b1ec88f632a42 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sun, 21 Feb 2016 16:17:10 +0100 Subject: [PATCH] cmake: factorize debug/dev define --- cmake/BuildParameters.cmake | 4 ++-- common/src/Utilities/CMakeLists.txt | 32 ++-------------------------- common/src/x86emitter/CMakeLists.txt | 30 ++------------------------ pcsx2/CMakeLists.txt | 17 ++------------- plugins/GSdx/CMakeLists.txt | 11 +--------- plugins/LilyPad/CMakeLists.txt | 6 +----- 6 files changed, 10 insertions(+), 90 deletions(-) diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index 88c31799d3..96746ab616 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -272,9 +272,9 @@ else() endif() if(CMAKE_BUILD_TYPE MATCHES "Debug") - set(DEBUG_FLAG "${DBG}") + set(DEBUG_FLAG "${DBG} -DPCSX2_DEVBUILD -DPCSX2_DEBUG -D_DEBUG") elseif(CMAKE_BUILD_TYPE MATCHES "Devel") - set(DEBUG_FLAG "${DBG} -DNDEBUG") + set(DEBUG_FLAG "${DBG} -DNDEBUG -DPCSX2_DEVBUILD -D_DEVEL") elseif(CMAKE_BUILD_TYPE MATCHES "Release") set(DEBUG_FLAG "-DNDEBUG") endif() diff --git a/common/src/Utilities/CMakeLists.txt b/common/src/Utilities/CMakeLists.txt index 2bd4503e78..ef41abe6d9 100644 --- a/common/src/Utilities/CMakeLists.txt +++ b/common/src/Utilities/CMakeLists.txt @@ -8,39 +8,11 @@ endif(NOT TOP_CMAKE_WAS_SOURCED) set(Output Utilities) -set(CommonFlags +set(CommonFlags -fno-strict-aliasing ) -# Debug - Build -if(CMAKE_BUILD_TYPE STREQUAL Debug) - - # add defines - set(UtilitiesFinalFlags - ${UtilitiesFinalFlags} - ${CommonFlags} -DPCSX2_DEBUG -DPCSX2_DEVBUILD - ) -endif(CMAKE_BUILD_TYPE STREQUAL Debug) - -# Devel - Build -if(CMAKE_BUILD_TYPE STREQUAL Devel) - - # add defines - set(UtilitiesFinalFlags - ${UtilitiesFinalFlags} - ${CommonFlags} -DPCSX2_DEVBUILD - ) -endif(CMAKE_BUILD_TYPE STREQUAL Devel) - -# Release - Build -if(CMAKE_BUILD_TYPE STREQUAL Release) - - # add defines - set(UtilitiesFinalFlags - ${UtilitiesFinalFlags} - ${CommonFlags} - ) -endif(CMAKE_BUILD_TYPE STREQUAL Release) +set(UtilitiesFinalFlags ${CommonFlags}) # variable with all sources of this library set(UtilitiesSources diff --git a/common/src/x86emitter/CMakeLists.txt b/common/src/x86emitter/CMakeLists.txt index 5fab97c9b1..a8ff887461 100644 --- a/common/src/x86emitter/CMakeLists.txt +++ b/common/src/x86emitter/CMakeLists.txt @@ -8,37 +8,11 @@ endif(NOT TOP_CMAKE_WAS_SOURCED) set(Output x86emitter) -set(CommonFlags +set(CommonFlags -fno-strict-aliasing ) -# Debug - Build -if(CMAKE_BUILD_TYPE STREQUAL Debug) - # add defines - set(x86emitterFinalFlags - ${x86emitterFinalFlags} - ${CommonFlags} -DPCSX2_DEBUG -DPCSX2_DEVBUILD - ) -endif(CMAKE_BUILD_TYPE STREQUAL Debug) - -# Devel - Build -if(CMAKE_BUILD_TYPE STREQUAL Devel) - # add defines - set(x86emitterFinalFlags - ${x86emitterFinalFlags} - ${CommonFlags} -DPCSX2_DEVBUILD - ) -endif(CMAKE_BUILD_TYPE STREQUAL Devel) - -# Release - Build -if(CMAKE_BUILD_TYPE STREQUAL Release) - - # add defines - set(x86emitterFinalFlags - ${x86emitterFinalFlags} - ${CommonFlags} - ) -endif(CMAKE_BUILD_TYPE STREQUAL Release) +set(x86emitterFinalFlags ${CommonFlags}) # variable with all sources of this library set(x86emitterSources diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 728a28ea47..5aa6406ac0 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -30,23 +30,10 @@ else() set(pcsx2FinalFlags "") endif() -# Debug - Build -if(CMAKE_BUILD_TYPE STREQUAL Debug) - set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG) - -elseif(CMAKE_BUILD_TYPE STREQUAL Devel) - set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} -DPCSX2_DEVBUILD) - -elseif(CMAKE_BUILD_TYPE STREQUAL Release) - set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags}) - -endif() +set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags}) if(XDG_STD) - set(pcsx2FinalFlags - ${pcsx2FinalFlags} - -DXDG_STD - ) + set(pcsx2FinalFlags ${pcsx2FinalFlags} -DXDG_STD) endif() set(Output PCSX2) diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt index 92a3684f2f..55703500d0 100644 --- a/plugins/GSdx/CMakeLists.txt +++ b/plugins/GSdx/CMakeLists.txt @@ -17,16 +17,7 @@ set(CommonFlags -Wunused-variable # __dummy variable need to be investigated ) -if(CMAKE_BUILD_TYPE STREQUAL Debug) - set(GSdxFinalFlags ${GSdxFinalFlags} ${CommonFlags} -D_DEBUG) - -elseif(CMAKE_BUILD_TYPE STREQUAL Devel) - set(GSdxFinalFlags ${GSdxFinalFlags} ${CommonFlags} -D_DEVEL) - -elseif(CMAKE_BUILD_TYPE STREQUAL Release) - set(GSdxFinalFlags ${GSdxFinalFlags} ${CommonFlags} -W -Wno-unused-parameter) - -endif() +set(GSdxFinalFlags ${CommonFlags}) if(XDG_STD) set(GSdxFinalFlags ${GSdxFinalFlags} -DXDG_STD) diff --git a/plugins/LilyPad/CMakeLists.txt b/plugins/LilyPad/CMakeLists.txt index 199a3650f1..2a3584172c 100644 --- a/plugins/LilyPad/CMakeLists.txt +++ b/plugins/LilyPad/CMakeLists.txt @@ -9,11 +9,7 @@ endif() # plugin name set(Output LilyPad-0.11.0) -if(CMAKE_BUILD_TYPE STREQUAL Debug) - set(lilypadFinalFlags "-DPCSX2_DEBUG") -else() - set(lilypadFinalFlags "") -endif() +set(lilypadFinalFlags "") # lilypad sources set(lilypadSources