Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,16 @@ endif()

# 查找Qt和DTK
find_package(Qt${QT_DESIRED_VERSION} REQUIRED COMPONENTS ${qt_required_components})
find_package(Dtk${DTK_VERSION_MAJOR} REQUIRED COMPONENTS Widget Gui Core)

if(DTK_VERSION_MAJOR)
find_package(Dtk${DTK_VERSION_MAJOR} REQUIRED COMPONENTS Widget Gui Core)
set(DTK_USE_TARGETS ON)
else()
find_package(DtkWidget REQUIRED)
find_package(DtkGui REQUIRED)
find_package(DtkCore REQUIRED)
set(DTK_USE_TARGETS OFF)
endif()

# 定义链接库
set(LINK_LIBS
Expand All @@ -93,11 +102,17 @@ set(LINK_LIBS
Qt${QT_DESIRED_VERSION}::Svg
Qt${QT_DESIRED_VERSION}::Concurrent
Qt${QT_DESIRED_VERSION}::Xml
Dtk${DTK_VERSION_MAJOR}::Widget
Dtk${DTK_VERSION_MAJOR}::Gui
Dtk${DTK_VERSION_MAJOR}::Core
)

# Qt6使用命名空间目标,Qt5使用变量
if(DTK_USE_TARGETS)
list(APPEND LINK_LIBS
Dtk${DTK_VERSION_MAJOR}::Widget
Dtk${DTK_VERSION_MAJOR}::Gui
Dtk${DTK_VERSION_MAJOR}::Core
)
endif()

# 添加Qt6特有链接库
if (QT_DESIRED_VERSION MATCHES 6)
list(APPEND LINK_LIBS Qt${QT_DESIRED_VERSION}::Core5Compat)
Expand Down
15 changes: 15 additions & 0 deletions reader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ target_include_directories(deepin-reader PUBLIC
$<$<BOOL:${XPS_SUPPORT_ENABLED}>:${XPS_DEPS_INCLUDE_DIRS}>
)

# 使用DTK变量包含目录
if(NOT QT_VERSION_MAJOR MATCHES 6)
target_include_directories(deepin-reader PUBLIC
${DtkWidget_INCLUDE_DIRS}
${DtkGui_INCLUDE_DIRS}
${DtkCore_INCLUDE_DIRS}
)
endif()

if (NOT APP_VERSION)
set(APP_VERSION "1.0.0")
endif()
Expand Down Expand Up @@ -119,6 +128,12 @@ else()
dl
pthread
)
# 使用DTK变量而不是目标
target_link_libraries(deepin-reader PRIVATE
${DtkWidget_LIBRARIES}
${DtkGui_LIBRARIES}
${DtkCore_LIBRARIES}
)

qt5_add_resources(reader_RESOURCES
${CMAKE_SOURCE_DIR}/resources/resources.qrc
Expand Down