Skip to content

Commit

Permalink
cmake: move -DNDEBUG to global option
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory38 committed Dec 20, 2014
1 parent a99f3ea commit 66d7aa7
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 51 deletions.
10 changes: 6 additions & 4 deletions cmake/BuildParameters.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions common/src/Utilities/Exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
50 changes: 17 additions & 33 deletions pcsx2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ 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
-Wstrict-aliasing # Allow to track strict aliasing issue.
-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
Expand All @@ -48,7 +49,7 @@ set(OptimizationFlags
-fpeephole2
-fregmove
-freorder-blocks
-freorder-functions
-freorder-functions
-frerun-cse-after-loop
-fsched-interblock
-fsched-spec
Expand All @@ -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
Expand Down Expand Up @@ -666,7 +650,7 @@ if(Linux)
set(Platform
${pcsx2LinuxSources}
${pcsx2LinuxHeaders})
endif(Linux)
endif(Linux)

# Windows
if(Windows)
Expand All @@ -679,7 +663,7 @@ endif(Windows)
if(MacOSX)
set(Platform
)
endif(MacOSX)
endif(MacOSX)

set(pcsx2FinalSources
${Common}
Expand Down Expand Up @@ -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}")
1 change: 0 additions & 1 deletion plugins/CDVDiso/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set(Output CDVDiso)

set(OptimizationFlags
-O2
-DNDEBUG
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down
1 change: 0 additions & 1 deletion plugins/CDVDlinuz/Src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ set(CommonFlags

set(OptimizationFlags
-O2
-DNDEBUG
-fomit-frame-pointer
)

Expand Down
1 change: 0 additions & 1 deletion plugins/CDVDnull/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set(Output CDVDnull)

set(OptimizationFlags
-O2
-DNDEBUG
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down
1 change: 0 additions & 1 deletion plugins/GSdx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ set(CommonFlags

set(OptimizationFlags
-O2
-DNDEBUG
)


Expand Down
1 change: 0 additions & 1 deletion plugins/GSnull/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set(Output GSnull)

set(OptimizationFlags
-O2
-DNDEBUG
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down
1 change: 0 additions & 1 deletion plugins/PadNull/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ set(Output PADnull)

set(OptimizationFlags
-O2
-DNDEBUG
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down
1 change: 0 additions & 1 deletion plugins/SPU2null/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set(Output SPU2null)

set(OptimizationFlags
-O2
-DNDEBUG
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down
1 change: 0 additions & 1 deletion plugins/USBnull/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set(Output USBnull-0.7.0)

set(OptimizationFlags
-O2
-DNDEBUG
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down
1 change: 0 additions & 1 deletion plugins/dev9null/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set(Output dev9null-0.5.0)

set(OptimizationFlags
-O2
-DNDEBUG
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down
1 change: 0 additions & 1 deletion plugins/onepad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set(Output onepad-1.1.0)

set(OptimizationFlags
-O2
-DNDEBUG
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down
1 change: 0 additions & 1 deletion plugins/spu2-x/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ set(Output spu2x-2.0.0)

set(OptimizationFlags
-O2
-DNDEBUG
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down
1 change: 0 additions & 1 deletion plugins/zerospu2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ set(Output zerospu2)

set(OptimizationFlags
-O2
-DNDEBUG
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down
1 change: 0 additions & 1 deletion plugins/zzogl-pg/opengl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ set(CommonFlags

set(OptimizationFlags
-O2
-DNDEBUG
)

#Clang doesn't support a few common flags that GCC does.
Expand Down
1 change: 0 additions & 1 deletion plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ set(CommonFlags

set(OptimizationFlags
-O2
-DNDEBUG
)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
Expand Down

0 comments on commit 66d7aa7

Please sign in to comment.