diff --git a/CMakeLists.txt b/CMakeLists.txt index c02c96840..cc27b2b85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,9 @@ option(CITRA_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" OFF) option(ENABLE_QT "Enable the Qt frontend" ON) 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) message(STATUS "Copying pre-commit hook") file(COPY hooks/pre-commit @@ -107,10 +110,14 @@ else() set(CMAKE_C_FLAGS_DEBUG "/Od /MDd" 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 # /GS- - No stack buffer overflow checks # /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_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "" FORCE)