This commit is contained in:
朱子楚\zhuzi 2024-03-20 12:44:35 +08:00
parent d60002f3d9
commit 6b5b8a6b57
3 changed files with 18 additions and 6 deletions

View File

@ -7,7 +7,6 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#FluentUI
@ -74,8 +73,13 @@ configure_file(
)
endif()
#qrc
qt_add_big_resources(QRC_RESOURCES ${PROJECT_NAME}.qrc)
list(APPEND QRC_RESOURCES ${PROJECT_NAME}.qrc)
set_property(SOURCE ${PROJECT_NAME}.qrc PROPERTY SKIP_AUTORCC ON)
list(APPEND sources_files ${QRC_RESOURCES})
#
list(APPEND sources_files ${PROJECT_NAME}.qrc)
if(WIN32)
list(APPEND sources_files ${EXAMPLE_VERSION_RC_PATH})
endif()

View File

@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.20)
project(%1 VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
@ -33,9 +32,13 @@ add_custom_target(Script-UpdateTranslations
SOURCES ${TS_FILE_PATHS}
)
qt_add_big_resources(QRC_RESOURCES qml.qrc)
list(APPEND QRC_RESOURCES qml.qrc)
set_property(SOURCE qml.qrc PROPERTY SKIP_AUTORCC ON)
set(PROJECT_SOURCES
main.cpp
qml.qrc
${QRC_RESOURCES}
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)

View File

@ -40,7 +40,7 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
else()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()
#
@ -139,12 +139,17 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
RESOURCE_PREFIX "/qt/qml"
)
else()
#qrc
set(QRC_FILE Qt5/imports/fluentui.qrc)
qt_add_big_resources(QRC_RESOURCES ${QRC_FILE})
list(APPEND QRC_RESOURCES ${QRC_FILE})
set_property(SOURCE ${QRC_FILE} PROPERTY SKIP_AUTORCC ON)
#Qt6.2使add_qmlplugin.cmake/QmlPlugin.cmake
include(QmlPlugin)
add_qmlplugin(${PROJECT_NAME}
URI "FluentUI"
VERSION 1.0
SOURCES ${sources_files} ${FLUENTUI_VERSION_RC_PATH} Qt5/imports/fluentui.qrc
SOURCES ${sources_files} ${FLUENTUI_VERSION_RC_PATH} ${QRC_RESOURCES}
QMLFILES ${qml_files}
QMLDIR imports/FluentUI
BINARY_DIR ${FLUENTUI_QML_PLUGIN_DIRECTORY}