[vlc-commits] [Git][videolan/vlc][master] 14 commits: configure: probe tool `qmltyperegistrar`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Nov 25 05:51:34 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
51924d3c by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
configure: probe tool `qmltyperegistrar`
- - - - -
87ed24f5 by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
configure: expose `QT_INSTALL_ARCHDATA` path
- - - - -
249dd6bd by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
qt: add script `collectmetatypejson.py`
- - - - -
ce07b0b4 by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
qt: introduce argument `--typeinfo` in `genqmldir.py`
- - - - -
4aa675e3 by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
qt: make use of `qmltyperegistrar`
- - - - -
bcf5c1f5 by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
configure: expose `QT_INSTALL_QML` path
- - - - -
dee3389e by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
qt: fix `qmlcachegen` invocation for cross compilation
In cross compile cases, `qmlcachegen` should use
the import from the target qml modules, not the
host one.
- - - - -
61ade19a by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
qt: mark `qmldir` file as precious
- - - - -
16f5813a by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
qt: fix `qmlcachegen` is not provided with internal dependency modules
Our modules depend on our other modules, so we need
to provide all our modules to `qmlcachegen`.
- - - - -
e3dee706 by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
qt: use `QML_CACHEGEN_EXTRA_ARGS` also when generating `qmlcache_loader.cpp`
- - - - -
50b5236f by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
qt: move qml files into `qml` subdirectory in `VLC.Style` module
In all other modules this is already the case. Without this change,
sometimes the build fails due to `qmlcachegen` erroring out with
message "No resource path for file: ...".
- - - - -
527af141 by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
qt: create `qmlimportdir` consisting of qml modules in build directory
This directory consists of relative symbolic links
to the module directories, which contains the (also)
qml symbolic link files, `qmldir` and `.qmltypes`
file.
This is mainly an accessory to provide `qmlls` the
import directory.
- - - - -
fbd7724f by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
Add `.qmlls.ini` to `.gitignore`
- - - - -
0741280a by Fatih Uzunoglu at 2026-11-25T05:39:58+00:00
qt: use `qmlimportdir` when invoking `qmlcachegen`
Now that we create `qmlimportdir` for `qmlls`, we
can simply use it for `qmlcachegen` as well.
- - - - -
8 changed files:
- .gitignore
- configure.ac
- modules/gui/qt/Makefile.am
- modules/gui/qt/meson.build
- + modules/gui/qt/scripts/collectmetatypejson.py
- modules/gui/qt/scripts/genqmldir.py
- modules/gui/qt/style/AcrylicController.qml → modules/gui/qt/style/qml/AcrylicController.qml
- modules/gui/qt/style/VLCStyle.qml → modules/gui/qt/style/qml/VLCStyle.qml
Changes:
=====================================
.gitignore
=====================================
@@ -20,6 +20,7 @@
.deps
.libs
.dirstamp
+.qmlls.ini
ABOUT-NLS
aclocal.m4
Cargo.lock
=====================================
configure.ac
=====================================
@@ -4392,6 +4392,8 @@ AS_IF([test "${enable_qt}" != "no"], [
QT_LIBEXEC_DIRECTORY="$(${QT_PATHS} -query QT_HOST_LIBEXECS 2>/dev/null)"
QT_QML_LIBEXEC_DIRECTORY=${QT_LIBEXEC_DIRECTORY}
QT_SHADERTOOLS_BIN_DIRECTORY=${QT_BIN_DIRECTORY}
+ QT_ARCHDATA_DIRECTORY="$(${QT_PATHS} -query QT_INSTALL_ARCHDATA 2>/dev/null )"
+ QT_QML_DIRECTORY="$(${QT_PATHS} -query QT_INSTALL_QML 2>/dev/null )"
dnl check native in contribs and keep the full path if found there
AC_PATH_PROGS(MOC, [moc], moc, ["${QT_LIBEXEC_DIRECTORY}"])
@@ -4406,6 +4408,10 @@ AS_IF([test "${enable_qt}" != "no"], [
AS_IF([test "${QMLCACHEGEN}" = "no"], [
AC_MSG_WARN([qmlcachegen not found])
])
+ AC_PATH_PROGS(QMLTYPEREGISTRAR, [qmltyperegistrar], no, ["${QT_QML_LIBEXEC_DIRECTORY}"])
+ AS_IF([test "${QMLTYPEREGISTRAR}" = "no"], [
+ AC_MSG_WARN([qmltyperegistrar not found])
+ ])
AC_MSG_CHECKING([if required Qt plugins are installed with ${QMAKE6} and conf ${with_qtconf}])
@@ -4569,6 +4575,7 @@ AC_ARG_ENABLE([qt-qml-cache],
AS_HELP_STRING([--disable-qt-qml-cache],
[disable qml cache generation and basic error checking]))
AM_CONDITIONAL([HAVE_QMLCACHEGEN], [test "${enable_qt_qml_cache}" != "no" && test "$QMLCACHEGEN" != "no"])
+AM_CONDITIONAL([HAVE_QMLTYPEREGISTRAR], [test "$QMLTYPEREGISTRAR" != "no"])
AC_ARG_ENABLE([qt-qml-debug],
AS_HELP_STRING([--enable-qt-qml-debug], [enable qml debugger]))
@@ -4577,7 +4584,8 @@ AM_CONDITIONAL(QT_QML_DEBUG, [test "${enable_qt_qml_debug}" = "yes"])
AS_IF([test "${enable_qt}" != "no"], [
ALIASES="${ALIASES} qvlc"
])
-AC_SUBST([QT_INDIRECT_LIBS])
+AC_SUBST([QT_ARCHDATA_DIRECTORY])
+AC_SUBST([QT_QML_DIRECTORY])
AM_CONDITIONAL([ENABLE_QT], [test "$enable_qt" != "no"])
AM_CONDITIONAL([HAVE_QT_GTK], [test "${have_qt_gtk}" = "yes"])
AM_CONDITIONAL([HAVE_QT_QTEST], [test "${have_qt_qtest}" = "yes"])
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -393,11 +393,18 @@ moc_verbose_ = $(moc_verbose__$(AM_DEFAULT_VERBOSITY))
moc_verbose_0 = @echo " MOC " $@;
moc_verbose__0 = $(moc_verbose_0)
+MOC_EXTRA_ARGS =
+if HAVE_QMLTYPEREGISTRAR
+if HAVE_QMLCACHEGEN
+MOC_EXTRA_ARGS += --output-json
+endif
+endif
+
.hpp.moc.cpp:
- $(moc_verbose)$(MOC) $(MOC_CPPFLAGS) -o $@ $<
+ $(moc_verbose)$(MOC) $(MOC_CPPFLAGS) -o $@ $< $(MOC_EXTRA_ARGS)
.cpp.moc:
- $(moc_verbose)$(MOC) $(MOC_CPPFLAGS) -o $@ $<
+ $(moc_verbose)$(MOC) $(MOC_CPPFLAGS) -o $@ $< $(MOC_EXTRA_ARGS)
# These MOC files depend on the configure settings:
dialogs/dialogs_provider.moc.cpp dialogs/vlm/vlm.moc.cpp: $(top_builddir)/config.h
@@ -545,6 +552,12 @@ nodist_libqt_plugin_la_SOURCES = \
widgets/native/roundedcornermask.moc.cpp \
widgets/native/fadingedgemask.moc.cpp
+if HAVE_QMLTYPEREGISTRAR
+if HAVE_QMLCACHEGEN
+CLEANFILES += $(nodist_libqt_plugin_la_SOURCES:.moc.cpp=.moc.cpp.json)
+endif
+endif
+
nodist_libqt_plugin_la_SOURCES += \
dialogs/extended/ui_equalizer.h \
dialogs/extended/ui_video_effects.h \
@@ -1032,6 +1045,9 @@ endif
# 3. Add a QML_MODULE_foo_SRC / QML_MODULE_foo_NODIST_EXTRA pair to the
# "if HAVE_QMLCACHEGEN" block below.
#
+# The import path for QML modules is located in `qmlimportdir`, which can
+# be used to configure `qmlls`. If you use Qt Creator, you may create
+# `.qmlls.ini` file with `importPaths` entry pointing to `qmlimportdir`.
noinst_LIBRARIES =
QML_MODULE_LIBS =
@@ -1276,8 +1292,8 @@ libqml_module_style_a_CXXFLAGS = $(libqt_plugin_la_CXXFLAGS)
libqml_module_style_a_CPPFLAGS = $(libqt_plugin_la_CPPFLAGS)
libqml_module_style_a_QML =
libqml_module_style_a_Singleton_QML = \
- style/AcrylicController.qml \
- style/VLCStyle.qml
+ style/qml/AcrylicController.qml \
+ style/qml/VLCStyle.qml
libqml_module_style_a_SOURCES = $(QML_MODULE_style_SRC)
nodist_libqml_module_style_a_SOURCES = style/qmlassets.cpp $(QML_MODULE_style_NODIST_EXTRA)
QML_MODULE_LIBS += libqml_module_style.a
@@ -1446,6 +1462,9 @@ libqt_plugin_la_QML_MODULES = \
util \
widgets
+# qmlcachegen must be provided every other module within each module because of dependency:
+QML_CACHEGEN_EXTRA_ARGS = -I $(builddir)/qmlimportdir
+
libqt_plugin_la_ALL_QML = \
$(libqml_module_dialogs_a_QML) \
$(libqml_module_maininterface_a_QML) \
@@ -1578,18 +1597,30 @@ endif
# text functions.
QML_RULES_DEPS = $(libqt_plugin_la_QML_MODULES:=/qml.deps)
+QML_QMLTYPES_DEP =
+if HAVE_QMLTYPEREGISTRAR
+if HAVE_QMLCACHEGEN
+QML_QMLTYPES_DEP = $(@D)/plugins.qmltypes
+endif
+endif
+
# Since every QML modules is built into a given directory, we can use $(@D)
# to get the module name.
$(QML_RULES_DEPS): Makefile
$(AM_V_at)$(MKDIR_P) $(@D)
$(AM_V_at){ \
echo '$(@D)/qmldir.qrc: $(@D)/qmldir'; \
- echo '$(@D)/res.qrc $(@D)/qmldir: $(@D)/qml_modules.stamp'; \
+ echo '$(@D)/res.qrc $(@D)/qmldir: $(@D)/qml_modules.stamp $(QML_QMLTYPES_DEP)'; \
echo '$(@D)/qmlcachegen.rsp: $$(builddir)/$(@D)/res.qrc'; \
echo '$(@D)/qmlcache_loader.cpp: $(@D)/qmlcachegen.rsp'; \
echo '$(@D)/qmlassets.cpp: $$(builddir)/$(@D)/qmldir.qrc $$(builddir)/$(@D)/res.qrc'; \
echo '$(@D)/qmlassets.cpp: $$(libqml_module_$(@D)_a_QML) $$(libqml_module_$(@D)_a_Singleton_QML)'; \
echo '$$(libqml_module_$(@D)_a_QML:.qml=.cpp) $$(libqml_module_$(@D)_a_Singleton_QML:.qml=.cpp): $$(builddir)/$(@D)/res.qrc'; \
+ qmldirs=; \
+ for s in $(libqt_plugin_la_QML_MODULES); do \
+ qmldirs="$$qmldirs \$$(builddir)/$$s/qmldir"; \
+ done; \
+ echo '$$(libqml_module_$(@D)_a_QML:.qml=.cpp) $$(libqml_module_$(@D)_a_Singleton_QML:.qml=.cpp):'"$$qmldirs"; \
} > $@.tmp && mv $@.tmp $@
BUILT_SOURCES += $(QML_RULES_DEPS)
@@ -1624,13 +1655,110 @@ $(QML_MODULE_RES_QRC):
--prefix qt/qml/$(libqml_module_$(@D)_a_ModulePath) \
--sources $(libqml_module_$(@D)_a_QML) $(libqml_module_$(@D)_a_Singleton_QML)
+# We symlink the QML files to the qmldir directory, because our modules may depend on
+# each other, and `qmlcachegen` should access them. In the future, when we eliminate
+# cyclic dependency, instead of this we can provide the compiled files to each module.
$(QML_MODULE_QMLDIR):
+ $(AM_V_at) for f in $(libqml_module_$(@D)_a_QML); do \
+ $(LN_S) -f $(abs_srcdir)/$$f $(@D)/; \
+ done
+ $(AM_V_at) for f in $(libqml_module_$(@D)_a_Singleton_QML); do \
+ $(LN_S) -f $(abs_srcdir)/$$f $(@D)/; \
+ done
$(AM_V_GEN)$(PYTHON3) $(srcdir)/scripts/genqmldir.py \
-o $@ \
--prefix qt/qml \
--module $(libqml_module_$(@D)_a_Module) \
--sources $(libqml_module_$(@D)_a_QML) \
- --singletons $(libqml_module_$(@D)_a_Singleton_QML)
+ --singletons $(libqml_module_$(@D)_a_Singleton_QML) \
+ --typeinfo=plugins.qmltypes
+ $(AM_V_at) $(MKDIR_P) qmlimportdir/$(libqml_module_$(@D)_a_ModulePath)
+ $(AM_V_at) $(LN_S) -f $(abs_builddir)/$@ qmlimportdir/$(libqml_module_$(@D)_a_ModulePath)
+ $(AM_V_at) for f in $(libqml_module_$(@D)_a_QML); do \
+ $(LN_S) -f $(abs_srcdir)/$$f qmlimportdir/$(libqml_module_$(@D)_a_ModulePath); \
+ done
+ $(AM_V_at) for f in $(libqml_module_$(@D)_a_Singleton_QML); do \
+ $(LN_S) -f $(abs_srcdir)/$$f qmlimportdir/$(libqml_module_$(@D)_a_ModulePath); \
+ done
+
+# Akin to QML_RULES_DEPS:
+QML_SYMLINK_FILE_DEPS = $(libqt_plugin_la_QML_MODULES:=/qmlsymlinkfiles.deps)
+$(QML_SYMLINK_FILE_DEPS): Makefile
+ $(AM_V_at)$(MKDIR_P) $(@D)
+ $(AM_V_at){ \
+ for f in $(libqml_module_$(@D)_a_ModulePath); do \
+ echo "CLEANFILES += qmlimportdir/$$f/qmldir qmlimportdir/$$f/plugins.qmltypes"; \
+ done; \
+ for f in $(libqml_module_$(@D)_a_QML) $(libqml_module_$(@D)_a_Singleton_QML); do \
+ echo "CLEANFILES += $(@D)/$$(basename $$f)"; \
+ echo "CLEANFILES += qmlimportdir/$(libqml_module_$(@D)_a_ModulePath)/$$(basename $$f)"; \
+ done; \
+ } > $@.tmp && mv $@.tmp $@
+
+BUILT_SOURCES += $(QML_SYMLINK_FILE_DEPS)
+
+-include $(QML_SYMLINK_FILE_DEPS)
+
+# qmldir must remain because `qmlcachegen` needs it:
+.PRECIOUS: $(libqt_plugin_la_QML_MODULES:=/qmldir)
+
+QT_METATYPES = $(libqt_plugin_la_QML_MODULES:=/metatypes.moc.json)
+$(QT_METATYPES): $(nodist_libqt_plugin_la_SOURCES)
+ $(AM_V_GEN)$(PYTHON3) $(srcdir)/scripts/collectmetatypejson.py \
+ -o $@ \
+ --moc $(MOC) \
+ --metatypejsondir="$(@D)/"
+
+# FIXME: It does not seem qmake is able to query the path for metatypes
+QT_METATYPES_DIR = $(QT_ARCHDATA_DIRECTORY)/metatypes
+
+if HAVE_QMLTYPEREGISTRAR
+if HAVE_QMLCACHEGEN
+
+qmltyperegistrar_verbose = $(qmltyperegistrar_verbose_$(V))
+qmltyperegistrar_verbose_ = $(qmltyperegistrar_verbose__$(AM_DEFAULT_VERBOSITY))
+qmltyperegistrar_verbose_0 = @echo " TYPEREG " $@;
+qmltyperegistrar_verbose__0 = $(qmltyperegistrar_verbose_0)
+
+QMLTYPEREGISTRAR_EXTRA_ARGS = --follow-foreign-versioning
+
+# We provide the built-in Qt metatypes, and other modules of VLC.
+# Note that we currently do not make use of `qmltyperegistrations.cpp`
+
+QML_TYPES = $(libqt_plugin_la_QML_MODULES:=/plugins.qmltypes)
+$(QML_TYPES): $(QT_METATYPES)
+ $(qmltyperegistrar_verbose) \
+ found=; \
+ for f in $(QT_METATYPES_DIR)/*.json; do \
+ [ -f "$$f" ] && found=1 && break; \
+ done; \
+ if [ -z "$$found" ]; then \
+ echo "error: no Qt metatypes (*.json) found in '$(QT_METATYPES_DIR)', check QT_METATYPES_DIR" >&2; \
+ exit 1; \
+ fi; \
+ foreign=; \
+ for f in $^ $(QT_METATYPES_DIR)/*.json; do \
+ [ -f "$$f" ] || continue; \
+ foreign="$${foreign:+$$foreign,}$$f"; \
+ done; \
+ $(QMLTYPEREGISTRAR) \
+ --import-name=$(libqml_module_$(@D)_a_Module) \
+ --major-version=1 --minor-version=0 \
+ --private-includes $(QMLTYPEREGISTRAR_EXTRA_ARGS) \
+ -o $(@D)/qmltyperegistrations.cpp \
+ --generate-qmltypes=$@ $(@D)/metatypes.moc.json \
+ --foreign-types="$$foreign"
+ $(AM_V_at) $(MKDIR_P) qmlimportdir/$(libqml_module_$(@D)_a_ModulePath)
+ $(AM_V_at) $(LN_S) -f $(abs_builddir)/$@ qmlimportdir/$(libqml_module_$(@D)_a_ModulePath)
+
+CLEANFILES += $(QML_TYPES) $(libqt_plugin_la_QML_MODULES:=/qmltyperegistrations.cpp) $(libqt_plugin_la_QML_MODULES:=/metatypes.moc.json)
+
+if ENABLE_QT
+BUILT_SOURCES += $(QML_TYPES)
+endif
+
+endif # HAVE_QMLCACHEGEN
+endif # HAVE_QMLTYPEREGISTRAR
$(QML_MODULE_QMLDIR_QRC):
$(AM_V_GEN)$(PYTHON3) $(srcdir)/scripts/genqrc.py -o $@ \
@@ -1647,7 +1775,10 @@ cachegen_verbose_ = $(cachegen_verbose__$(AM_DEFAULT_VERBOSITY))
cachegen_verbose_0 = @echo " CACHEGEN " $@;
cachegen_verbose__0 = $(cachegen_verbose_0)
-QML_CACHEGEN_EXTRA_ARGS=--validate-basic-blocks
+# We need to use --bare because we need to support cross compilation:
+QML_CACHEGEN_EXTRA_ARGS += --bare -I $(QT_QML_DIRECTORY)
+
+QML_CACHEGEN_EXTRA_ARGS += --validate-basic-blocks
# Each .qml/.js/.mjs is compiled with its module's res.qrc as prerequisite. The
# per-module qrc isn't derivable from the target path, so pick it out of $^.
@@ -1673,7 +1804,7 @@ $(QML_MODULE_CACHEGEN_RSP):
$(AM_V_GEN)$(PYTHON3) $(srcdir)/scripts/qrc2rsp.py --output $@ $^
$(QML_MODULE_CACHELOADER):
- $(cachegen_verbose)$(QMLCACHEGEN) --resource-name $(@D)_cachegen --resource=$(builddir)/$(@D)/res.qrc -o $@ @$<
+ $(cachegen_verbose)$(QMLCACHEGEN) $(QML_CACHEGEN_EXTRA_ARGS) --resource-name $(@D)_cachegen --resource=$(builddir)/$(@D)/res.qrc -o $@ @$<
$(QML_MODULE_CACHEGEN_ASSETS):
$(AM_V_GEN)$(RCC) $(RCC_EXTRA_PARAMS) --name $(@D)_assets -o $@ $<
@@ -1768,7 +1899,7 @@ nodist_base_model_test_SOURCES = tests/test_base_model.moc \
util/locallistcacheloader.moc.cpp
BUILT_SOURCES += tests/test_base_model.moc
-CLEANFILES += tests/test_base_model.moc
+CLEANFILES += tests/test_base_model.moc tests/test_base_model.moc.json
base_model_test_CPPFLAGS = $(QT_QTEST_COMMON_cppflags)
base_model_test_CXXFLAGS = $(QT_QTEST_COMMON_cxxflags)
base_model_test_LDADD = $(QT_QTEST_COMMON_ldadd)
@@ -1807,7 +1938,7 @@ nodist_test_ml_model_SOURCES = \
playlist/playlist_item.moc.cpp
BUILT_SOURCES += tests/test_ml_model.moc
-CLEANFILES += tests/test_ml_model.moc
+CLEANFILES += tests/test_ml_model.moc tests/test_ml_model.moc.json
test_ml_model_CPPFLAGS = $(QT_QTEST_COMMON_cppflags)
test_ml_model_CXXFLAGS = $(QT_QTEST_COMMON_cxxflags)
test_ml_model_LDADD = $(QT_QTEST_COMMON_ldadd)
@@ -1827,7 +1958,7 @@ nodist_test_renderer_manager_model_SOURCES = \
util/renderer_manager.moc.cpp
BUILT_SOURCES += tests/test_renderer_manager_model.moc
-CLEANFILES += tests/test_renderer_manager_model.moc
+CLEANFILES += tests/test_renderer_manager_model.moc tests/test_renderer_manager_model.moc.json
test_renderer_manager_model_CPPFLAGS = $(QT_QTEST_COMMON_cppflags)
test_renderer_manager_model_CXXFLAGS = $(QT_QTEST_COMMON_cxxflags)
test_renderer_manager_model_LDADD = $(QT_QTEST_COMMON_ldadd)
@@ -1846,7 +1977,7 @@ nodist_test_thread_runner_SOURCES = \
medialibrary/mlthreadpool.moc.cpp
BUILT_SOURCES += tests/test_thread_runner.moc
-CLEANFILES += tests/test_thread_runner.moc
+CLEANFILES += tests/test_thread_runner.moc tests/test_thread_runner.moc.json
test_thread_runner_CPPFLAGS = $(QT_QTEST_COMMON_cppflags)
test_thread_runner_CXXFLAGS = $(QT_QTEST_COMMON_cxxflags)
test_thread_runner_LDADD = $(QT_QTEST_COMMON_ldadd)
@@ -1866,7 +1997,7 @@ nodist_test_vlc_dialog_model_SOURCES = \
dialogs/dialogs/dialogmodel.moc.cpp
BUILT_SOURCES += tests/test_vlc_dialog_model.moc
-CLEANFILES += tests/test_vlc_dialog_model.moc
+CLEANFILES += tests/test_vlc_dialog_model.moc tests/test_vlc_dialog_model.moc.json
test_vlc_dialog_model_CPPFLAGS = $(QT_QTEST_COMMON_cppflags)
test_vlc_dialog_model_CXXFLAGS = $(QT_QTEST_COMMON_cxxflags)
test_vlc_dialog_model_LDADD = $(QT_QTEST_COMMON_ldadd)
@@ -1887,7 +2018,7 @@ nodist_test_qt_csd_button_model_SOURCES = \
tests/test_qt_csd_button_model.moc \
util/csdbuttonmodel.moc.cpp
BUILT_SOURCES += tests/test_qt_csd_button_model.moc
-CLEANFILES += tests/test_qt_csd_button_model.moc
+CLEANFILES += tests/test_qt_csd_button_model.moc tests/test_qt_csd_button_model.moc.json
test_qt_csd_button_model_CPPFLAGS = $(QT_QTEST_COMMON_cppflags)
test_qt_csd_button_model_CXXFLAGS = $(QT_QTEST_COMMON_cxxflags)
test_qt_csd_button_model_LDADD = $(QT_QTEST_COMMON_ldadd)
@@ -1905,7 +2036,7 @@ nodist_test_qt_navigation_model_SOURCES = \
maininterface/navigationmodel.moc.cpp
BUILT_SOURCES += tests/test_navigation_model.moc
-CLEANFILES += tests/test_navigation_model.moc
+CLEANFILES += tests/test_navigation_model.moc tests/test_navigation_model.moc.json
test_qt_navigation_model_CPPFLAGS = $(QT_QTEST_COMMON_cppflags)
test_qt_navigation_model_CXXFLAGS = $(QT_QTEST_COMMON_cxxflags)
test_qt_navigation_model_LDADD = $(QT_QTEST_COMMON_ldadd)
@@ -1921,7 +2052,7 @@ QML_LOG_COMPILER = $(builddir)/qml_test -input
if HAVE_QT_QUICK_TEST
qml_test_SOURCES = tests/qml_test.cpp tests/qml_test.hpp
nodist_qml_test_SOURCES = tests/qml_test.moc.cpp
-CLEANFILES += $(nodist_qml_test_SOURCES)
+CLEANFILES += $(nodist_qml_test_SOURCES) $(nodist_qml_test_SOURCES:.moc.cpp=.moc.cpp.json)
qml_test_CPPFLAGS = $(libqt_plugin_la_CPPFLAGS)
qml_test_CXXFLAGS = $(AM_CXXFLAGS) $(QT_CFLAGS) -fPIC $(CXXFLAGS_qt) ${QT_QUICK_TEST_CFLAGS} -DQUICK_TEST_SOURCE_DIR="\"${srcdir}/tests\"" -I"${builddir}/tests"
qml_test_LDADD = $(QT_INDIRECT_LIBS) ${QT_QUICK_TEST_LIBS} $(QT_LIBS) $(LIBS_qt) libqml_module_util.a
=====================================
modules/gui/qt/meson.build
=====================================
@@ -838,8 +838,8 @@ qml_modules += {
'target' : 'style',
'outdir' : 'VLC/Style',
'singletons': files(
- 'style/AcrylicController.qml',
- 'style/VLCStyle.qml',
+ 'style/qml/AcrylicController.qml',
+ 'style/qml/VLCStyle.qml',
),
}
=====================================
modules/gui/qt/scripts/collectmetatypejson.py
=====================================
@@ -0,0 +1,64 @@
+import os
+from pathlib import Path
+import sys
+import argparse
+import glob
+import subprocess
+
+def collectJson(mocpath, jsondir, output):
+ path = str(Path(jsondir).resolve())
+
+ # https://stackoverflow.com/questions/18394147/how-to-do-a-recursive-sub-folder-search-and-return-files-in-a-list:
+ files = glob.glob(path + '/**/*.moc*.json', recursive=True)
+
+ outputbasename = os.path.basename(output)
+
+ filtered = []
+ for f in files:
+ if os.path.basename(f) != outputbasename:
+ filtered.append(f)
+ files = filtered
+
+ if not files:
+ print(f"warning: no input files found under '{path}', output {output} will be an empty json file", file=sys.stderr)
+ Path(output).write_text("[]\n")
+ return 0
+
+ moc = [mocpath, "--collect-json", "-o", output, *files]
+
+ try:
+ result = subprocess.run(moc)
+ except FileNotFoundError:
+ print(f"error: could not run the provided moc with path {mocpath}", file=sys.stderr)
+ return 1
+
+ if result.returncode != 0:
+ print(f"error: moc --collect-json failed with exit code {result.returncode} for output: {output} and input directory: {jsondir}", file=sys.stderr)
+
+ return result.returncode
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(
+ description='This program collects json through moc. Input directory is recursively searched for *.moc*.json files, excluding the ones that match the output file name. If input directory is not specified, the current directory is used.'
+ )
+ parser.add_argument("-o", "--output", help="output collected json file, if empty 'metatypes.moc.json' is used.")
+ parser.add_argument("--moc", help="path for moc, if empty it will be sourced from the PATH.")
+ parser.add_argument("--metatypejsondir", help="directory that will be recursively searched for *.moc*.json files for collecting meta type info.")
+ args = parser.parse_args()
+
+ if not args.output:
+ args.output = "metatypes.moc.json"
+
+ if not args.metatypejsondir:
+ args.metatypejsondir = "."
+
+ if not args.moc:
+ args.moc = "moc"
+
+ #ensure outdir exists
+ outdir = os.path.dirname(args.output)
+ if outdir:
+ os.makedirs(outdir, exist_ok=True)
+
+ ret = collectJson(args.moc, args.metatypejsondir, args.output)
+ sys.exit(ret)
=====================================
modules/gui/qt/scripts/genqmldir.py
=====================================
@@ -3,9 +3,11 @@ from pathlib import Path
import sys
import argparse
-def genQmldir(out, files, singletons, module, prefix, version):
+def genQmldir(out, files, singletons, module, prefix, version, typeinfo):
out.write(f"module {module}\n")
out.write(f"prefer :{prefix}/\n")
+ if typeinfo:
+ out.write(f"typeinfo {typeinfo}\n")
for f in files:
basename = Path(f).stem
filename = os.path.basename(f)
@@ -27,14 +29,20 @@ if __name__ == "__main__":
parser.add_argument("--module", required=True, help="module name")
parser.add_argument("--singletons", action='append', default=[], nargs='*', metavar=("CLASS"), help="mark CLASS as a singleton")
parser.add_argument("--sources", action='append', default=[], nargs='*', metavar=("CLASS"), help="mark CLASS as a singleton")
+ parser.add_argument("--typeinfo", help="qmltypes type info")
args = parser.parse_args()
prefix = os.path.join("/", args.prefix, *args.module.split("."))
singletons = [os.path.join(args.srcdir, s) for s in args.singletons[0]]
files = [os.path.join(args.srcdir, relpath) for relpath in args.sources[0]]
+ if args.typeinfo:
+ typeinfo = args.typeinfo
+ else:
+ typeinfo = False
+
#ensure outdir exists
os.makedirs(os.path.dirname(args.output), exist_ok=True)
with open(args.output, "w+") as fd:
- genQmldir(fd, files, singletons, args.module, prefix, args.version)
+ genQmldir(fd, files, singletons, args.module, prefix, args.version, typeinfo)
=====================================
modules/gui/qt/style/AcrylicController.qml → modules/gui/qt/style/qml/AcrylicController.qml
=====================================
=====================================
modules/gui/qt/style/VLCStyle.qml → modules/gui/qt/style/qml/VLCStyle.qml
=====================================
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d3f8b7afffb26628498de515b9b3382f785eaaa4...0741280a41b11fe4e1fdf52320be7f834eca6378
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d3f8b7afffb26628498de515b9b3382f785eaaa4...0741280a41b11fe4e1fdf52320be7f834eca6378
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list