build: back to cmake.

This commit is contained in:
2025-07-06 23:51:45 +08:00
parent 13be630726
commit a04202c00e
33 changed files with 436 additions and 5247 deletions

17
Console/CMakeLists.txt Normal file
View File

@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.16)
project(frelayConsole LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Network)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Network)
add_executable(frelayConsole Console.h Console.cpp main.cpp ../Res/ico.rc)
target_link_libraries(frelayConsole PRIVATE Protocol Util ClientCore)
target_link_libraries(frelayConsole PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network)

View File

@@ -4,10 +4,6 @@
#include "Console.h"
#ifndef NO_CRASHELPER
#include <crashelper.h>
#endif
int main(int argc, char* argv[])
{
if (argc < 3) {
@@ -15,16 +11,6 @@ int main(int argc, char* argv[])
return 0;
}
#ifndef NO_CRASHELPER
auto configDir = Util::GetCurConfigPath("frelay");
#ifdef _WIN32
backward::SetDumpFileSavePath(configDir + "/dumpfile");
backward::SetDumpLogSavePath(configDir + "/dumplog");
#else
backward::SetDumpLogSavePath(configDir + "/dumplog");
#endif
#endif
qRegisterMetaType<QSharedPointer<FrameBuffer>>("QSharedPointer<FrameBuffer>");
qRegisterMetaType<InfoClientVec>("InfoClientVec");
qRegisterMetaType<DirFileInfoVec>("DirFileInfoVec");

View File

@@ -1,23 +0,0 @@
add_rules("mode.debug", "mode.release")
target("frelayConsole")
set_rules("qt.console")
add_files("Console.cpp", "Console.h", "main.cpp")
add_deps("ClientCore")
add_deps("Protocol")
add_deps("Util")
add_frameworks("QtNetwork")
if is_plat("windows") then
add_files("../Res/ico.rc")
end
if is_plat("mingw") then
add_files("../Res/ico.rc")
else
add_deps("crashelper")
end
if is_plat("linux") then
add_links("dl")
end