FIX CMakeLists

This commit is contained in:
JackLee_CN 2024-10-20 17:05:10 +08:00
parent 99fd3d61ce
commit fd35c2bf03
2 changed files with 18 additions and 18 deletions

View File

@ -1,9 +1,9 @@
#cmake #cmake
cmake_minimum_required(VERSION 3.19) cmake_minimum_required(VERSION 3.19)
set(VCPKG_ROOT "F:/SourceCode/vcpkg") SET(VCPKG_ROOT "F:/SourceCode/vcpkg")
set(CMAKE_TOOLCHAIN_FILE "F:/SourceCode/vcpkg/scripts/buildsystems/vcpkg.cmake") SET(CMAKE_TOOLCHAIN_FILE "F:/SourceCode/vcpkg/scripts/buildsystems/vcpkg.cmake")
set(VCPKG_TARGET_TRIPLET "x64-mingw-static") SET(VCPKG_TARGET_TRIPLET "x64-mingw-static")
SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc.exe") SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc.exe")
SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++.exe") SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++.exe")
# #
@ -29,6 +29,7 @@ SET(CMAKE_CXX_FLAGS"-Wall -Wextra")
SET(CMAKE_CXX_FLAGS_RELEASE"-O3 -s") SET(CMAKE_CXX_FLAGS_RELEASE"-O3 -s")
SET(CMAKE_BUILD_TYPE "Release") SET(CMAKE_BUILD_TYPE "Release")
MESSAGE(STATUS ${PROJECT_BINARY_DIR})
MESSAGE(STATUS "----------编译模式 START-------------") MESSAGE(STATUS "----------编译模式 START-------------")
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "[CMAKE_BUILD_TYPE]当前值[Debug]") MESSAGE(STATUS "[CMAKE_BUILD_TYPE]当前值[Debug]")
@ -37,13 +38,19 @@ if(NOT CMAKE_BUILD_TYPE)
else() else()
MESSAGE(STATUS "[CMAKE_BUILD_TYPE]当前值[Release]") MESSAGE(STATUS "[CMAKE_BUILD_TYPE]当前值[Release]")
SET(CMAKE_BUILD_TYPE "Release") SET(CMAKE_BUILD_TYPE "Release")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/release) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/release/)
endif() endif()
MESSAGE(STATUS "----------编译模式 END---------------") MESSAGE(STATUS "----------编译模式 END---------------")
#QT .cmake #QT .cmake
#QT #QT
SET(QT_DIR "D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake") SET(QT_STATU "dynamic")
if(QT_STATU STREQUAL "dynamic")
SET(QT_DIR "D:/Dev/Qt/6.8.0/mingw_64/lib/cmake")
else()
SET(QT_DIR "D:/Dev/Qt/6.8.0/mingw1310_static_x64/lib/cmake")
endif()
SET(JSON ${PROJECT_SOURCE_DIR}/3rdparty/json) SET(JSON ${PROJECT_SOURCE_DIR}/3rdparty/json)
@ -102,12 +109,10 @@ endif()
include_directories(${JSON}/include) include_directories(${JSON}/include)
#XSteamcpp #XSteamcpp
FILE(GLOB src "${PROJECT_SOURCE_DIR}/src/*.cpp" "${PROJECT_SOURCE_DIR}/src/*.h") FILE(GLOB src_xsteam "${PROJECT_SOURCE_DIR}/src/*.cpp" "${PROJECT_SOURCE_DIR}/src/*.h")
SET(PROJECT_SOURCES ${src_xsteam})
SET(PROJECT_SOURCES
main.cpp
${src}
)
# qFatalqDebug # qFatalqDebug
LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT") LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT")
@ -153,12 +158,7 @@ target_link_options(${PROJECT_NAME} PUBLIC -Wl,--allow-multiple-definition)
# GCC # GCC
message(STATUS "G++ version: ${CMAKE_CXX_COMPILER_VERSION}") message(STATUS "G++ version: ${CMAKE_CXX_COMPILER_VERSION}")
# CMAKE_
foreach(var IN LISTS CMAKE_VARIABLES)
if(var MATCHES "^CMAKE_")
message(STATUS "${var} = ${${var}}")
endif()
endforeach()
# Qt # Qt
SET(QT_VERSION_STR "${Qt6_VERSION}") SET(QT_VERSION_STR "${Qt6_VERSION}")
# Qt # Qt

View File

@ -1,7 +1,7 @@
#include <QApplication> #include <QApplication>
#include "src/sui.h" #include "sui.h"
#include <QTranslator> #include <QTranslator>
#include "src/xsteam_base_ex.h" #include "xsteam_base_ex.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {