From 37ffe2622a2a5db09a9ca24f55c6bbf04b996f99 Mon Sep 17 00:00:00 2001 From: taynpg Date: Sun, 16 Feb 2025 14:58:03 +0800 Subject: [PATCH] =?UTF-8?q?ver=EF=BC=9A=E6=B7=BB=E5=8A=A0=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=89=93=E5=8D=B0=E7=89=88=E6=9C=AC=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 1 + README.md | 8 +++++--- client/client.cpp | 4 +++- client/main.cpp | 3 ++- config.h.in | 7 ------- server/server.cpp | 4 +++- version.h.in | 2 ++ 7 files changed, 16 insertions(+), 13 deletions(-) delete mode 100644 config.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 247648e..70ebde5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(transm VERSION 1.2.3 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(PROJECT_URL "https://www.sinxmiao.cn/taynpg/transm") # 将 CMAKE_SYSTEM_PROCESSOR 转换为小写 string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" CMAKE_SYSTEM_PROCESSOR_LOWER) set(COMPILER_ID ${CMAKE_CXX_COMPILER_ID}) diff --git a/README.md b/README.md index ead74de..47e7771 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ 低版本编译器,可选择`boost`+`c++11`标准组合。 -**注**:使用安装包的用户,如果想变更安装位置的话,请先卸载旧版本。 +**注**:使用安装包的用户,如果想变更安装位置的话,请先卸载旧版本(原位置更新新版不用)。 # 一、简要介绍 @@ -139,6 +139,8 @@ cmake:`cmake -Bbuild -DCMAKE_BUILD_TYPE=Release`、`cmake --build build --conf 请参照:`xp_build.bat`。 -# 其他 +# XP用户阅 -- `xp`系统下,安装后(或者添加环境变量后),如果时第一次使用请先执行`ansicon -i`以支持彩色显示,后续则不用再次执行(如果没有卸载过或变更安装位置)。 \ No newline at end of file +- `xp`系统下,安装后(或者添加环境变量后),如果时第一次使用请先执行`ansicon -i`以支持彩色显示,后续则不用再次执行(如果没有卸载过或变更安装位置)。 +- 使用安装包的用户,如果想变更安装位置的话,请先卸载旧版本(原位置更新新版不用)。 +- 如果安装位置有变动或者单纯卸载`transm`,请先执行`ansicon -u`再卸载。 \ No newline at end of file diff --git a/client/client.cpp b/client/client.cpp index 03ca68b..4974299 100644 --- a/client/client.cpp +++ b/client/client.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #ifdef MINGW32_XP_BOOST #include @@ -63,7 +64,8 @@ void CClient::run(const std::string& ip, const std::string& port) bf->type_ = TYPE_GET_ID; send_frame(bf); delete bf; - + mpinfo("version: {}", VERSION_NUM); + mpinfo("opensource: {}", VERSION_URL); mpwarn("SupportCmd:Get|Up|Down|Cancel|Update"); fc_append('|'); diff --git a/client/main.cpp b/client/main.cpp index 2a024c0..ae81c05 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -18,7 +18,8 @@ std::shared_ptr g_Config = nullptr; int parse_cmd(int argc, char** argv, CmdParam& param) { - std::string intro("transmc cmd introduce."); + std::string intro( + fmt::format("tsc cmd introduce, version: {}\nopensource: {}", VERSION_NUM, VERSION_URL)); CLI::App app(intro); app.add_option("-n, --number", param.use_config, "使用服务器地址组(值为使用--show中显示的序号)"); diff --git a/config.h.in b/config.h.in deleted file mode 100644 index 7783efd..0000000 --- a/config.h.in +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef VERSION_H -#define VERSION_H - -#define VERSION_GIT_COMMIT "${GIT_COMMIT}" -#define VERSION_GIT_BRANCH "${GIT_BRANCH}" - -#endif diff --git a/server/server.cpp b/server/server.cpp index 1381958..3aad487 100644 --- a/server/server.cpp +++ b/server/server.cpp @@ -1,6 +1,7 @@ #include "server.h" #include #include +#include using namespace ofen; constexpr int check_idle_percycle = 1000 * 30; // 毫秒 @@ -24,7 +25,8 @@ bool CTcpServer::start(unsigned short port) { asio::ip::tcp::resolver resolver(io_context_); asio::ip::tcp::resolver::query query(asio::ip::host_name(), ""); - + mpinfo("version: {}", VERSION_NUM); + mpinfo("opensource: {}", VERSION_URL); try { auto it = resolver.resolve(query); mpdebug("Here are the local IP addresses you may use."); diff --git a/version.h.in b/version.h.in index 4050203..d06491c 100644 --- a/version.h.in +++ b/version.h.in @@ -3,5 +3,7 @@ #define VERSION_GIT_COMMIT "@VERSION_GIT_HASH@" #define VERSION_GIT_BRANCH "@VERSION_GIT_BRANCH@" +#define VERSION_NUM "@PROJECT_VERSION@" +#define VERSION_URL "@PROJECT_URL@" #endif