mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-14 07:45:06 +00:00
cmake: Additional optimization options
This commit is contained in:
parent
ebc50dcefe
commit
844379f761
1 changed files with 28 additions and 0 deletions
|
@ -163,6 +163,34 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(${PropertyPrefix}BUILD_SIZE FALSE CACHE BOOL "Focus on small size instead of maximum performance in release builds.")
|
||||||
|
set(${PropertyPrefix}BUILD_SPEED TRUE CACHE BOOL "Focus on maximum performance instead of small size in release builds.")
|
||||||
|
if(${PropertyPrefix}BUILD_SIZE)
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||||
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
|
set(_EXTRA_FLAGS "/O1 /Os /GF /GS- /Zp1 /arch:AVX /GR- /GL /LTCG:incremental /OPT:ICF")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${_EXTRA_FLAGS}")
|
||||||
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${_EXTRA_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${_EXTRA_FLAGS}")
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${_EXTRA_FLAGS}")
|
||||||
|
unset(_EXTRA_FLAGS)
|
||||||
|
endif()
|
||||||
|
elseif(${PropertyPrefix}BUILD_SPEED)
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||||
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
|
set(_EXTRA_FLAGS "/O2 /Oi /Ot /Oy /GF /GS- /Zp4 /Qpar /arch:AVX /GR- /GL /LTCG:incremental /OPT:ICF")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${_EXTRA_FLAGS}")
|
||||||
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${_EXTRA_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${_EXTRA_FLAGS}")
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${_EXTRA_FLAGS}")
|
||||||
|
unset(_EXTRA_FLAGS)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# CMake / Compiler Dependencies
|
# CMake / Compiler Dependencies
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
Loading…
Reference in a new issue