made multiple flags configurable from CMake

This commit is contained in:
EntireTwix 2021-07-03 01:33:32 -07:00
parent ca6187fffc
commit 5fe22d8635
2 changed files with 35 additions and 5 deletions

View file

@ -40,6 +40,36 @@ else()
set(DROGON_CONFIG "\"../config.json\"") set(DROGON_CONFIG "\"../config.json\"")
endif() 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) configure_file(ccash_config.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/include/ccash_config.hpp)
target_include_directories(${PROJECT_NAME} PUBLIC include) target_include_directories(${PROJECT_NAME} PUBLIC include)

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
// Setting both values to 0 does not compile logging (useful for if disk/memory is very valuable) // Setting both values to 0 does not compile logging (useful for if disk/memory is very valuable)
#define MAX_LOG_SIZE 100 #define MAX_LOG_SIZE @MAX_LOG_SIZE_VAL@
#define PRE_LOG_SIZE 10 #define PRE_LOG_SIZE @PRE_LOG_SIZE_VAL@
//default to minecraft usernames //default to minecraft usernames
constexpr unsigned min_name_size = 3; constexpr unsigned min_name_size = 3;
@ -27,7 +27,7 @@ if false, when frequency is hit save
cons cons
HIGH disk usage HIGH disk usage
*/ */
#define CONSERVATIVE_DISK_SAVE true #define CONSERVATIVE_DISK_SAVE @CONSERVATIVE_DISK_SAVE_VAL@
/* /*
example, when set to 2 example, when set to 2
@ -36,6 +36,6 @@ version 2 will work
version 3 will work version 3 will work
etc etc
*/ */
#define API_VERSION 1 #define API_VERSION @API_VERSION_VAL@
#define MULTI_THREADED true #define MULTI_THREADED @MULTI_THREADED_VAL@