From a44b38eb155841bb6e6c1ea760f56d2d8dad214a Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 21 Aug 2023 20:40:05 +0200 Subject: [PATCH] Add new CMake options Add options for IsRetail() and IsCert(). --- r5dev/cmake/Macros.cmake | 2 +- r5dev/cmake/Options.cmake | 27 +++++++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/r5dev/cmake/Macros.cmake b/r5dev/cmake/Macros.cmake index 5b29f95a..f2a76cee 100644 --- a/r5dev/cmake/Macros.cmake +++ b/r5dev/cmake/Macros.cmake @@ -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() diff --git a/r5dev/cmake/Options.cmake b/r5dev/cmake/Options.cmake index 3570c20f..2ed3b759 100644 --- a/r5dev/cmake/Options.cmake +++ b/r5dev/cmake/Options.cmake @@ -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( $<$,$>:/MTd> @@ -61,7 +76,7 @@ macro( apply_project_settings ) $<$,$>:/EHsc> ) - if( ${ENABLE_LTCG} ) + if( ${OPTION_LTCG} ) add_compile_options( $<$,$>:/GL> $<$,$>:/GL>