diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ba9430..188e7ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,14 @@ set(RETURN_ON_DEL_VAL false) set(RETURN_ON_DEL_NAME_VAL "\"\"") endif() +if(DEFINED API_VERSION) +set(RETURN_ON_DEL_VAL true) +set(RETURN_ON_DEL_NAME_VAL API_VERSION) +else() +set(RETURN_ON_DEL_VAL false) +set(RETURN_ON_DEL_NAME_VAL 2) +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 9e58e4d..99a9967 100644 --- a/ccash_config.hpp.in +++ b/ccash_config.hpp.in @@ -35,7 +35,7 @@ version 2 will work version 3 will not work etc */ -#define API_VERSION 2 +#define API_VERSION @API_VERSION@ #define MULTI_THREADED @MULTI_THREADED_VAL@ diff --git a/docs/building.md b/docs/building.md index f374124..c8d2c66 100644 --- a/docs/building.md +++ b/docs/building.md @@ -66,16 +66,16 @@ cd build ### CMake Flags there are multiple flags responsible configuring CCash: -| name | default | description | pros | cons | -| :--------------------- | :-----------: | ------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | -------------------------------------------------------- | -| USER_SAVE_LOC | "users.dat" | where the users are saved | `N/A` | `N/A` | -| DROGON_CONFIG_LOC | "config.json" | where the config is located | `N/A` | `N/A` | -| MAX_LOG_SIZE | 100 | max number of logs per user, last `n` transactions. If both this and pre log are toggled to 0 logs will not be compiled. | large history | higher memory usage | -| CONSERVATIVE_DISK_SAVE | `true` | when `true` only saves when changes are made | low # of disk operations | some atomic overhead | -| MULTI_THREADED | `true` | when `true` the program is compiled to utilize `n` threads which corresponds to how many Cores your CPU has, plus 1 for saving | speed | memory lock overhead is wasteful on single core machines | -| RETURN_ON_DEL_NAME | `N/A` | when defined, return on delete will be toggled and any accounts deleted will send their funds to the defined account, this prevent currency destruction | prevents destruction of currency | deleting accounts is made slower | -| ADD_USER_OPEN | `true` | anybody can make a new account, if set to false only admins can add accounts via `AdminAddUser()` | `N/A` | spamming new users | - +| name | default | description | pros | cons | +| :--------------------- | :------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | -------------------------------------------------------- | +| USER_SAVE_LOC | "config/users.dat" | where the users are saved | `N/A` | `N/A` | +| DROGON_CONFIG_LOC | "config/config.json" | where the config is located | `N/A` | `N/A` | +| MAX_LOG_SIZE | 100 | max number of logs per user, last `n` transactions. If both this and pre log are toggled to 0 logs will not be compiled. | large history | higher memory usage | +| CONSERVATIVE_DISK_SAVE | `true` | when `true` only saves when changes are made | low # of disk operations | some atomic overhead | +| MULTI_THREADED | `true` | when `true` the program is compiled to utilize `n` threads which corresponds to how many Cores your CPU has, plus 1 for saving | speed | memory lock overhead is wasteful on single core machines | +| RETURN_ON_DEL_NAME | `N/A` | when defined, return on delete will be toggled and any accounts deleted will send their funds to the defined account, this prevent currency destruction | prevents destruction of currency | deleting accounts is made slower | +| ADD_USER_OPEN | `true` | anybody can make a new account, if set to false only admins can add accounts via `AdminAddUser()` | `N/A` | spamming new users | +| API_VERSION | 2 | api versions are backwards compatible, e.g if set to 2, v1 and v2 api endpoints will be compiled, but v3 would not. By default `API_VERSION` is set to the newest version | `N/A` | `N/A` | EXAMPLE: ```