diff --git a/.gitignore b/.gitignore index 5b861d3..1422620 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build .vs .cache -cmake-* \ No newline at end of file +cmake-* +.xmake \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 8ed18eb..915ec86 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -142,6 +142,7 @@ "numbers": "cpp", "semaphore": "cpp", "span": "cpp", - "text_encoding": "cpp" + "text_encoding": "cpp", + "*.in": "cpp" } } \ No newline at end of file diff --git a/client/main.cpp b/client/main.cpp index 88f6d7a..e1380fc 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -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); diff --git a/client/xmake.lua b/client/xmake.lua new file mode 100644 index 0000000..a252c90 --- /dev/null +++ b/client/xmake.lua @@ -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") \ No newline at end of file diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..7783efd --- /dev/null +++ b/config.h.in @@ -0,0 +1,7 @@ +#ifndef VERSION_H +#define VERSION_H + +#define VERSION_GIT_COMMIT "${GIT_COMMIT}" +#define VERSION_GIT_BRANCH "${GIT_BRANCH}" + +#endif diff --git a/net/xmake.lua b/net/xmake.lua new file mode 100644 index 0000000..e69c7ca --- /dev/null +++ b/net/xmake.lua @@ -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") \ No newline at end of file diff --git a/ofen b/ofen index 57269a5..1bf2550 160000 --- a/ofen +++ b/ofen @@ -1 +1 @@ -Subproject commit 57269a5e733bf03c8e2d31fa464afa0053e2394a +Subproject commit 1bf2550248e21147472d1c4363cbcb1bc1037054 diff --git a/server/main.cpp b/server/main.cpp index a00e450..284c44c 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -6,7 +6,7 @@ std::shared_ptr 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) { diff --git a/server/xmake.lua b/server/xmake.lua new file mode 100644 index 0000000..f98548f --- /dev/null +++ b/server/xmake.lua @@ -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") \ No newline at end of file diff --git a/util/xmake.lua b/util/xmake.lua new file mode 100644 index 0000000..f4987aa --- /dev/null +++ b/util/xmake.lua @@ -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") \ No newline at end of file diff --git a/version.h.in b/version.h.in index ece5211..4050203 100644 --- a/version.h.in +++ b/version.h.in @@ -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 diff --git a/xmake.lua b/xmake.lua new file mode 100644 index 0000000..7f26e81 --- /dev/null +++ b/xmake.lua @@ -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"}) \ No newline at end of file