Add new CMake options

Add options for IsRetail() and IsCert().
This commit is contained in:
Kawe Mazidjatari 2023-08-21 20:40:05 +02:00
parent c8752420a0
commit a44b38eb15
2 changed files with 22 additions and 7 deletions

View File

@ -69,7 +69,7 @@ macro( add_module MODULE_TYPE MODULE_NAME REUSE_PCH FOLDER_NAME WARNINGS_AS_ERRO
set_target_properties( ${MODULE_NAME} PROPERTIES FOLDER ${FOLDER_NAME} )
if( ${GLOBAL_WARNINGS_AS_ERRORS} )
if( ${OPTION_WARNINGS_AS_ERRORS} )
warnings_as_errors( ${PROJECT_NAME} ${WARNINGS_AS_ERRORS} )
endif()

View File

@ -20,11 +20,14 @@ macro( apply_project_settings )
)
# Some thirdparty code have Warnings as Errors disabled; this option won't override those.
option( GLOBAL_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON )
option( ENABLE_LTCG "Enable link-time code generation (significantly increases compile times)" OFF )
option( OPTION_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON )
option( OPTION_LTCG "Enable link-time code generation (significantly increases compile times)" OFF )
set( GAMEDLL_OPTION "GAMEDLL_S3" CACHE STRING "Game DLL version" )
set_property( CACHE GAMEDLL_OPTION PROPERTY STRINGS
option( OPTION_CERTAIN "This build is certain; debug statements (such as DevMsg(...)) will NOT be compiled" OFF )
option( OPTION_RETAIL "This build is retail; enable this among with 'OPTION_CERTAIN' to form a release build" OFF )
set( OPTION_GAMEDLL "GAMEDLL_S3" CACHE STRING "Game DLL version" )
set_property( CACHE OPTION_GAMEDLL PROPERTY STRINGS
"GAMEDLL_S0"
"GAMEDLL_S1"
"GAMEDLL_S2"
@ -38,9 +41,21 @@ macro( apply_project_settings )
"SPDLOG_NO_EXCEPTIONS"
"CURL_STATICLIB"
"PLATFORM_64BITS" # Target is 64bits only.
"${GAMEDLL_OPTION}"
"${OPTION_GAMEDLL}"
)
if( ${OPTION_CERTAIN} )
add_compile_definitions(
"_CERT"
)
endif()
if( ${OPTION_RETAIL} )
add_compile_definitions(
"_RETAIL"
)
endif()
# Set settings for Debug configuration
add_compile_options(
$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<CONFIG:Debug>>:/MTd>
@ -61,7 +76,7 @@ macro( apply_project_settings )
$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<CONFIG:Release>>:/EHsc>
)
if( ${ENABLE_LTCG} )
if( ${OPTION_LTCG} )
add_compile_options(
$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<CONFIG:Profile>>:/GL>
$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<CONFIG:Release>>:/GL>