add:初步添加xmake编译脚本。

This commit is contained in:
taynpg 2025-01-08 10:25:14 +08:00
parent e825387201
commit a006618aeb
12 changed files with 75 additions and 7 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
build
.vs
.cache
cmake-*
cmake-*
.xmake

View File

@ -142,6 +142,7 @@
"numbers": "cpp",
"semaphore": "cpp",
"span": "cpp",
"text_encoding": "cpp"
"text_encoding": "cpp",
"*.in": "cpp"
}
}

View File

@ -115,7 +115,7 @@ int main(int argc, char* argv[])
g_Logger->error("Not found config by num:[{}]", param.use_config);
return -1;
}
g_Logger->info("Configure At {} under {} on {}", VERSION_BUILD_DATE, VERSION_GIT_HASH,
g_Logger->info("Build At {} {} under {} on {}", __DATE__, __TIME__, VERSION_GIT_COMMIT,
VERSION_GIT_BRANCH);
g_Logger->info("use ip:[{}], port:[{}]", use.ip, use.port);
CClient client(g_Logger);

12
client/xmake.lua Normal file
View File

@ -0,0 +1,12 @@
add_rules("mode.debug", "mode.release")
set_languages("c++17")
if is_plat("windows") then
add_cxxflags("/source-charset:utf-8")
end
add_includedirs(os.scriptdir())
target("tsc")
set_kind("binary")
add_files("*.cpp")
add_deps("ofen")
add_deps("trans_util")
add_deps("trans_net")

7
config.h.in Normal file
View File

@ -0,0 +1,7 @@
#ifndef VERSION_H
#define VERSION_H
#define VERSION_GIT_COMMIT "${GIT_COMMIT}"
#define VERSION_GIT_BRANCH "${GIT_BRANCH}"
#endif

14
net/xmake.lua Normal file
View File

@ -0,0 +1,14 @@
add_rules("mode.debug", "mode.release")
set_languages("c++17")
if is_plat("windows") then
add_cxxflags("/source-charset:utf-8")
end
if is_mode("debug") then
set_suffixname("d")
end
add_includedirs(os.scriptdir(), {public = true})
target("trans_net")
set_kind("static")
add_files("*.cpp")
add_deps("ofen")
add_deps("trans_util")

2
ofen

@ -1 +1 @@
Subproject commit 57269a5e733bf03c8e2d31fa464afa0053e2394a
Subproject commit 1bf2550248e21147472d1c4363cbcb1bc1037054

View File

@ -6,7 +6,7 @@ std::shared_ptr<spdlog::logger> g_Logger = nullptr;
int main(int argc, char* argv[])
{
g_Logger = get_logger("server", "server.log");
g_Logger->info("Configure At {} under {} on {}", VERSION_BUILD_DATE, VERSION_GIT_HASH,
g_Logger->info("Build At {} {} under {} on {}", __DATE__, __TIME__, VERSION_GIT_COMMIT,
VERSION_GIT_BRANCH);
int port = 9898;
if (argc < 2) {

12
server/xmake.lua Normal file
View File

@ -0,0 +1,12 @@
add_rules("mode.debug", "mode.release")
set_languages("c++17")
if is_plat("windows") then
add_cxxflags("/source-charset:utf-8")
end
add_includedirs(os.scriptdir())
target("tss")
set_kind("binary")
add_files("*.cpp")
add_deps("ofen")
add_deps("trans_util")
add_deps("trans_net")

13
util/xmake.lua Normal file
View File

@ -0,0 +1,13 @@
add_rules("mode.debug", "mode.release")
set_languages("c++17")
if is_plat("windows") then
add_cxxflags("/source-charset:utf-8")
end
if is_mode("debug") then
set_suffixname("d")
end
add_includedirs(os.scriptdir(), {public = true})
target("trans_util")
set_kind("static")
add_files("*.cpp")
add_deps("ofen")

View File

@ -1,8 +1,7 @@
#ifndef VERSION_H
#define VERSION_H
#define VERSION_BUILD_DATE "@VERSION_BUILD_DATE@"
#define VERSION_GIT_HASH "@VERSION_GIT_HASH@"
#define VERSION_GIT_COMMIT "@VERSION_GIT_HASH@"
#define VERSION_GIT_BRANCH "@VERSION_GIT_BRANCH@"
#endif

9
xmake.lua Normal file
View File

@ -0,0 +1,9 @@
add_rules("mode.debug", "mode.release")
set_languages("c++17")
if is_plat("windows") then
add_cxxflags("/source-charset:utf-8")
end
add_includedirs("$(projectdir)/3rd", {public = true})
add_includedirs("$(projectdir)/build", {public = true})
includes("util", "ofen", "net", "server", "client")
add_configfiles("config.h.in", {filename = "version.h"})