diff --git a/CMakeLists.txt b/CMakeLists.txt index 5abaa3b..3889b8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,36 @@ else() set(DROGON_CONFIG "\"../config.json\"") endif() +if(MAX_LOG_SIZE) +set(MAX_LOG_SIZE_VAL ${MAX_LOG_SIZE}) +else() +set(MAX_LOG_SIZE_VAL 100) +endif() + +if(PRE_LOG_SIZE) +set(PRE_LOG_SIZE_VAL ${PRE_LOG_SIZE}) +else() +set(PRE_LOG_SIZE_VAL 10) +endif() + +if(CONSERVATIVE_DISK_SAVE) +set(CONSERVATIVE_DISK_SAVE_VAL ${CONSERVATIVE_DISK_SAVE}) +else() +set(CONSERVATIVE_DISK_SAVE_VAL true) +endif() + +if(API_VERSION) +set(API_VERSION_VAL ${API_VERSION}) +else() +set(API_VERSION_VAL true) +endif() + +if(MULTI_THREADED) +set(MULTI_THREADED_VAL ${MULTI_THREADED}) +else() +set(MULTI_THREADED_VAL true) +endif() + configure_file(ccash_config.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/include/ccash_config.hpp) target_include_directories(${PROJECT_NAME} PUBLIC include) diff --git a/ccash_config.hpp.in b/ccash_config.hpp.in index d03cfb6..3e3e36c 100644 --- a/ccash_config.hpp.in +++ b/ccash_config.hpp.in @@ -1,8 +1,8 @@ #pragma once // Setting both values to 0 does not compile logging (useful for if disk/memory is very valuable) -#define MAX_LOG_SIZE 100 -#define PRE_LOG_SIZE 10 +#define MAX_LOG_SIZE @MAX_LOG_SIZE_VAL@ +#define PRE_LOG_SIZE @PRE_LOG_SIZE_VAL@ //default to minecraft usernames constexpr unsigned min_name_size = 3; @@ -27,7 +27,7 @@ if false, when frequency is hit save cons HIGH disk usage */ -#define CONSERVATIVE_DISK_SAVE true +#define CONSERVATIVE_DISK_SAVE @CONSERVATIVE_DISK_SAVE_VAL@ /* example, when set to 2 @@ -36,6 +36,6 @@ version 2 will work version 3 will work etc */ -#define API_VERSION 1 +#define API_VERSION @API_VERSION_VAL@ -#define MULTI_THREADED true \ No newline at end of file +#define MULTI_THREADED @MULTI_THREADED_VAL@ \ No newline at end of file