-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
164 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# 输出 CMake 版本和构建系统类型 | ||
message("CMake Version: ${CMAKE_VERSION}") | ||
message("Generator: ${CMAKE_GENERATOR}") | ||
|
||
# 输出编译器信息 | ||
message("C Compiler ID: ${CMAKE_C_COMPILER_ID}") | ||
message("C++ Compiler ID: ${CMAKE_CXX_COMPILER_ID}") | ||
message("C++ Compiler Version: ${CMAKE_CXX_COMPILER_VERSION}") | ||
|
||
# 输出构建类型和编译选项 | ||
message("Build Type: ${CMAKE_BUILD_TYPE}") | ||
message("C++ Compiler Flags: ${CMAKE_CXX_FLAGS}") | ||
|
||
# 输出链接选项 | ||
message("Executable Linker Flags: ${CMAKE_EXE_LINKER_FLAGS}") | ||
|
||
# 输出构建和源代码目录 | ||
message("Build Directory: ${CMAKE_BINARY_DIR}") | ||
message("Source Directory: ${CMAKE_SOURCE_DIR}") | ||
|
||
# 输出目标架构 | ||
message("Target Processor: ${CMAKE_SYSTEM_PROCESSOR}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
if(CMAKE_HOST_APPLE) | ||
set(CMAKE_OSX_DEPLOYMENT_TARGET | ||
"11.0" | ||
CACHE STRING "Minimum OS X version") | ||
endif() | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
set(CMAKE_DEBUG_POSTFIX d) | ||
|
||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
message("Setting build type to 'RelWithDebInfo' as none was specified.") | ||
set(CMAKE_BUILD_TYPE | ||
RelWithDebInfo | ||
CACHE STRING "Choose the type of build." FORCE) | ||
# Set the possible values of build type for cmake-gui | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" | ||
"MinSizeRel" "RelWithDebInfo") | ||
endif() | ||
|
||
if(CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
set(BITS "64") | ||
else() | ||
set(BITS "32") | ||
endif() | ||
|
||
message(STATUS "Current Platform is ${BITS} bits.") | ||
|
||
set(EXECUTABLE_OUTPUT_PATH | ||
${PROJECT_SOURCE_DIR}/bin-${BITS}/${CMAKE_BUILD_TYPE}) | ||
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin-${BITS}/libs) | ||
link_directories(${LIBRARY_OUTPUT_PATH}) | ||
|
||
include_directories(${PROJECT_SOURCE_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
if(CMAKE_HOST_WIN32) | ||
list(APPEND CMAKE_PREFIX_PATH "C:\\Qt\\6.7.0\\msvc2019_64") | ||
elseif(CMAKE_HOST_APPLE) | ||
|
||
elseif(CMAKE_HOST_LINUX) | ||
list(APPEND CMAKE_PREFIX_PATH "/opt/Qt/6.7.0/gcc_64") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function(add_translations OUTPUT_NAME) | ||
# 转换输出名称为小写 | ||
string(TOLOWER ${OUTPUT_NAME} Lower_Output_Name) | ||
|
||
# 添加翻译文件 | ||
qt_add_translations( | ||
${OUTPUT_NAME} | ||
TS_FILE_BASE | ||
${Lower_Output_Name} | ||
TS_FILE_DIR | ||
translations | ||
INCLUDE_DIRECTORIES | ||
directory | ||
${PROJECT_SOURCE_DIR}/src) | ||
|
||
# 确定翻译文件的输出位置 | ||
if(CMAKE_HOST_APPLE) | ||
set(output_location | ||
"${EXECUTABLE_OUTPUT_PATH}/${OUTPUT_NAME}.app/Contents/Resources/translations" | ||
) | ||
else() | ||
set(output_location "${EXECUTABLE_OUTPUT_PATH}/translations") | ||
endif() | ||
|
||
# 查找所有的翻译文件(.ts) | ||
file(GLOB_RECURSE TS_FILES "${PROJECT_SOURCE_DIR}/translations/*.ts") | ||
|
||
# 设置翻译文件的输出位置 | ||
foreach(ts_file ${TS_FILES}) | ||
set_source_files_properties("${ts_file}" PROPERTIES OUTPUT_LOCATION | ||
"${output_location}") | ||
endforeach() | ||
endfunction() |
Oops, something went wrong.