From c02ba25371e30503486c1df57ca431be2c1f14fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=88=D0=B5=20=D0=98=D0=BC=D1=8F?= Date: Tue, 30 Sep 2025 18:57:16 +0400 Subject: [PATCH] refactor(build): restructure into separate server targets Update xmake.lua to split into HTTP, file, and DNS server targets with individual source directories. Remove old main.cpp and add test.txt for new functionality. --- src/main.cpp | 16 ---------------- www/test.txt | 1 + xmake.lua | 39 ++++++++++++++++++++++++++++++--------- 3 files changed, 31 insertions(+), 25 deletions(-) delete mode 100644 src/main.cpp create mode 100644 www/test.txt diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 0a84ea3..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int main() -{ - std::cout << "Hello, Boost + C++23 + xmake!\n"; - - boost::asio::io_context io; - boost::asio::steady_timer timer(io, std::chrono::seconds(1)); - timer.async_wait([](const boost::system::error_code &) { - std::cout << "Timer fired after 1 second!\n"; - }); - - io.run(); - return 0; -} diff --git a/www/test.txt b/www/test.txt new file mode 100644 index 0000000..169ec55 --- /dev/null +++ b/www/test.txt @@ -0,0 +1 @@ +Hello from file! diff --git a/xmake.lua b/xmake.lua index fc0928b..42189b1 100644 --- a/xmake.lua +++ b/xmake.lua @@ -2,16 +2,37 @@ set_languages "c++23" add_rules("plugin.compile_commands.autoupdate", { outputdir = "." }) -add_requires("boost", { - system = true, -- sudo pacman -S boost - +add_requires("cmake::Boost", { + alias = "boost", + system = true, configs = { - all = false, - system = true, -- asio + components = { "program_options", "log" }, }, }) -target "app" -set_kind "binary" -add_files "src/*.cpp" -add_links "boost_system" +-- HTTP server target +target "http_server" +do + set_kind "binary" + add_files("src/main/main_http.cpp", "src/http/*.cpp", "src/common/*.cpp") + add_includedirs("src", "src/http", "src/common", { public = true }) + add_packages "boost" +end + +-- File server target +target "file_server" +do + set_kind "binary" + add_files("src/main/main_file.cpp", "src/file/*.cpp", "src/common/*.cpp") + add_includedirs("src", "src/file", "src/common", { public = true }) + add_packages "boost" +end + +-- DNS server target +target "dns_server" +do + set_kind "binary" + add_files("src/main/main_dns.cpp", "src/dns/*.cpp", "src/common/*.cpp") + add_includedirs("src", "src/dns", "src/common", { public = true }) + add_packages "boost" +end