diff options
author | kwolekr <kwolekr@minetest.net> | 2015-01-18 22:30:11 -0500 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-01-18 22:30:11 -0500 |
commit | e36681101efdfec3ed9cf9d70f7c5296c4124cd6 (patch) | |
tree | 995ec343ee3a682c631deebbfce33d05dda0f1e5 /src | |
parent | 976d0b2caa3f69c0b7c40e98517073e08e87774d (diff) | |
download | minetest-e36681101efdfec3ed9cf9d70f7c5296c4124cd6.tar.gz minetest-e36681101efdfec3ed9cf9d70f7c5296c4124cd6.tar.bz2 minetest-e36681101efdfec3ed9cf9d70f7c5296c4124cd6.zip |
Add SemiDebug (-O1 with debug symbols) build mode and do not optimize Debug at all
Add -Wall to Debug modes for all compilers and -Wabi for non-MSVC
Use /Ox for MSVC Release mode (potentially higher optimization than /O2)
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4c71d418d..77977db9b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,6 +4,24 @@ cmake_minimum_required( VERSION 2.6 ) INCLUDE(CheckCSourceRuns) INCLUDE(CheckIncludeFiles) +# Add custom SemiDebug build mode +set(CMAKE_CXX_FLAGS_SEMIDEBUG "-O1 -g -Wall -Wabi" CACHE STRING + "Flags used by the C++ compiler during semidebug builds." + FORCE +) +set(CMAKE_C_FLAGS_SEMIDEBUG "-O1 -g -Wall -pedantic" CACHE STRING + "Flags used by the C compiler during semidebug builds." + FORCE +) +mark_as_advanced( + CMAKE_CXX_FLAGS_SEMIDEBUG + CMAKE_C_FLAGS_SEMIDEBUG +) +set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING + "Choose the type of build. Options are: None Debug SemiDebug RelWithDebInfo MinSizeRel." + FORCE +) + # Set some random things default to not being visible in the GUI mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH) @@ -608,13 +626,15 @@ if(MSVC) # Visual Studio # EHa enables SEH exceptions (used for catching segfaults) - set(CMAKE_CXX_FLAGS_RELEASE "/EHa /O2 /Ob2 /Oi /Ot /Oy /GL /FD /MT /GS- /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP") + set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /Ob2 /Oi /Ot /Oy /GL /FD /MT /GS- /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP") #set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /NODEFAULTLIB:\"libcmtd.lib\" /NODEFAULTLIB:\"libcmt.lib\"") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG") + set(CMAKE_CXX_FLAGS_SEMIDEBUG "/MDd /Zi /Ob0 /O1 /RTC1 /Wall") + # Debug build doesn't catch exceptions by itself # Add some optimizations because otherwise it's VERY slow - set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1") + set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1 /Wall") # Flags for C files (sqlite) # /MT = Link statically with standard library stuff @@ -658,7 +678,8 @@ else() else() set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer") endif(APPLE) - set(CMAKE_CXX_FLAGS_DEBUG "-g -O1 -Wall ${WARNING_FLAGS} ${OTHER_FLAGS}") + set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 -Wall -Wabi ${WARNING_FLAGS} ${OTHER_FLAGS}") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wabi ${WARNING_FLAGS} ${OTHER_FLAGS}") if(USE_GPROF) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") |