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
22 changes: 14 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,22 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now")
endif()

# 查找Qt版本(需先于 PDF 引擎模块选择:Qt5 构建走 deepin-pdfium5)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
message(">>> Found Qt version: ${QT_VERSION_MAJOR}")
set(QT_DESIRED_VERSION ${QT_VERSION_MAJOR})

# PDF 引擎使用系统库 deepin-pdfium(pkg-config: deepin-pdfium),
# 不再内嵌 3rdparty 源码
# 不再内嵌 3rdparty 源码。libdeepin-pdfium 与 libdeepin-pdfium5 分别
# 基于 Qt6/Qt5 构建,C++ ABI 不兼容,必须按 Qt 版本选择对应变体
if(QT_VERSION_MAJOR MATCHES 6)
set(DEEPIN_PDFIUM_MODULE deepin-pdfium)
else()
set(DEEPIN_PDFIUM_MODULE deepin-pdfium5)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Qt5 configuration stops with allowed dependencies

When a Qt5 build resolves its PDFium dependency to only libdeepin-pdfium-dev, cMake's pkg_check_modules requires deepin-pdfium5, so configuration stops despite the permitted generic development package and the build never starts.

Make the Qt5 pkg-config module requirement match the PDFium development package that Debian can provide for Qt5.

Also at CMakeLists.txt:35.

Prompt for AI agents
In `CMakeLists.txt` at line 32:

**Qt5 configuration stops with allowed dependencies**

When a Qt5 build resolves its PDFium dependency to only `libdeepin-pdfium-dev`, cMake's `pkg_check_modules` requires `deepin-pdfium5`, so configuration stops despite the permitted generic development package and the build never starts.

Make the Qt5 pkg-config module requirement match the PDFium development package that Debian can provide for Qt5.

Also at `CMakeLists.txt:35`.

endif()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Qt5 qmake builds keep wrong PDF engine

When a caller uses the documented qmake build with Qt5, reader/src.pri still requests the Qt6 deepin-pdfium pkg-config module, so the documented Qt5 qmake build links an ABI-incompatible engine and fails with unresolved PDFium symbols.

Select deepin-pdfium5 in the qmake configuration when building with Qt5, including for tests.

Prompt for AI agents
In `CMakeLists.txt` at line 33:

**Qt5 qmake builds keep wrong PDF engine**

When a caller uses the documented qmake build with Qt5, `reader/src.pri` still requests the Qt6 `deepin-pdfium` pkg-config module, so the documented Qt5 qmake build links an ABI-incompatible engine and fails with unresolved PDFium symbols.

Select `deepin-pdfium5` in the qmake configuration when building with Qt5, including for tests.

find_package(PkgConfig REQUIRED)
pkg_check_modules(DEEPIN_PDFIUM REQUIRED deepin-pdfium)
message(STATUS "Using system deepin-pdfium: ${DEEPIN_PDFIUM_VERSION}")
pkg_check_modules(DEEPIN_PDFIUM REQUIRED ${DEEPIN_PDFIUM_MODULE})
message(STATUS "Using system deepin-pdfium: ${DEEPIN_PDFIUM_VERSION} (module: ${DEEPIN_PDFIUM_MODULE})")

# 设置C++标准
set(CMAKE_CXX_STANDARD 17)
Expand Down Expand Up @@ -173,11 +184,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
# 引入翻译生成
include(translation-generate)

# 查找Qt版本
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
message(">>> Found Qt version: ${QT_VERSION_MAJOR}")
set(QT_DESIRED_VERSION ${QT_VERSION_MAJOR})

# 设置DTK版本
if (QT_VERSION_MAJOR MATCHES 6)
set(DTK_VERSION_MAJOR 6)
Expand Down
17 changes: 15 additions & 2 deletions batch-print/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
pkg_check_modules(FREETYPE REQUIRED freetype2)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS DBus PrintSupport Sql)

# PDF 引擎:系统库 deepin-pdfium(reader/ 创建的目标只作用于其子树)
pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET deepin-pdfium)
# PDF 引擎:系统库 deepin-pdfium(模块名由顶层按 Qt 版本选择,Qt5 走 deepin-pdfium5)
pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET ${DEEPIN_PDFIUM_MODULE})

# batchprint-core: CupsClient + NotifyClient + PrintSettings + ErrorMessages (no reader source dependency)
add_library(batchprint-core STATIC
Expand Down Expand Up @@ -104,6 +104,19 @@ if(DTK_USE_TARGETS)
Dtk${DTK_VERSION_MAJOR}::Gui
Dtk${DTK_VERSION_MAJOR}::Core
)
else()
# Qt5/DTK5 变量模式:老式 find_package 无导入目标,需手动补 DTK
# 头文件路径与链接库(与 reader 主目标的做法一致)
target_include_directories(batchprint-convert PUBLIC
${DtkWidget_INCLUDE_DIRS}
${DtkGui_INCLUDE_DIRS}
${DtkCore_INCLUDE_DIRS}
)
target_link_libraries(batchprint-convert PUBLIC
${DtkWidget_LIBRARIES}
${DtkGui_LIBRARIES}
${DtkCore_LIBRARIES}
)
endif()

if (QT_VERSION_MAJOR MATCHES 6)
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Build-Depends:
cmake,
debhelper (>= 11),
pkg-config,
libdeepin-pdfium-dev (>= 1.5.8),
libdeepin-pdfium5-dev (>= 1.5.7) [mipsel mips64el] | libdeepin-pdfium-dev (>= 1.5.8),
qt6-5compat-dev [!mipsel !mips64el] | libqt5x11extras5-dev,
qt6-base-dev [!mipsel !mips64el] | qtbase5-dev,
qt6-tools-dev-tools [!mipsel !mips64el] | qttools5-dev-tools,
Expand Down
4 changes: 2 additions & 2 deletions reader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBJPEG REQUIRED libjpeg)
pkg_check_modules(DDJVU REQUIRED ddjvuapi)

# PDF 引擎:系统库 deepin-pdfium
pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET deepin-pdfium)
# PDF 引擎:系统库 deepin-pdfium(模块名由顶层按 Qt 版本选择,Qt5 走 deepin-pdfium5)
pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET ${DEEPIN_PDFIUM_MODULE})

if (XPS_SUPPORT_ENABLED)
pkg_check_modules(XPS_DEPS REQUIRED libgxps cairo glib-2.0 gobject-2.0 freetype2)
Expand Down
12 changes: 9 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ pkg_check_modules(LIBJPEG REQUIRED libjpeg)
pkg_check_modules(DDJVU REQUIRED ddjvuapi)
pkg_check_modules(FREETYPE REQUIRED freetype2)

# PDF 引擎:系统库 deepin-pdfium
pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET deepin-pdfium)

# 查找 Qt 版本(优先 Qt6)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
set(QT_DESIRED_VERSION ${QT_VERSION_MAJOR})

# PDF 引擎:系统库 deepin-pdfium(libdeepin-pdfium/libdeepin-pdfium5 分别
# 基于 Qt6/Qt5 构建,C++ ABI 不兼容,按 Qt 版本选择变体)
if(QT_VERSION_MAJOR MATCHES 6)
set(DEEPIN_PDFIUM_MODULE deepin-pdfium)
else()
set(DEEPIN_PDFIUM_MODULE deepin-pdfium5)
endif()
pkg_check_modules(Deepin-pdfium REQUIRED IMPORTED_TARGET ${DEEPIN_PDFIUM_MODULE})

message(STATUS ">>> Test building with Qt${QT_DESIRED_VERSION}")

# 定义必需的 Qt 组件
Expand Down
Loading