diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake
index e1570045bc..0d4f76e7e1 100644
--- a/cmake/BuildParameters.cmake
+++ b/cmake/BuildParameters.cmake
@@ -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)
diff --git a/common/src/Utilities/Exceptions.cpp b/common/src/Utilities/Exceptions.cpp
index 65660d9f07..7272f9af6f 100644
--- a/common/src/Utilities/Exceptions.cpp
+++ b/common/src/Utilities/Exceptions.cpp
@@ -13,6 +13,17 @@
* If not, see .
*/
+// 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
diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt
index 970708bd52..eb702bddb9 100644
--- a/pcsx2/CMakeLists.txt
+++ b/pcsx2/CMakeLists.txt
@@ -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}")
diff --git a/plugins/CDVDiso/src/CMakeLists.txt b/plugins/CDVDiso/src/CMakeLists.txt
index e9173f937d..519c92a85b 100644
--- a/plugins/CDVDiso/src/CMakeLists.txt
+++ b/plugins/CDVDiso/src/CMakeLists.txt
@@ -11,7 +11,6 @@ set(Output CDVDiso)
set(OptimizationFlags
-O2
- -DNDEBUG
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
diff --git a/plugins/CDVDlinuz/Src/CMakeLists.txt b/plugins/CDVDlinuz/Src/CMakeLists.txt
index 35f77bf397..943780fc6b 100644
--- a/plugins/CDVDlinuz/Src/CMakeLists.txt
+++ b/plugins/CDVDlinuz/Src/CMakeLists.txt
@@ -9,7 +9,6 @@ set(CommonFlags
set(OptimizationFlags
-O2
- -DNDEBUG
-fomit-frame-pointer
)
diff --git a/plugins/CDVDnull/CMakeLists.txt b/plugins/CDVDnull/CMakeLists.txt
index 088a17b604..4fde2f7a9d 100644
--- a/plugins/CDVDnull/CMakeLists.txt
+++ b/plugins/CDVDnull/CMakeLists.txt
@@ -11,7 +11,6 @@ set(Output CDVDnull)
set(OptimizationFlags
-O2
- -DNDEBUG
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
diff --git a/plugins/GSdx/CMakeLists.txt b/plugins/GSdx/CMakeLists.txt
index ffafd0ce9e..88590449b6 100644
--- a/plugins/GSdx/CMakeLists.txt
+++ b/plugins/GSdx/CMakeLists.txt
@@ -20,7 +20,6 @@ set(CommonFlags
set(OptimizationFlags
-O2
- -DNDEBUG
)
diff --git a/plugins/GSnull/CMakeLists.txt b/plugins/GSnull/CMakeLists.txt
index 667b958f58..2216e17e1b 100644
--- a/plugins/GSnull/CMakeLists.txt
+++ b/plugins/GSnull/CMakeLists.txt
@@ -11,7 +11,6 @@ set(Output GSnull)
set(OptimizationFlags
-O2
- -DNDEBUG
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
diff --git a/plugins/PadNull/CMakeLists.txt b/plugins/PadNull/CMakeLists.txt
index 937386912e..acbe758c60 100644
--- a/plugins/PadNull/CMakeLists.txt
+++ b/plugins/PadNull/CMakeLists.txt
@@ -10,7 +10,6 @@ set(Output PADnull)
set(OptimizationFlags
-O2
- -DNDEBUG
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
diff --git a/plugins/SPU2null/CMakeLists.txt b/plugins/SPU2null/CMakeLists.txt
index d88c68e721..54095435b9 100644
--- a/plugins/SPU2null/CMakeLists.txt
+++ b/plugins/SPU2null/CMakeLists.txt
@@ -11,7 +11,6 @@ set(Output SPU2null)
set(OptimizationFlags
-O2
- -DNDEBUG
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
diff --git a/plugins/USBnull/CMakeLists.txt b/plugins/USBnull/CMakeLists.txt
index a101f8b969..c84890e449 100644
--- a/plugins/USBnull/CMakeLists.txt
+++ b/plugins/USBnull/CMakeLists.txt
@@ -11,7 +11,6 @@ set(Output USBnull-0.7.0)
set(OptimizationFlags
-O2
- -DNDEBUG
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
diff --git a/plugins/dev9null/CMakeLists.txt b/plugins/dev9null/CMakeLists.txt
index 3c938d1424..09d8bee498 100644
--- a/plugins/dev9null/CMakeLists.txt
+++ b/plugins/dev9null/CMakeLists.txt
@@ -11,7 +11,6 @@ set(Output dev9null-0.5.0)
set(OptimizationFlags
-O2
- -DNDEBUG
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
diff --git a/plugins/onepad/CMakeLists.txt b/plugins/onepad/CMakeLists.txt
index 892d25e3c2..6a12cd75cb 100644
--- a/plugins/onepad/CMakeLists.txt
+++ b/plugins/onepad/CMakeLists.txt
@@ -11,7 +11,6 @@ set(Output onepad-1.1.0)
set(OptimizationFlags
-O2
- -DNDEBUG
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
diff --git a/plugins/spu2-x/src/CMakeLists.txt b/plugins/spu2-x/src/CMakeLists.txt
index 018a370bc5..720c4ac9ed 100644
--- a/plugins/spu2-x/src/CMakeLists.txt
+++ b/plugins/spu2-x/src/CMakeLists.txt
@@ -17,7 +17,6 @@ set(Output spu2x-2.0.0)
set(OptimizationFlags
-O2
- -DNDEBUG
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
diff --git a/plugins/zerospu2/CMakeLists.txt b/plugins/zerospu2/CMakeLists.txt
index cee15aa3df..c3e3243249 100644
--- a/plugins/zerospu2/CMakeLists.txt
+++ b/plugins/zerospu2/CMakeLists.txt
@@ -11,7 +11,6 @@ set(Output zerospu2)
set(OptimizationFlags
-O2
- -DNDEBUG
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
diff --git a/plugins/zzogl-pg/opengl/CMakeLists.txt b/plugins/zzogl-pg/opengl/CMakeLists.txt
index 03424854d5..fe932468f9 100644
--- a/plugins/zzogl-pg/opengl/CMakeLists.txt
+++ b/plugins/zzogl-pg/opengl/CMakeLists.txt
@@ -28,7 +28,6 @@ set(CommonFlags
set(OptimizationFlags
-O2
- -DNDEBUG
)
#Clang doesn't support a few common flags that GCC does.
diff --git a/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt b/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt
index 0d430efb08..156189cce8 100644
--- a/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt
+++ b/plugins/zzogl-pg/opengl/ZeroGSShaders/CMakeLists.txt
@@ -19,7 +19,6 @@ set(CommonFlags
set(OptimizationFlags
-O2
- -DNDEBUG
)
if(CMAKE_BUILD_TYPE STREQUAL Debug)