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")
set(CMAKE_BUILD_TYPE Devel)
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!
# 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")
endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel")
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(DEBUG_FLAG "-g")
else()
set(DEBUG_FLAG "")
elseif(CMAKE_BUILD_TYPE MATCHES "Devel")
set(DEBUG_FLAG "-g -DNDEBUG")
elseif(CMAKE_BUILD_TYPE MATCHES "Release")
set(DEBUG_FLAG "-DNDEBUG")
endif()
if (USE_ASAN)

View File

@ -13,6 +13,17 @@
* 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 <wx/app.h>

View File

@ -13,10 +13,10 @@ endif(NOT TOP_CMAKE_WAS_SOURCED)
# set common flags
set(CommonFlags
set(CommonFlags
# GCC-4.6 crash pcsx2 during the binding of plugins at startup...
# Disable this optimization for the moment
-fno-omit-frame-pointer
-fno-omit-frame-pointer
# END GCC-4.6
-fno-strict-aliasing
-Wno-parentheses
@ -24,6 +24,7 @@ set(CommonFlags
-Wno-char-subscripts # only impact svu which is deprecated
-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
-DWX_PRECOMP
)
# set optimization flags
@ -48,7 +49,7 @@ set(OptimizationFlags
-fpeephole2
-fregmove
-freorder-blocks
-freorder-functions
-freorder-functions
-frerun-cse-after-loop
-fsched-interblock
-fsched-spec
@ -69,52 +70,35 @@ set(OptimizationFlags
#Clang doesn't support a few common flags that GCC does.
if(NOT USE_CLANG)
set(pcsx2FinalFlags
${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse
)
endif(NOT USE_CLANG)
set(pcsx2FinalFlags ${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse)
endif()
# Debug - Build
if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(Output pcsx2-dbg)
set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG)
set(pcsx2FinalFlags
${pcsx2FinalFlags}
${CommonFlags} -DPCSX2_DEVBUILD -DPCSX2_DEBUG -DWX_PRECOMP
)
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
# Devel - Build
if(CMAKE_BUILD_TYPE STREQUAL Devel)
elseif(CMAKE_BUILD_TYPE STREQUAL Devel)
set(Output pcsx2-dev)
set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD)
set(pcsx2FinalFlags
${pcsx2FinalFlags}
${CommonFlags} ${OptimizationFlags} -DPCSX2_DEVBUILD -DWX_PRECOMP -DNDEBUG
)
endif(CMAKE_BUILD_TYPE STREQUAL Devel)
# Release - Build
if(CMAKE_BUILD_TYPE STREQUAL Release)
elseif(CMAKE_BUILD_TYPE STREQUAL Release)
set(Output pcsx2)
set(pcsx2FinalFlags ${pcsx2FinalFlags} ${CommonFlags} ${OptimizationFlags})
set(pcsx2FinalFlags
${pcsx2FinalFlags}
${CommonFlags} ${OptimizationFlags} -DWX_PRECOMP -DNDEBUG
)
endif(CMAKE_BUILD_TYPE STREQUAL Release)
endif()
if(XDG_STD)
set(pcsx2FinalFlags
${pcsx2FinalFlags}
-DXDG_STD
)
endif(XDG_STD)
endif()
# In package mode always use pcsx2
if(PACKAGE_MODE)
set(Output pcsx2)
endif(PACKAGE_MODE)
endif()
# Main pcsx2 source
set(pcsx2Sources
@ -666,7 +650,7 @@ if(Linux)
set(Platform
${pcsx2LinuxSources}
${pcsx2LinuxHeaders})
endif(Linux)
endif(Linux)
# Windows
if(Windows)
@ -679,7 +663,7 @@ endif(Windows)
if(MacOSX)
set(Platform
)
endif(MacOSX)
endif(MacOSX)
set(pcsx2FinalSources
${Common}
@ -719,6 +703,6 @@ endforeach()
# See issue: 1233
if(PACKAGE_MODE)
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}")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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