cmake: move -DNDEBUG to global option

This commit is contained in:
Gregory Hainaut 2014-12-15 19:29:05 +01:00
parent a99f3ea321
commit 66d7aa75e2
17 changed files with 34 additions and 51 deletions

View File

@ -154,7 +154,7 @@ endif()
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug|Devel|Release") if(NOT CMAKE_BUILD_TYPE MATCHES "Debug|Devel|Release")
set(CMAKE_BUILD_TYPE Devel) set(CMAKE_BUILD_TYPE Devel)
message(STATUS "BuildType set to ${CMAKE_BUILD_TYPE} by default") message(STATUS "BuildType set to ${CMAKE_BUILD_TYPE} by default")
endif(NOT CMAKE_BUILD_TYPE MATCHES "Debug|Devel|Release") endif()
# Initially strip was disabled on release build but it is not stackstrace friendly! # Initially strip was disabled on release build but it is not stackstrace friendly!
# It only cost several MB so disbable it by default # It only cost several MB so disbable it by default
@ -228,10 +228,12 @@ if (USE_CLANG)
set(COMMON_FLAG "${COMMON_FLAG} -no-integrated-as") set(COMMON_FLAG "${COMMON_FLAG} -no-integrated-as")
endif() endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel") if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(DEBUG_FLAG "-g") set(DEBUG_FLAG "-g")
else() elseif(CMAKE_BUILD_TYPE MATCHES "Devel")
set(DEBUG_FLAG "") set(DEBUG_FLAG "-g -DNDEBUG")
elseif(CMAKE_BUILD_TYPE MATCHES "Release")
set(DEBUG_FLAG "-DNDEBUG")
endif() endif()
if (USE_ASAN) if (USE_ASAN)

View File

@ -13,6 +13,17 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
// Avoid the following gcc error:
// Exceptions.cpp:133: error: inlining failed in call to always_inline void pxOnAssert(const DiagnosticOrigin&, const char*): function not considered for inlining
// DEVASSERT_INLINE void pxOnAssert( const DiagnosticOrigin& origin, const char* msg)
// Exceptions.cpp:141: error: called from here
// pxOnAssert( origin, WX_STR(msg) ); // wc_str ???
//
// Feel free to provide a better fix
#if defined(__linux__) && defined(NDEBUG)
#undef NDEBUG
#endif
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include <wx/app.h> #include <wx/app.h>

View File

@ -13,10 +13,10 @@ endif(NOT TOP_CMAKE_WAS_SOURCED)
# set common flags # set common flags
set(CommonFlags set(CommonFlags
# GCC-4.6 crash pcsx2 during the binding of plugins at startup... # GCC-4.6 crash pcsx2 during the binding of plugins at startup...
# Disable this optimization for the moment # Disable this optimization for the moment
-fno-omit-frame-pointer -fno-omit-frame-pointer
# END GCC-4.6 # END GCC-4.6
-fno-strict-aliasing -fno-strict-aliasing
-Wno-parentheses -Wno-parentheses
@ -24,6 +24,7 @@ set(CommonFlags
-Wno-char-subscripts # only impact svu which is deprecated -Wno-char-subscripts # only impact svu which is deprecated
-Wno-missing-braces -Wno-missing-braces
#-Wno-ignored-attributes # don't remember why I put here but it is pure C option, therefore it complains for nothings on cpp files #-Wno-ignored-attributes # don't remember why I put here but it is pure C option, therefore it complains for nothings on cpp files
-DWX_PRECOMP
) )
# set optimization flags # set optimization flags
@ -48,7 +49,7 @@ set(OptimizationFlags
-fpeephole2 -fpeephole2
-fregmove -fregmove
-freorder-blocks -freorder-blocks
-freorder-functions -freorder-functions
-frerun-cse-after-loop -frerun-cse-after-loop
-fsched-interblock -fsched-interblock
-fsched-spec -fsched-spec
@ -69,52 +70,35 @@ set(OptimizationFlags
#Clang doesn't support a few common flags that GCC does. #Clang doesn't support a few common flags that GCC does.
if(NOT USE_CLANG) if(NOT USE_CLANG)
set(pcsx2FinalFlags set(pcsx2FinalFlags ${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse)
${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse endif()
)
endif(NOT USE_CLANG)
# Debug - Build # Debug - Build
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(Output pcsx2-dbg) set(Output pcsx2-dbg)
set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG)
set(pcsx2FinalFlags elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
${pcsx2FinalFlags}
${CommonFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG -DWX_PRECOMP
)
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
# Devel - Build
if(CMAKE_BUILD_TYPE STREQUAL Devel)
set(Output pcsx2-dev) set(Output pcsx2-dev)
set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD)
set(pcsx2FinalFlags elseif(CMAKE_BUILD_TYPE STREQUAL Release)
${pcsx2FinalFlags}
${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD -DWX_PRECOMP -DNDEBUG
)
endif(CMAKE_BUILD_TYPE STREQUAL Devel)
# Release - Build
if(CMAKE_BUILD_TYPE STREQUAL Release)
set(Output pcsx2) set(Output pcsx2)
set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} ${OptimizationFlags})
set(pcsx2FinalFlags endif()
${pcsx2FinalFlags}
${CommonFlags} ${OptimizationFlags} -DWX_PRECOMP -DNDEBUG
)
endif(CMAKE_BUILD_TYPE STREQUAL Release)
if(XDG_STD) if(XDG_STD)
set(pcsx2FinalFlags set(pcsx2FinalFlags
${pcsx2FinalFlags} ${pcsx2FinalFlags}
-DXDG_STD -DXDG_STD
) )
endif(XDG_STD) endif()
# In package mode always use pcsx2 # In package mode always use pcsx2
if(PACKAGE_MODE) if(PACKAGE_MODE)
set(Output pcsx2) set(Output pcsx2)
endif(PACKAGE_MODE) endif()
# Main pcsx2 source # Main pcsx2 source
set(pcsx2Sources set(pcsx2Sources
@ -666,7 +650,7 @@ if(Linux)
set(Platform set(Platform
${pcsx2LinuxSources} ${pcsx2LinuxSources}
${pcsx2LinuxHeaders}) ${pcsx2LinuxHeaders})
endif(Linux) endif(Linux)
# Windows # Windows
if(Windows) if(Windows)
@ -679,7 +663,7 @@ endif(Windows)
if(MacOSX) if(MacOSX)
set(Platform set(Platform
) )
endif(MacOSX) endif(MacOSX)
set(pcsx2FinalSources set(pcsx2FinalSources
${Common} ${Common}
@ -719,6 +703,6 @@ endforeach()
# See issue: 1233 # See issue: 1233
if(PACKAGE_MODE) if(PACKAGE_MODE)
SET_SOURCE_FILES_PROPERTIES(gui/AppConfig.cpp PROPERTIES COMPILE_FLAGS "-Wp,-ansi,-U__STRICT_ANSI__") SET_SOURCE_FILES_PROPERTIES(gui/AppConfig.cpp PROPERTIES COMPILE_FLAGS "-Wp,-ansi,-U__STRICT_ANSI__")
endif(PACKAGE_MODE) endif(PACKAGE_MODE)
add_pcsx2_executable(${Output} "${pcsx2FinalSources}" "${pcsx2FinalLibs}" "${pcsx2FinalFlags}") add_pcsx2_executable(${Output} "${pcsx2FinalSources}" "${pcsx2FinalLibs}" "${pcsx2FinalFlags}")

View File

@ -11,7 +11,6 @@ set(Output CDVDiso)
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -9,7 +9,6 @@ set(CommonFlags
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
-fomit-frame-pointer -fomit-frame-pointer
) )

View File

@ -11,7 +11,6 @@ set(Output CDVDnull)
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -20,7 +20,6 @@ set(CommonFlags
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )

View File

@ -11,7 +11,6 @@ set(Output GSnull)
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -10,7 +10,6 @@ set(Output PADnull)
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -11,7 +11,6 @@ set(Output SPU2null)
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -11,7 +11,6 @@ set(Output USBnull-0.7.0)
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -11,7 +11,6 @@ set(Output dev9null-0.5.0)
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -11,7 +11,6 @@ set(Output onepad-1.1.0)
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -17,7 +17,6 @@ set(Output spu2x-2.0.0)
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -11,7 +11,6 @@ set(Output zerospu2)
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -28,7 +28,6 @@ set(CommonFlags
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
#Clang doesn't support a few common flags that GCC does. #Clang doesn't support a few common flags that GCC does.

View File

@ -19,7 +19,6 @@ set(CommonFlags
set(OptimizationFlags set(OptimizationFlags
-O2 -O2
-DNDEBUG
) )
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)