[ Technical exchange] 关于25.2.x版本的base和webengine runtime的qt6组件分布情况
Tofloor
poster avatar
MeGusta
deepin
2026-07-13 21:43
Author

在使用cmake构建一些复杂的qt应用时,因为Qt6组件分散在/usr/runtime中,需要手动指定它们的位置,不然总是有一些找不到,现在总结如下。

使用方法:将下面的内容复制到 build_env_qt6.sh文件,添加执行权限,构建之前,执行 source build_env_qt6.sh

我的使用环境:

base: org.deepin.base/25.2.2
runtime: org.deepin.runtime.webengine/25.2.2
#!/bin/bash

## file: build_env_qt6.sh ##

# 获取环境变量
INSTALL_ROOT="/opt/apps/${LINGLONG_APPID}/files"
TRIPLET=$(cat "/etc/linglong-triplet-list" | xargs)

# 定义Qt6组件搜索根目录
RUNTIME_BASE="/runtime/lib/${TRIPLET}/cmake"
SYS_BASE="/usr/lib/${TRIPLET}/cmake"

# 区分 /runtime (runtime组件) 与 /usr (base组件)

# --- Qt6 编译辅助工具 (位于 /runtime) ---
CMAKE_OPTS+=(
  "-DQt6CoreTools_DIR=${RUNTIME_BASE}/Qt6CoreTools"
  "-DQt6GuiTools_DIR=${RUNTIME_BASE}/Qt6GuiTools"
  "-DQt6WidgetsTools_DIR=${RUNTIME_BASE}/Qt6WidgetsTools"
  "-DQt6LinguistTools_DIR=${RUNTIME_BASE}/Qt6LinguistTools"
)

# --- Qt6 核心基础模块 (位于 /runtime) ---
CMAKE_OPTS+=(
  "-DQt6_DIR=${RUNTIME_BASE}/Qt6"
  "-DQt6Core_DIR=${RUNTIME_BASE}/Qt6Core"
  "-DQt6Gui_DIR=${RUNTIME_BASE}/Qt6Gui"
  "-DQt6Widgets_DIR=${RUNTIME_BASE}/Qt6Widgets"
  "-DQt6Network_DIR=${RUNTIME_BASE}/Qt6Network"
  "-DQt6Sql_DIR=${RUNTIME_BASE}/Qt6Sql"
  "-DQt6Xml_DIR=${RUNTIME_BASE}/Qt6Xml"
  "-DQt6DBus_DIR=${RUNTIME_BASE}/Qt6DBus"
  "-DQt6PrintSupport_DIR=${RUNTIME_BASE}/Qt6PrintSupport"
  "-DQt6Concurrent_DIR=${RUNTIME_BASE}/Qt6Concurrent"
  "-DQt6Test_DIR=${RUNTIME_BASE}/Qt6Test"
  "-DQt6Svg_DIR=${RUNTIME_BASE}/Qt6Svg"
  "-DQt6SvgWidgets_DIR=${RUNTIME_BASE}/Qt6SvgWidgets"
  "-DQt6OpenGL_DIR=${RUNTIME_BASE}/Qt6OpenGL"
  "-DQt6OpenGLWidgets_DIR=${RUNTIME_BASE}/Qt6OpenGLWidgets"
  "-DQt6Core5Compat_DIR=${RUNTIME_BASE}/Qt6Core5Compat"
  "-DQt6UiTools_DIR=${RUNTIME_BASE}/Qt6UiTools"
  "-DQt6Designer_DIR=${RUNTIME_BASE}/Qt6Designer"
  "-DQt6Help_DIR=${RUNTIME_BASE}/Qt6Help"
)

# --- Qt6 QML/Quick 与 WebEngine 模块 (位于 /runtime) ---
CMAKE_OPTS+=(
  "-DQt6Qml_DIR=${RUNTIME_BASE}/Qt6Qml"
  "-DQt6Quick_DIR=${RUNTIME_BASE}/Qt6Quick"
  "-DQt6QuickWidgets_DIR=${RUNTIME_BASE}/Qt6QuickWidgets"
  "-DQt6WebChannel_DIR=${RUNTIME_BASE}/Qt6WebChannel"
  "-DQt6Positioning_DIR=${RUNTIME_BASE}/Qt6Positioning"
  "-DQt6WebEngineCore_DIR=${RUNTIME_BASE}/Qt6WebEngineCore"
  "-DQt6WebEngineWidgets_DIR=${RUNTIME_BASE}/Qt6WebEngineWidgets"
  "-DQt6WebEngineQuick_DIR=${RUNTIME_BASE}/Qt6WebEngineQuick"
)

# --- Qt6 扩展与 3D 模块 (位于 /usr) ---
CMAKE_OPTS+=(
  "-DQt6SerialPort_DIR=${SYS_BASE}/Qt6SerialPort"
  "-DQt63DCore_DIR=${SYS_BASE}/Qt63DCore"
  "-DQt63DRender_DIR=${SYS_BASE}/Qt63DRender"
  "-DQt63DInput_DIR=${SYS_BASE}/Qt63DInput"
  "-DQt63DLogic_DIR=${SYS_BASE}/Qt63DLogic"
  "-DQt63DAnimation_DIR=${SYS_BASE}/Qt63DAnimation"
  "-DQt63DExtras_DIR=${SYS_BASE}/Qt63DExtras"
  "-DQt63DQuick_DIR=${SYS_BASE}/Qt63DQuick"
  "-DQt63DQuickRender_DIR=${SYS_BASE}/Qt63DQuickRender"
)

# --- 插件安装路径 ---
CMAKE_OPTS+=(
  "-DQT_PLUGINS_DIR=lib/${TRIPLET}/qt6/plugins"
)
Reply Favorite View the author
All Replies

No replies yet