From c50f8d86f60cb2b5a1b30b96dbf9db05b227c485 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 14 May 2023 16:27:31 +0200 Subject: [PATCH] Add option for GameDLL version and source directory Options could be set from the CMake GUI. By default, GameDLL version is set to 'GAMEDLL_S3', and engine source directory is set to 'r5dev/'. --- CMakeLists.txt | 10 +++++----- r5dev/cmake/Configure.cmake | 7 +++++-- r5dev/cmake/Options.cmake | 9 +++++++++ r5dev/public/tier0/basetypes.h | 3 ++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab1f4590..263b21c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,13 +6,13 @@ include( "r5dev/cmake/Macros.cmake" ) include( "r5dev/cmake/Options.cmake" ) initial_setup() -define_compiler_variables() setup_build_configurations() +define_compiler_variables() apply_project_settings() -include_directories( ${ENGINE_SOURCE_DIR} ) -include_directories( ${ENGINE_SOURCE_DIR}/public ) -include_directories( ${ENGINE_SOURCE_DIR}/thirdparty ) +include_directories( "${ENGINE_SOURCE_DIR}" ) +include_directories( "${ENGINE_SOURCE_DIR}/public" ) +include_directories( "${ENGINE_SOURCE_DIR}/thirdparty" ) # Include the subdirectories that contain the individual projects -add_subdirectory( ${ENGINE_SOURCE_DIR} ) +add_subdirectory( "${ENGINE_SOURCE_DIR}" ) diff --git a/r5dev/cmake/Configure.cmake b/r5dev/cmake/Configure.cmake index 01cfe616..c1f81670 100644 --- a/r5dev/cmake/Configure.cmake +++ b/r5dev/cmake/Configure.cmake @@ -5,8 +5,11 @@ macro( initial_setup ) set( CMAKE_CXX_STANDARD 17 ) set( CMAKE_CXX_STANDARD_REQUIRED True ) - set( ENGINE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/r5dev ) - set( GLOBAL_PCH ${ENGINE_SOURCE_DIR}/core/stdafx.h ) # Global precompiled header shared among all libraries + set(ENGINE_SOURCE_DIR "${CMAKE_SOURCE_DIR}/r5dev" CACHE PATH "Engine source directory") + + set( GLOBAL_PCH + "${ENGINE_SOURCE_DIR}/core/stdafx.h" + ) # Global precompiled header shared among all libraries set_property( GLOBAL PROPERTY USE_FOLDERS ON ) # Use filters endmacro() diff --git a/r5dev/cmake/Options.cmake b/r5dev/cmake/Options.cmake index 263f9740..38b2e31c 100644 --- a/r5dev/cmake/Options.cmake +++ b/r5dev/cmake/Options.cmake @@ -12,12 +12,21 @@ macro( apply_project_settings ) $<$:/DUNICODE> ) + set( GAMEDLL_OPTION "GAMEDLL_S3" CACHE STRING "Game DLL version" ) + set_property( CACHE GAMEDLL_OPTION PROPERTY STRINGS + "GAMEDLL_S0" + "GAMEDLL_S1" + "GAMEDLL_S2" + "GAMEDLL_S3" + ) + # Set common defines add_compile_definitions( "_CRT_SECURE_NO_WARNINGS" "SPDLOG_COMPILED_LIB" "SPDLOG_NO_EXCEPTIONS" "CURL_STATICLIB" + "${GAMEDLL_OPTION}" ) # Set settings for Debug configuration diff --git a/r5dev/public/tier0/basetypes.h b/r5dev/public/tier0/basetypes.h index 9b67bc43..c21e3b3d 100644 --- a/r5dev/public/tier0/basetypes.h +++ b/r5dev/public/tier0/basetypes.h @@ -4,10 +4,11 @@ * _basetypes *-----------------------------------------------------------------------------*/ +// These are set from CMake now. //#define GAMEDLL_S0 /*[r]*/ //#define GAMEDLL_S1 /*[r]*/ //#define GAMEDLL_S2 /*[i]*/ -#define GAMEDLL_S3 /*[r]*/ +//#define GAMEDLL_S3 /*[r]*/ //#define GAMEDLL_S4 /*[i]*/ //#define GAMEDLL_S5 /*[i]*/ //#define GAMEDLL_S7 /*[i]*/