[vlc-commits] [Git][videolan/vlc][master] 4 commits: configure: don't build Qt if qt build tools are missing
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Oct 15 10:45:03 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
5f13c267 by Pierre Lamot at 2025-10-15T10:24:15+00:00
configure: don't build Qt if qt build tools are missing
fix: #29408
- - - - -
fa23eb4a by Pierre Lamot at 2025-10-15T10:24:15+00:00
configure: check that qt is built with XCB support to build x11 video integration plugin
- - - - -
21bf075e by Pierre Lamot at 2025-10-15T10:24:15+00:00
meson: check that qt supports xcb to build X11 integration module
- - - - -
cadb4c50 by Pierre Lamot at 2025-10-15T10:24:15+00:00
configure: extract default moc include path from qmake
https://code.videolan.org/videolan/vlc/-/merge_requests/7297#note_495217
moc is indeed missing some include paths. It is called like:
```
moc .... -I/usr/include/QtQuickControls2 -I/usr/include/QtQuick/6.8.3
-I/usr/include/QtQuick/6.8.3/QtQuick -I/usr/include/QtQuick ...
```
but it doesn't includes /usr/include, so when we run moc with --debug-includes we can see that /usr/include is not considered for the header search paths, so most of the includes fails
here when searching QtQml/qqml.h included by QQmlEngine
```
debug-includes: searching for 'QtQml/qqml.h'
debug-includes: considering '/home/pierre/workspace/vlc/include/QtQml/qqml.h'
debug-includes: considering '../../../include/QtQml/qqml.h'
debug-includes: considering '../../../QtQml/qqml.h'
...
debug-includes: considering './dialogs/vlm/QtQml/qqml.h'
debug-includes: considering './QtQml/qqml.h'
debug-includes: considering '/app/include/QtQml/qqml.h'
debug-includes: can't find 'QtQml/qqml.h'
```
the moc include paths are currently extracted by the script
modules/gui/qt/scripts/static_dirs.py which parse a Makefile generated by
qmake. here the INCPATH variable doesn't contains /usr/include/ likely because
this is already part of $QMAKE_DEFAULT_INCDIRS, qmake's moc call include this
automatically (see /usr/mkspecs/features/moc.prf)
So we need a way for static_dirs.py to either extract $MOC_INCLUDEPATH or
$QMAKE_DEFAULT_INCDIRS.
- - - - -
5 changed files:
- configure.ac
- modules/gui/qt/Makefile.am
- modules/gui/qt/meson.build
- modules/gui/qt/qt6.pro
- modules/gui/qt/scripts/static_dirs.py
Changes:
=====================================
configure.ac
=====================================
@@ -4050,6 +4050,7 @@ have_qt_gui_private="no"
have_qt65="no"
have_qt_zstd="no"
have_fxc="no"
+have_qt_xcb="no"
AS_IF([test "${enable_qt}" != "no"], [
have_qt="yes"
dnl use any qmake that is available, including from contrib tools
@@ -4143,9 +4144,16 @@ AS_IF([test "${enable_qt}" != "no"], [
--builddir ${ac_pwd}/modules/gui/qt \
--ldflags \
${qmake_additional_params})
+ QT_MOC_INCLUDE_DIRS=$(${PYTHON3} ${srcdir}/modules/gui/qt/scripts/static_dirs.py \
+ --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
+ --pro ${srcdir_abs}/modules/gui/qt/qt6.pro \
+ --builddir ${ac_pwd}/modules/gui/qt \
+ --moc_include_dirs \
+ ${qmake_additional_params})
AC_SUBST([QT_LIBS])
AC_SUBST([QT_CFLAGS])
AC_SUBST([QT_LDFLAGS])
+ AC_SUBST([QT_MOC_INCLUDE_DIRS])
QT_LIBEXEC_DIRECTORY="$(${QT_PATHS} -query QT_HOST_LIBEXECS 2>/dev/null)"
QT_QML_LIBEXEC_DIRECTORY=${QT_LIBEXEC_DIRECTORY}
@@ -4156,6 +4164,10 @@ AS_IF([test "${enable_qt}" != "no"], [
AC_PATH_PROGS(RCC, [rcc], rcc, ["${QT_LIBEXEC_DIRECTORY}"])
AC_PATH_PROGS(UIC, [uic], uic, ["${QT_LIBEXEC_DIRECTORY}"])
AC_PATH_PROGS(QSB, [qsb], qsb, ["${QT_SHADERTOOLS_BIN_DIRECTORY}"])
+ AS_IF([test "${MOC}" = "no" -o "${RCC}" = "no" -o "${UIC}" = "no" -o "${QSB}" = "no"], [
+ AC_MSG_WARN([some qt build tools are missing])
+ have_qt="no"
+ ])
AC_PATH_PROGS(QMLCACHEGEN, [qmlcachegen], no, ["${QT_QML_LIBEXEC_DIRECTORY}"])
AS_IF([test "${QMLCACHEGEN}" = "no"], [
AC_MSG_WARN([qmlcachegen not found])
@@ -4194,6 +4206,20 @@ AS_IF([test "${enable_qt}" != "no"], [
],[
AC_MSG_RESULT([no])
])
+
+
+ AC_MSG_CHECKING([if Qt supports xcb])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <qtgui-config.h>]],[[
+ #if QT_FEATURE_xcb != 1
+ #error "Qt doesn't support xcb"
+ #endif
+ ]])], [
+ AC_MSG_RESULT([yes])
+ have_qt_xcb="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ ])
VLC_RESTORE_FLAGS
AC_MSG_CHECKING([for Qt QTest])
@@ -4329,6 +4355,7 @@ AM_CONDITIONAL([HAVE_FXC], [test "${have_fxc}" = "yes"])
AM_CONDITIONAL([HAVE_QT67], [test "${QT_VERSION_MAJ:-0}" -gt "6" || (test "${QT_VERSION_MAJ:-0}" = "6" && test "${QT_VERSION_MIN:-0}" -ge "7")])
AM_CONDITIONAL([HAVE_QT65], [test "${have_qt65}" = "yes"])
AM_CONDITIONAL([HAVE_QT_ZSTD], [test "${have_qt_zstd}" = "yes"])
+AM_CONDITIONAL([HAVE_QT_XCB], [test "${have_qt_xcb}" = "yes"])
dnl
dnl detect kde4-config patch (used for kde solids).
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -573,6 +573,7 @@ endif
# X11 compositor
if HAVE_X
+if HAVE_QT_XCB
if HAVE_XCB
if HAVE_XCB_DAMAGE
if HAVE_XCB_XFIXES
@@ -616,7 +617,7 @@ if ENABLE_QT
gui_LTLIBRARIES += libqt_x11_plugin.la
endif
-
+endif
endif
endif
endif
@@ -716,6 +717,7 @@ uic_verbose__0 = $(uic_verbose_0)
MOC_CPPFLAGS = $(DEFS) \
-I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir) \
+ $(QT_MOC_INCLUDE_DIRS) \
$(QT_CFLAGS) \
$(libqt_plugin_la_CPPFLAGS)
if HAVE_DARWIN
=====================================
modules/gui/qt/meson.build
=====================================
@@ -1046,7 +1046,15 @@ if qt6_dep.found()
]
endif
- if x11_dep.found() and xcb_dep.found()
+ qt_xcb_check = '''
+ #include <qtgui-config.h>
+ #if QT_FEATURE_xcb != 1
+ #error "Qt doesn't have xcb support"
+ #endif
+ '''
+ qt_features_xcb = cpp.compiles(qt_xcb_check, dependencies: qt6_dep, name: 'Qt features xcb')
+
+ if x11_dep.found() and xcb_dep.found() and qt_features_xcb
qt_extra_deps += xcb_dep
qt_extra_deps += x11_dep
qt_extra_flags += '-DQT_HAS_XCB'
=====================================
modules/gui/qt/qt6.pro
=====================================
@@ -38,3 +38,8 @@ qtHaveModule(quick-private) {
QT += quick-private
DEFINES += QT_DECLARATIVE_PRIVATE
}
+
+#Get default include paths for moc
+#moc_incude_dirs is not a real command, it only serves as a marker for grepping
+moc_include_dirs_target.commands = moc_include_dirs $$QMAKE_DEFAULT_INCDIRS
+QMAKE_EXTRA_TARGETS += moc_include_dirs_target
=====================================
modules/gui/qt/scripts/static_dirs.py
=====================================
@@ -60,12 +60,17 @@ if __name__ == "__main__":
parser.add_argument("--debug",
required=False, action='store_true',
help="debug mode")
+ parser.add_argument("--moc_include_dirs",
+ required=False, action='store_true',
+ help="moc include dirs")
args = parser.parse_args()
result = ''
sources = [ os.path.join(args.builddir, '.qmake.stash') ]
in_sources = False
makefile = call_qmake(args.qmake, args.qtconf, args.builddir, args.pro, args.debug)
+
+ moc_include_dirs_re = re.compile(r"^\s+moc_include_dirs\s+(.*)")
for line in makefile.splitlines():
if in_sources:
l = line.strip()
@@ -110,6 +115,11 @@ if __name__ == "__main__":
result += ' -l' + libname[3:]
else:
result += ' ' + lib
+ elif args.moc_include_dirs:
+ m = moc_include_dirs_re.match(line)
+ if m:
+ for i in l.strip().split(' '):
+ result += f"-I{i}"
for generated in sources:
if os.path.exists(generated):
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f2bba518de7b6e42312906bf64a745d0e770a3cd...cadb4c502c8f55070654309371a9104ec29ecf38
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f2bba518de7b6e42312906bf64a745d0e770a3cd...cadb4c502c8f55070654309371a9104ec29ecf38
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list