API_VERSION settable from cmake

This commit is contained in:
EntireTwix 2022-11-28 18:02:14 -08:00
parent d2f0989a15
commit 52677f0576
3 changed files with 19 additions and 11 deletions

View file

@ -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)

View file

@ -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@

View file

@ -67,15 +67,15 @@ 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` |
| :--------------------- | :------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | -------------------------------------------------------- |
| 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:
```