2023-06-13 14:42:55 +08:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
|
|
|
project(AicsKnowledgeBase LANGUAGES CXX)
|
|
|
|
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2023-06-21 21:33:52 +08:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
2023-06-13 14:42:55 +08:00
|
|
|
|
2023-06-16 21:07:11 +08:00
|
|
|
find_package(Qt6 COMPONENTS Quick REQUIRED)
|
|
|
|
|
|
|
|
#遍历所有Cpp文件
|
|
|
|
file(GLOB_RECURSE CPP_FILES src/*.cpp src/*.h)
|
2023-06-19 15:45:16 +08:00
|
|
|
foreach (filepath ${CPP_FILES})
|
2023-06-16 21:07:11 +08:00
|
|
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
|
|
|
list(APPEND sources_files ${filename})
|
2023-06-19 15:45:16 +08:00
|
|
|
endforeach (filepath)
|
2023-06-16 21:07:11 +08:00
|
|
|
|
|
|
|
#遍历所有qml文件
|
|
|
|
file(GLOB_RECURSE QML_PATHS qml/*.qml)
|
2023-06-19 15:45:16 +08:00
|
|
|
foreach (filepath ${QML_PATHS})
|
2023-06-16 21:07:11 +08:00
|
|
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
|
|
|
list(APPEND qml_files ${filename})
|
2023-06-19 15:45:16 +08:00
|
|
|
endforeach (filepath)
|
2023-06-16 21:07:11 +08:00
|
|
|
|
|
|
|
#遍历所有资源文件
|
2023-06-21 21:33:52 +08:00
|
|
|
file(GLOB_RECURSE RES_PATHS res/*.png res/*.jpg res/*.svg res/*.ico res/*.ttf res/*.webp qmldir)
|
2023-06-19 15:45:16 +08:00
|
|
|
foreach (filepath ${RES_PATHS})
|
2023-06-16 21:07:11 +08:00
|
|
|
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
|
|
|
list(APPEND resource_files ${filename})
|
2023-06-19 15:45:16 +08:00
|
|
|
endforeach (filepath)
|
2023-06-13 14:42:55 +08:00
|
|
|
|
|
|
|
qt_add_executable(AicsKnowledgeBase
|
2023-06-19 15:45:16 +08:00
|
|
|
${sources_files}
|
|
|
|
)
|
2023-06-13 14:42:55 +08:00
|
|
|
|
|
|
|
qt_add_qml_module(AicsKnowledgeBase
|
2023-06-19 15:45:16 +08:00
|
|
|
URI AicsKnowledgeBase
|
|
|
|
VERSION 1.0
|
|
|
|
QML_FILES ${qml_files}
|
|
|
|
RESOURCES ${resource_files}
|
|
|
|
)
|
2023-06-13 14:42:55 +08:00
|
|
|
|
|
|
|
set_target_properties(AicsKnowledgeBase PROPERTIES
|
2023-06-19 15:45:16 +08:00
|
|
|
WIN32_EXECUTABLE TRUE
|
|
|
|
)
|
2023-06-13 14:42:55 +08:00
|
|
|
|
|
|
|
target_compile_definitions(AicsKnowledgeBase
|
2023-06-19 15:45:16 +08:00
|
|
|
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
|
|
|
|
|
|
|
target_include_directories(AicsKnowledgeBase PRIVATE
|
2023-06-20 10:39:20 +08:00
|
|
|
../libcurl/include)
|
2023-06-13 14:42:55 +08:00
|
|
|
|
|
|
|
target_link_libraries(AicsKnowledgeBase PRIVATE
|
2023-06-19 15:45:16 +08:00
|
|
|
Qt6::Quick
|
|
|
|
fluentuiplugin
|
|
|
|
FramelessHelper::Core
|
|
|
|
FramelessHelper::Quick
|
2023-06-20 10:39:20 +08:00
|
|
|
libcurl
|
2023-06-19 15:45:16 +08:00
|
|
|
)
|
|
|
|
|
2023-06-20 10:39:20 +08:00
|
|
|
file(GLOB MSQUIC_BIN_FILES ../libcurl/dll/*)
|
2023-06-19 15:45:16 +08:00
|
|
|
|
|
|
|
add_custom_command(TARGET AicsKnowledgeBase POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
${MSQUIC_BIN_FILES} ${CMAKE_CURRENT_BINARY_DIR}
|
2023-06-21 21:33:52 +08:00
|
|
|
)
|