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.
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
#include <boost/asio.hpp>
|
||||
#include <iostream>
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Hello from file!
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user