diff options
| author | ilotterytea <iltsu@alright.party> | 2024-05-18 16:29:46 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-05-18 16:29:46 +0500 |
| commit | 8f3abd66d3d0a70c9dbd790e430bf8690f58c49f (patch) | |
| tree | 5801e52f2473288f568ced7575344960a7f81ff9 | |
| parent | d1793df1eda463b10107d41785ad1d7f055ed476 (diff) | |
feat: web project
| -rw-r--r-- | CMakeLists.txt | 24 | ||||
| -rw-r--r-- | web/src/main.cpp | 10 |
2 files changed, 34 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fef134..2bd6745 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,8 +15,10 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DUSE_TLS=1) file(GLOB_RECURSE BOT_SRC_FILES "bot/src/*.cpp" "bot/src/*.h" "bot/src/*.hpp") +file(GLOB_RECURSE WEB_SRC_FILES "web/src/*.cpp" "web/src/*.h" "web/src/*.hpp") option(BUILD_BOT "Build the bot" ON) +option(BUILD_WEB "Build the web application" ON) if (BUILD_BOT) add_executable(Bot) @@ -66,3 +68,25 @@ if (BUILD_BOT) target_link_libraries(Bot PRIVATE ixwebsocket::ixwebsocket pqxx nlohmann_json::nlohmann_json cpr::cpr) endif() + +if (BUILD_WEB) + add_executable(Web) + + set_target_properties( + Web PROPERTIES + DESCRIPTION ${PROJECT_DESCRIPTION} + OUTPUT_NAME "redpilledweb" + ) + + target_sources(Web PRIVATE ${WEB_SRC_FILES}) + + # web framework + FetchContent_Declare( + crow + GIT_REPOSITORY https://github.com/CrowCpp/Crow + GIT_TAG v1.1.0 + ) + FetchContent_MakeAvailable(crow) + + target_include_directories(Web PRIVATE ${crow_SOURCE_DIR}/include) +endif() diff --git a/web/src/main.cpp b/web/src/main.cpp new file mode 100644 index 0000000..248328f --- /dev/null +++ b/web/src/main.cpp @@ -0,0 +1,10 @@ +#include "crow/app.h" + +int main(int argc, char *argv[]) { + crow::SimpleApp app; + + CROW_ROUTE(app, "/")([]() { return "hi"; }); + + app.multithreaded().port(18083).run(); + return 0; +} |
