diff options
| author | ilotterytea <iltsu@alright.party> | 2025-07-02 03:31:54 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-07-02 03:31:54 +0500 |
| commit | 79be89ad0491bfdd110b2c612e21a0f28c29fa87 (patch) | |
| tree | 589daab514de11cc87e424b62d87f8cac12494ab /bot/CMakeLists.txt | |
| parent | fea3c12d6b621796bb239cebb57a5a5014dfe350 (diff) | |
feat: MARIADB SUPPORT!!!!
Diffstat (limited to 'bot/CMakeLists.txt')
| -rw-r--r-- | bot/CMakeLists.txt | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/bot/CMakeLists.txt b/bot/CMakeLists.txt index cd74eaf..85eb870 100644 --- a/bot/CMakeLists.txt +++ b/bot/CMakeLists.txt @@ -43,6 +43,40 @@ file(GLOB_RECURSE SOURCE_FILES "src/*.cpp" "src/*.h" "src/*.hpp") target_sources(Bot PRIVATE ${SOURCE_FILES}) target_include_directories(Bot PRIVATE src) +# DATABASE +option(USE_POSTGRES "Use PostgreSQL backend" OFF) +option(USE_MARIADB "Use MariaDB backend" ON) + +if (USE_POSTGRES) + FetchContent_Declare( + pqxx + GIT_REPOSITORY https://github.com/jtv/libpqxx.git + GIT_TAG 7.10.1 + ) + FetchContent_MakeAvailable(pqxx) + target_compile_definitions(Bot PRIVATE USE_POSTGRES) + target_link_libraries(Bot PRIVATE pqxx) +endif() + +# ev&doe it is mysql +if (USE_MARIADB) + target_compile_definitions(Bot PRIVATE USE_MARIADB) + + # searching for mysql + find_program(MYSQL_CONFIG_EXECUTABLE mysql_config REQUIRED) + + execute_process(COMMAND ${MYSQL_CONFIG_EXECUTABLE} --cflags + OUTPUT_VARIABLE MYSQL_CFLAGS + OUTPUT_STRIP_TRAILING_WHITESPACE) + + execute_process(COMMAND ${MYSQL_CONFIG_EXECUTABLE} --libs + OUTPUT_VARIABLE MYSQL_LIBS + OUTPUT_STRIP_TRAILING_WHITESPACE) + + target_compile_options(Bot PRIVATE ${MYSQL_CFLAGS}) + target_link_libraries(Bot PRIVATE ${MYSQL_LIBS}) +endif() + # Getting libraries # json @@ -60,14 +94,6 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(cpr) -# postgresql -FetchContent_Declare( - pqxx - GIT_REPOSITORY https://github.com/jtv/libpqxx.git - GIT_TAG 7.10.1 -) -FetchContent_MakeAvailable(pqxx) - # websockets FetchContent_Declare( ixwebsocket @@ -96,7 +122,6 @@ FetchContent_MakeAvailable(emotespp) target_link_libraries(Bot PRIVATE ixwebsocket::ixwebsocket - pqxx nlohmann_json::nlohmann_json cpr::cpr lua |
