2023-06-08 23:19:38 +08:00
|
|
|
|
cmake_minimum_required(VERSION 3.20)
|
2023-05-04 00:22:20 +08:00
|
|
|
|
|
2023-12-13 17:31:08 +08:00
|
|
|
|
project(FluentUI VERSION 1.0)
|
2023-04-04 03:15:10 +08:00
|
|
|
|
|
2024-01-04 18:46:33 +08:00
|
|
|
|
if(MSVC)
|
2024-01-04 18:00:44 +08:00
|
|
|
|
#让Release也生成pdb文件
|
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-03-09 15:35:48 +08:00
|
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/.cmake/)
|
2023-08-10 16:08:27 +08:00
|
|
|
|
|
|
|
|
|
include(GetGitRevisionDescription)
|
|
|
|
|
|
2023-06-16 12:25:50 +08:00
|
|
|
|
option(FLUENTUI_BUILD_EXAMPLES "Build FluentUI demo applications." ON)
|
2023-07-09 23:05:52 +08:00
|
|
|
|
option(FLUENTUI_BUILD_STATIC_LIB "Build static library." OFF)
|
2023-06-16 12:25:50 +08:00
|
|
|
|
|
2023-08-24 15:50:37 +08:00
|
|
|
|
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
|
|
|
|
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
|
2023-08-22 10:19:06 +08:00
|
|
|
|
|
2023-08-24 15:50:37 +08:00
|
|
|
|
set(QT_SDK_DIR "${Qt${QT_VERSION_MAJOR}_DIR}")
|
2023-08-17 19:51:36 +08:00
|
|
|
|
cmake_path(GET QT_SDK_DIR PARENT_PATH QT_SDK_DIR)
|
|
|
|
|
cmake_path(GET QT_SDK_DIR PARENT_PATH QT_SDK_DIR)
|
|
|
|
|
cmake_path(GET QT_SDK_DIR PARENT_PATH QT_SDK_DIR)
|
|
|
|
|
|
2023-07-15 00:20:33 +08:00
|
|
|
|
#设置QML插件输出目录,可以通过外部设置,如果外部没有设置就默认到<QT_SDK_DIR_PATH>\qml\FluentUI目录下
|
|
|
|
|
set(FLUENTUI_QML_PLUGIN_DIRECTORY "" CACHE PATH "Path to FluentUI plugin")
|
|
|
|
|
if(NOT FLUENTUI_QML_PLUGIN_DIRECTORY)
|
2023-08-17 19:51:36 +08:00
|
|
|
|
set(FLUENTUI_QML_PLUGIN_DIRECTORY ${QT_SDK_DIR}/qml/FluentUI)
|
2023-07-15 00:20:33 +08:00
|
|
|
|
endif()
|
|
|
|
|
|
2023-04-01 21:01:46 +08:00
|
|
|
|
add_subdirectory(src)
|
2023-12-07 11:51:59 +08:00
|
|
|
|
|
2023-12-21 18:12:43 +08:00
|
|
|
|
#Release也支持日志打印代码位置
|
2023-12-07 11:51:59 +08:00
|
|
|
|
target_compile_definitions(fluentuiplugin
|
|
|
|
|
PRIVATE
|
|
|
|
|
QT_MESSAGELOGCONTEXT
|
|
|
|
|
)
|
|
|
|
|
|
2023-06-16 12:25:50 +08:00
|
|
|
|
if (FLUENTUI_BUILD_EXAMPLES)
|
|
|
|
|
add_subdirectory(example)
|
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
message("------------------------ FluentUI ------------------------")
|
|
|
|
|
message("Build FluentUI demo applications.: ${FLUENTUI_BUILD_EXAMPLES}")
|
2023-07-09 23:05:52 +08:00
|
|
|
|
message("Build static library.: ${FLUENTUI_BUILD_STATIC_LIB}")
|
2023-07-15 00:20:33 +08:00
|
|
|
|
message("Path to FluentUI plugin.: ${FLUENTUI_QML_PLUGIN_DIRECTORY}")
|