ver:添加代码打印版本。

This commit is contained in:
taynpg 2025-02-16 14:58:03 +08:00
parent 676f04e752
commit 37ffe2622a
7 changed files with 16 additions and 13 deletions

View File

@ -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})

View File

@ -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`以支持彩色显示,后续则不用再次执行(如果没有卸载过或变更安装位置)。
- 使用安装包的用户,如果想变更安装位置的话,请先卸载旧版本(原位置更新新版不用)。
- 如果安装位置有变动或者单纯卸载`transm`,请先执行`ansicon -u`再卸载。

View File

@ -4,6 +4,7 @@
#include <of_path.h>
#include <of_str.h>
#include <of_util.h>
#include <version.h>
#ifdef MINGW32_XP_BOOST
#include <boost/filesystem.hpp>
@ -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('|');

View File

@ -18,7 +18,8 @@ std::shared_ptr<CServerConfig> 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中显示的序号)");

View File

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

View File

@ -1,6 +1,7 @@
#include "server.h"
#include <of_str.h>
#include <of_util.h>
#include <version.h>
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.");

View File

@ -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