Added Operation Level, allows to use O3 optimizations instead of O2 for release builds

This commit is contained in:
FernandoS27 2016-12-10 19:41:21 -05:00
parent a5cd925a95
commit 47f3711dbf

View File

@ -40,6 +40,9 @@ option(CITRA_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" OFF)
option(ENABLE_QT "Enable the Qt frontend" ON) option(ENABLE_QT "Enable the Qt frontend" ON)
option(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" OFF) option(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" OFF)
# uses O3 instead of O2
option(ENABLE_HIGH_OP "Enable highest optimizations possible" OFF)
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit) if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit)
message(STATUS "Copying pre-commit hook") message(STATUS "Copying pre-commit hook")
file(COPY hooks/pre-commit file(COPY hooks/pre-commit
@ -107,10 +110,14 @@ else()
set(CMAKE_C_FLAGS_DEBUG "/Od /MDd" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_DEBUG "/Od /MDd" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "" FORCE)
set(OP_LEVEL "/O2")
if (ENABLE_HIGH_OP)
set(OP_LEVEL "/O3")
# /O2 - Optimization level 2 # /O2 - Optimization level 2
# /GS- - No stack buffer overflow checks # /GS- - No stack buffer overflow checks
# /MD - Multi-threaded runtime DLL # /MD - Multi-threaded runtime DLL
set(CMAKE_C_FLAGS_RELEASE "/O2 /GS- /MD" CACHE STRING "" FORCE) set(CMAKE_C_FLAGS_RELEASE "${OP_LEVEL} /GS- /MD" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "" FORCE) set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "" FORCE)