From 0c19164c548d7fcd5ed72815f414d319dd92b4a3 Mon Sep 17 00:00:00 2001 From: zhuzihcu Date: Fri, 12 May 2023 10:40:27 +0800 Subject: [PATCH] update --- example/CMakeLists.txt | 2 +- src/CMakeLists.txt | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 831083cd..ea93c068 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -93,7 +93,7 @@ set_target_properties(example PROPERTIES #链接库 target_link_libraries(example PRIVATE Qt6::Quick - fluentui + fluentuiplugin ) #安装 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b8faa85f..2491f79e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16) -project(fluentui LANGUAGES CXX) +project(fluentuiplugin LANGUAGES CXX) #配置通用编译 set(CMAKE_AUTOMOC ON) @@ -9,11 +9,8 @@ if(APPLE) set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) endif() -##设置动态库输出目录 -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/bin) - -##设置库文件输出目录 -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/lib) +#设置QML插件输出目录->D:\Qt\6.4.3\msvc2019_64\qml\FluentUI +set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI) #设置版本号 add_definitions(-DVERSION=1,2,9,0) @@ -48,19 +45,23 @@ foreach(filepath IN LISTS qml_files resource_files) endforeach() #添加qml模块 -qt_add_library(fluentui SHARED) -qt_add_qml_module(fluentui - OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI +qt_add_library(fluentuiplugin SHARED) +qt_add_qml_module(fluentuiplugin + #没有下面这行代码就会生成fluentuiplugin.dll与fluentuipluginplugin.dll两个动态库 + PLUGIN_TARGET fluentuiplugin + OUTPUT_DIRECTORY ${QML_PLUGIN_DIRECTORY} VERSION 1.0 URI "FluentUI" SOURCES ${sources_files} fluentui.rc QML_FILES ${qml_files} RESOURCES ${resource_files} + #支持designer DESIGNER_SUPPORTED ) + #链接库 -target_link_libraries(fluentui PUBLIC +target_link_libraries(fluentuiplugin PUBLIC Qt::Core Qt::Quick Qt::Qml @@ -68,9 +69,8 @@ target_link_libraries(fluentui PUBLIC #链接库 win32库 不然mingw会编译错误 if(WIN32) - target_link_libraries(fluentui PRIVATE dwmapi user32) + target_link_libraries(fluentuiplugin PRIVATE dwmapi user32) endif() #如果是debug,则生成的库文件名后面拼接d -set_target_properties(fluentui PROPERTIES DEBUG_POSTFIX "d") set_target_properties(fluentuiplugin PROPERTIES DEBUG_POSTFIX "d")