summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-07-09 16:07:37 -0300
committerGravatar Yuri Kunde Schlesner2015-07-09 16:10:08 -0300
commita24a0fbd8ac27398b2ae7fa2e496d512a0d96ea7 (patch)
tree04c6063798a2845a36d3d6ec03e22efb82b2f2f6
parentMerge pull request #906 from aroulin/loader-format-specifier-warning (diff)
downloadyuzu-a24a0fbd8ac27398b2ae7fa2e496d512a0d96ea7.tar.gz
yuzu-a24a0fbd8ac27398b2ae7fa2e496d512a0d96ea7.tar.xz
yuzu-a24a0fbd8ac27398b2ae7fa2e496d512a0d96ea7.zip
CMake: Fix Debug build configuration in MSVC
Debug was missing compiler flags, causing MSVC to default it to building with optimizations enabled (making for a not very useful binary for actual debugging...). Additionally, the variables were re-organized to remove some redundancy, the old Release build type was removed, and RelWithDebInfo was renamed to take its place instead.
-rw-r--r--CMakeLists.txt32
1 files changed, 17 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6805ebed8..3658ef48e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,32 +22,34 @@ else()
22 22
23 # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms) 23 # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
24 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 24 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
25 set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo CACHE STRING "" FORCE) 25 set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)
26 26
27 # Tweak optimization settings 27 # Tweak optimization settings
28 # As far as I can tell, there's no way to override the CMake defaults while leaving user 28 # As far as I can tell, there's no way to override the CMake defaults while leaving user
29 # changes intact, so we'll just clobber everything and say sorry. 29 # changes intact, so we'll just clobber everything and say sorry.
30 message(STATUS "Cache compiler flags ignored, please edit CMakeLists.txt to change the flags.") 30 message(STATUS "Cache compiler flags ignored, please edit CMakeLists.txt to change the flags.")
31 # /O2 - Optimization level 2 31
32 # /Oy- - Don't omit frame pointer 32 # /W3 - Level 3 warnings
33 # /GR- - Disable RTTI
34 # /GS- - No stack buffer overflow checks
35 # /EHsc - C++-only exception handling semantics
36 set(optimization_flags "/O2 /Oy- /GR- /GS- /EHsc")
37 # /MP - Multi-threaded compilation 33 # /MP - Multi-threaded compilation
38 # /Zi - Output debugging information 34 # /Zi - Output debugging information
39 # /Zo - enahnced debug info for optimized builds 35 # /Zo - enahnced debug info for optimized builds
36 set(CMAKE_C_FLAGS "/W3 /MP /Zi /Zo" CACHE STRING "" FORCE)
37 # /GR- - Disable RTTI
38 # /EHsc - C++-only exception handling semantics
39 set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} /GR- /EHsc" CACHE STRING "" FORCE)
40
40 # /MDd - Multi-threaded Debug Runtime DLL 41 # /MDd - Multi-threaded Debug Runtime DLL
41 set(CMAKE_C_FLAGS_DEBUG "/MP /MDd /Zi" CACHE STRING "" FORCE) 42 set(CMAKE_C_FLAGS_DEBUG "/Od /MDd" CACHE STRING "" FORCE)
42 set(CMAKE_CXX_FLAGS_DEBUG "/MP /MDd /Zi" CACHE STRING "" FORCE) 43 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "" FORCE)
44
45 # /O2 - Optimization level 2
46 # /GS- - No stack buffer overflow checks
43 # /MD - Multi-threaded runtime DLL 47 # /MD - Multi-threaded runtime DLL
44 set(CMAKE_C_FLAGS_RELEASE "${optimization_flags} /MP /MD" CACHE STRING "" FORCE) 48 set(CMAKE_C_FLAGS_RELEASE "/O2 /GS- /MD" CACHE STRING "" FORCE)
45 set(CMAKE_CXX_FLAGS_RELEASE "${optimization_flags} /MP /MD" CACHE STRING "" FORCE) 49 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
46 set(CMAKE_C_FLAGS_RELWITHDEBINFO "${optimization_flags} /MP /MD /Zi /Zo" CACHE STRING "" FORCE)
47 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${optimization_flags} /MP /MD /Zi /Zo" CACHE STRING "" FORCE)
48 50
49 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "" FORCE) 51 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "" FORCE)
50 set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG" CACHE STRING "" FORCE) 52 set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG" CACHE STRING "" FORCE)
51endif() 53endif()
52 54
53add_definitions(-DSINGLETHREADED) 55add_definitions(-DSINGLETHREADED)