summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2014-12-21 05:18:12 -0200
committerGravatar Yuri Kunde Schlesner2014-12-21 21:26:51 -0200
commited8f32f03ef01f61f76b5c4dc02abd6f516cd4bb (patch)
treebd93a480ab1f678d1eadf9dff851e066d4f936e1
parentUpdate README.md (diff)
downloadyuzu-ed8f32f03ef01f61f76b5c4dc02abd6f516cd4bb.tar.gz
yuzu-ed8f32f03ef01f61f76b5c4dc02abd6f516cd4bb.tar.xz
yuzu-ed8f32f03ef01f61f76b5c4dc02abd6f516cd4bb.zip
CMake: Use improved optimization flags on MSVC
While not having a noticeable effect on CPU-bound applications, this change gives an about 30-50% increase in performance for games using the GPU.
-rw-r--r--CMakeLists.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 638b468a6..af53bda71 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,25 @@ else()
11 add_definitions(/D_CRT_SECURE_NO_WARNINGS) 11 add_definitions(/D_CRT_SECURE_NO_WARNINGS)
12 # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms) 12 # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
13 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 13 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
14
15 # Tweak optimization settings
16 # As far as I can tell, there's no way to override the CMake defaults while leaving user
17 # changes intact, so we'll just clobber everything and say sorry.
18 message(STATUS "Cache compiler flags ignored, please edit CMakeFiles.txt to change the flags.")
19 # /MD - Multi-threaded runtime
20 # /Ox - Full optimization
21 # /Oi - Use intrinsic functions
22 # /Oy- - Don't omit frame pointer
23 # /GR- - Disable RTTI
24 # /GS- - No stack buffer overflow checks
25 # /EHsc - C++-only exception handling semantics
26 set(optimization_flags "/MD /Ox /Oi /Oy- /DNDEBUG /GR- /GS- /EHsc")
27 # /Zi - Output debugging information
28 # /Zo - enahnced debug info for optimized builds
29 set(CMAKE_C_FLAGS_RELEASE "${optimization_flags} /Zi" CACHE STRING "" FORCE)
30 set(CMAKE_CXX_FLAGS_RELEASE "${optimization_flags} /Zi" CACHE STRING "" FORCE)
31 set(CMAKE_C_FLAGS_RELWITHDEBINFO "${optimization_flags} /Zi /Zo" CACHE STRING "" FORCE)
32 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${optimization_flags} /Zi /Zo" CACHE STRING "" FORCE)
14endif() 33endif()
15add_definitions(-DSINGLETHREADED) 34add_definitions(-DSINGLETHREADED)
16 35