[vlc-commits] [Git][videolan/vlc][master] 7 commits: qt: add a python script to get the libs/flags to use for a .pro file

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Jan 11 13:29:21 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e6984f24 by Steve Lhomme at 2025-01-11T13:13:17+00:00
qt: add a python script to get the libs/flags to use for a .pro file

This is similar to what the configure script does.

- - - - -
1ab1a433 by Steve Lhomme at 2025-01-11T13:13:17+00:00
configure: require python to build the Qt module

This is already the case, but it's more explicit.

- - - - -
a8cb3af7 by Steve Lhomme at 2025-01-11T13:13:17+00:00
configure: use the python script to get cflags/libs/ldflags

- - - - -
bd702d78 by Steve Lhomme at 2025-01-11T13:13:17+00:00
meson: get Qt defines/linker flags matching to plugins we use

static plugins are not supported by the meson Qt module.

This works like the code in configure.ac.
We already require python to build the Qt6 module in autoconf and meson.

- - - - -
9d91ea07 by Steve Lhomme at 2025-01-11T13:13:17+00:00
configure: get the private availability defines directly from qt6.pro

Co-authored-by: Fatih Uzunoglu <fuzun54 at outlook.com>

- - - - -
eead96e2 by Steve Lhomme at 2025-01-11T13:13:17+00:00
qt: add missing qtest.pro to the source distribution

- - - - -
97c00b58 by Steve Lhomme at 2025-01-11T13:13:17+00:00
qt: add missing vlc_stub_modules.hpp to the source distribution

- - - - -


8 changed files:

- configure.ac
- modules/gui/qt/Makefile.am
- modules/gui/qt/meson.build
- − modules/gui/qt/private-core.pro
- − modules/gui/qt/private-gui.pro
- − modules/gui/qt/private-quick.pro
- modules/gui/qt/qt6.pro
- + modules/gui/qt/scripts/static_dirs.py


Changes:

=====================================
configure.ac
=====================================
@@ -3992,9 +3992,7 @@ AC_ARG_ENABLE([qt],
 have_qt_gtk="no"
 have_qt_qtest="no"
 have_qt_quick_test="no"
-have_qt_declarative_private="no"
 have_qt_gui_private="no"
-have_qt_core_private="no"
 have_qt65="no"
 have_qt_zstd="no"
 have_fxc="no"
@@ -4054,33 +4052,36 @@ AS_IF([test "${enable_qt}" != "no"], [
   ], [])
 
   QT_BIN_DIRECTORY="$(${QT_PATHS}         -query QT_HOST_BINS 2>/dev/null)"
-  QMAKE="${QT_PATHS}"
-  AC_MSG_NOTICE([using ${QMAKE}])
+  AC_MSG_NOTICE([using ${QT_PATHS}])
+
+  AC_CHECK_PROGS(PYTHON3, [python3], [no])
+  AS_IF([test "$PYTHON3" == "no"], [
+    AC_MSG_WARN([python is required to detect Qt libraries/flags])
+    have_qt="no"
+  ],[
 
   AC_MSG_CHECKING([for Qt libraries])
-  mkdir -p ${ac_pwd}/modules/gui/qt
-  touch    ${ac_pwd}/modules/gui/qt/.qmake.stash
-  QT_PKG_ERRORS=$(${QMAKE} ${srcdir}/modules/gui/qt/qt6.pro -o ${ac_pwd}/modules/gui/qt/qmake-qt 2>&1)
+  srcdir_abs=`(cd ${srcdir} && pwd -P)`
+  QT_PKG_ERRORS=$(${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 \
+    --libs)
   ac_status=$?
-  AS_IF([test $ac_status = 0 && test -f ${ac_pwd}/modules/gui/qt/qmake-qt],[
-      echo "get_cflags:"                    > ${ac_pwd}/modules/gui/qt/qmake-common.mk
-      echo '	$(info $(DEFINES) $(INCPATH))' >> ${ac_pwd}/modules/gui/qt/qmake-common.mk
-      echo "get_libs:"                      >> ${ac_pwd}/modules/gui/qt/qmake-common.mk
-      dnl transform /foo/bar/libbaz.so arguments to -L/foo/bar -lbaz
-      dnl RS: each arguments (space separated) are treated as a new line
-      dnl FS: split fields using /[^/]* to extract the file basepath ($1)
-      dnl  /lib.*\.so/ lines (arguments) will add -Lxxx if this is not the current path (p), then transform into a -lxxx argument
-      dnl other arguments are kept as-is
-      echo '	echo $(LIBS) | awk '\''BEGIN{FS="/[[^/]]*$$";RS=" ";ORS=" "}{if($$0 ~ /\/lib.*\.so/){ if(p != $$1){ print "-L" $$1; p=$$1}; sub(/.*\/lib/, "-l"); sub(/\.so.*/, "")}; print $$0}'\' >> ${ac_pwd}/modules/gui/qt/qmake-common.mk
-      echo 'get_ldflags:'                   >> ${ac_pwd}/modules/gui/qt/qmake-common.mk
-      echo '	echo $(LFLAGS)'             >> ${ac_pwd}/modules/gui/qt/qmake-common.mk
-
-      echo "include ${ac_pwd}/modules/gui/qt/qmake-common.mk"  >> ${ac_pwd}/modules/gui/qt/qmake-qt
+  AS_IF([test $ac_status = 0],[
 
       AC_MSG_RESULT([yes])
-      QT_LIBS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-qt get_libs)
-      QT_CFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-qt get_cflags)
-      QT_LDFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-qt get_ldflags)
+      QT_LIBS=${QT_PKG_ERRORS}
+      QT_CFLAGS=$(${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 \
+        --cflags)
+      QT_LDFLAGS=$(${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 \
+        --ldflags)
       AC_SUBST([QT_LIBS])
       AC_SUBST([QT_CFLAGS])
       AC_SUBST([QT_LDFLAGS])
@@ -4099,7 +4100,6 @@ AS_IF([test "${enable_qt}" != "no"], [
           AC_MSG_WARN([qmlcachegen not found])
       ])
 
-      AC_CHECK_PROGS(PYTHON3, [python3], [no])
       AC_MSG_CHECKING([if required Qt plugins are installed with ${QMAKE6} and conf ${with_qtconf}])
 
       AS_IF([test "${have_qt65}" = "yes"], [
@@ -4107,7 +4107,7 @@ AS_IF([test "${enable_qt}" != "no"], [
       ], [
         qt_qml_effects_module="Qt5Compat.GraphicalEffects"
       ])
-      AS_IF([test "$PYTHON3" != "no" && ${PYTHON3} ${srcdir}/buildsystem/check_qml_module.py \
+      AS_IF([${PYTHON3} ${srcdir}/buildsystem/check_qml_module.py \
             --qmake "${QMAKE6}" \
             --qtconf "${with_qtconf}" \
             --modules \
@@ -4142,14 +4142,25 @@ AS_IF([test "${enable_qt}" != "no"], [
       VLC_RESTORE_FLAGS
 
       AC_MSG_CHECKING([for Qt QTest])
-      (${QMAKE} ${srcdir}/modules/gui/qt/qtest.pro -o ${ac_pwd}/modules/gui/qt/qmake-qtest) 2>/dev/null
+      _QT_QTEST_LIBS=$(${PYTHON3} ${srcdir}/modules/gui/qt/scripts/static_dirs.py \
+            --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
+            --pro ${srcdir_abs}/modules/gui/qt/qtest.pro \
+            --builddir ${ac_pwd}/modules/gui/qt \
+            --libs) 2>/dev/null
       ac_status=$?
-      AS_IF([test $ac_status = 0 && test -f ${ac_pwd}/modules/gui/qt/qmake-qtest],[
-        echo "include ${ac_pwd}/modules/gui/qt/qmake-common.mk"        >> ${ac_pwd}/modules/gui/qt/qmake-qtest
+      AS_IF([test $ac_status = 0],[
         AC_MSG_RESULT([yes])
-        QT_QTEST_LIBS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-qtest get_libs)
-        QT_QTEST_CFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-qtest get_cflags)
-        QT_QTEST_LDFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-qtest get_cflags)
+        QT_QTEST_LIBS=${_QT_QTEST_LIBS}
+        QT_QTEST_CFLAGS=$(${PYTHON3} ${srcdir}/modules/gui/qt/scripts/static_dirs.py \
+            --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
+            --pro ${srcdir_abs}/modules/gui/qt/qtest.pro \
+            --builddir ${ac_pwd}/modules/gui/qt \
+            --cflags)
+        QT_QTEST_LDFLAGS=$(${PYTHON3} ${srcdir}/modules/gui/qt/scripts/static_dirs.py \
+            --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
+            --pro ${srcdir_abs}/modules/gui/qt/qtest.pro \
+            --builddir ${ac_pwd}/modules/gui/qt \
+            --ldflags)
         AC_SUBST([QT_QTEST_LIBS])
         AC_SUBST([QT_QTEST_CFLAGS])
         AC_SUBST([QT_QTEST_LDFLAGS])
@@ -4157,22 +4168,32 @@ AS_IF([test "${enable_qt}" != "no"], [
       ],[
         AC_MSG_RESULT([no])
       ])
-      rm -f ${ac_pwd}/modules/gui/qt/qmake-qtest
 
       AC_MSG_CHECKING([for QuickTest])
-      (${QMAKE} ${srcdir}/modules/gui/qt/quicktest.pro -o ${ac_pwd}/modules/gui/qt/qmake-quicktest) 2>/dev/null
+      _QT_QUICK_TEST_LIBS=$(${PYTHON3} ${srcdir}/modules/gui/qt/scripts/static_dirs.py \
+            --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
+            --pro ${srcdir_abs}/modules/gui/qt/quicktest.pro \
+            --builddir ${ac_pwd}/modules/gui/qt \
+            --libs) 2>/dev/null
       ac_status=$?
-      AS_IF([test $ac_status = 0 && test -f ${ac_pwd}/modules/gui/qt/qmake-quicktest],[
-        AS_IF([test "$PYTHON3" != "no" && ${PYTHON3} ${srcdir}/buildsystem/check_qml_module.py \
+      AS_IF([test $ac_status = 0],[
+        AS_IF([${PYTHON3} ${srcdir}/buildsystem/check_qml_module.py \
         --qmake "${QMAKE6}" \
         --qtconf "${with_qtconf}" \
         --modules QtTest="" \
         >&AS_MESSAGE_FD ], [
-            echo "include ${ac_pwd}/modules/gui/qt/qmake-common.mk"        >> ${ac_pwd}/modules/gui/qt/qmake-quicktest
             AC_MSG_RESULT([yes])
-            QT_QUICK_TEST_LIBS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-quicktest get_libs)
-            QT_QUICK_TEST_CFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-quicktest get_cflags)
-            QT_QUICK_TEST_LDFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-quicktest get_ldflags)
+            QT_QUICK_TEST_LIBS=${_QT_QUICK_TEST_LIBS}
+            QT_QUICK_TEST_CFLAGS=$(${PYTHON3} ${srcdir}/modules/gui/qt/scripts/static_dirs.py \
+                --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
+                --pro ${srcdir_abs}/modules/gui/qt/quicktest.pro \
+                --builddir ${ac_pwd}/modules/gui/qt \
+                --cflags)
+            QT_QUICK_TEST_LDFLAGS=$(${PYTHON3} ${srcdir}/modules/gui/qt/scripts/static_dirs.py \
+                --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
+                --pro ${srcdir_abs}/modules/gui/qt/quicktest.pro \
+                --builddir ${ac_pwd}/modules/gui/qt \
+                --ldflags)
             AC_SUBST([QT_QUICK_TEST_LIBS])
             AC_SUBST([QT_QUICK_TEST_CFLAGS])
             AC_SUBST([QT_QUICK_TEST_LDFLAGS])
@@ -4183,7 +4204,6 @@ AS_IF([test "${enable_qt}" != "no"], [
       ],[
         AC_MSG_RESULT([no])
       ])
-      rm -f ${ac_pwd}/modules/gui/qt/qmake-quicktest
 
       AC_PATH_PROGS(FXC, [fxc], [no], [${CONTRIB_DIR}/bin])
       AS_IF([test "$FXC" != "no"],[
@@ -4192,48 +4212,16 @@ AS_IF([test "${enable_qt}" != "no"], [
         AC_SUBST([FXC_PATH])
       ])
 
-      AC_MSG_CHECKING([for Qt Core private])
-      (${QMAKE} ${srcdir}/modules/gui/qt/private-core.pro -o ${ac_pwd}/modules/gui/qt/qmake-private-core) 2>/dev/null
-      ac_status=$?
-      AS_IF([test $ac_status = 0 && test -f ${ac_pwd}/modules/gui/qt/qmake-private-core],[
-        echo "include ${ac_pwd}/modules/gui/qt/qmake-common.mk"        >> ${ac_pwd}/modules/gui/qt/qmake-private-core
-        AC_MSG_RESULT([yes])
-        QT_CORE_PRIVATE_CFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-private-core get_cflags)
-        AC_SUBST([QT_CORE_PRIVATE_CFLAGS])
-        have_qt_core_private="yes"
-      ],[
-        AC_MSG_RESULT([no])
-      ])
-      rm -f ${ac_pwd}/modules/gui/qt/qmake-private-core
-
       AC_MSG_CHECKING([for Qt GUI private])
-      (${QMAKE} ${srcdir}/modules/gui/qt/private-gui.pro -o ${ac_pwd}/modules/gui/qt/qmake-private-gui) 2>/dev/null
-      ac_status=$?
-      AS_IF([test $ac_status = 0 && test -f ${ac_pwd}/modules/gui/qt/qmake-private-gui],[
-        echo "include ${ac_pwd}/modules/gui/qt/qmake-common.mk"        >> ${ac_pwd}/modules/gui/qt/qmake-private-gui
-
-        AC_MSG_RESULT([yes])
-        QT_GUI_PRIVATE_CFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-private-gui get_cflags)
-        AC_SUBST([QT_GUI_PRIVATE_CFLAGS])
-        have_qt_gui_private="yes"
-      ],[
-        AC_MSG_RESULT([no])
-      ])
-      rm -f ${ac_pwd}/modules/gui/qt/qmake-private-gui
-
-      AC_MSG_CHECKING([for Qt Quick private])
-      (${QMAKE} ${srcdir}/modules/gui/qt/private-quick.pro -o ${ac_pwd}/modules/gui/qt/qmake-private-quick) 2>/dev/null
-      ac_status=$?
-      AS_IF([test $ac_status = 0 && test -f ${ac_pwd}/modules/gui/qt/qmake-private-quick],[
-        echo "include ${ac_pwd}/modules/gui/qt/qmake-common.mk"        >> ${ac_pwd}/modules/gui/qt/qmake-private-quick
-        AC_MSG_RESULT([yes])
-        QT_QUICK_PRIVATE_CFLAGS=$(cd ${ac_pwd}/modules/gui/qt && make -s -f qmake-private-quick get_cflags)
-        AC_SUBST([QT_QUICK_PRIVATE_CFLAGS])
-        have_qt_declarative_private="yes"
-      ],[
-        AC_MSG_RESULT([no])
-      ])
-      rm -f ${ac_pwd}/modules/gui/qt/qmake-private-quick
+      case $QT_CFLAGS in
+        *-DQT_GUI_PRIVATE\ *)
+            AC_MSG_RESULT([yes])
+            have_qt_gui_private="yes"
+            ;;
+        *)
+            AC_MSG_RESULT([no])
+            ;;
+      esac
 
       dnl gtk theme provider
       PKG_CHECK_MODULES([GTK3], [gtk+-3.0 >= 3.20], [
@@ -4244,9 +4232,8 @@ AS_IF([test "${enable_qt}" != "no"], [
       have_qt="no"
     ])
   ])
-  rm -f ${ac_pwd}/modules/gui/qt/qmake-common.mk
-  rm -f ${ac_pwd}/modules/gui/qt/qmake-qt
-  rm -f ${ac_pwd}/modules/gui/qt/.qmake.stash
+  ])
+
     AS_IF([test "${have_qt}" = "no"],[
       AS_IF([test -n "${enable_qt}"],[
         AC_MSG_ERROR([${QT_PKG_ERRORS}. If you want to build VLC without GUI, pass --disable-qt.])
@@ -4274,9 +4261,7 @@ 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"])
 AM_CONDITIONAL([HAVE_QT_QUICK_TEST], [test "${have_qt_quick_test}" = "yes"])
-AM_CONDITIONAL([HAVE_QT_DECLARATIVE_PRIVATE], [test "${have_qt_declarative_private}" = "yes"])
 AM_CONDITIONAL([HAVE_QT_GUI_PRIVATE], [test "${have_qt_gui_private}" = "yes"])
-AM_CONDITIONAL([HAVE_QT_CORE_PRIVATE], [test "${have_qt_core_private}" = "yes"])
 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"])


=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -16,7 +16,7 @@ guidir = $(pluginsdir)/gui
 gui_LTLIBRARIES =
 SUFFIXES += .ui .h .hpp .moc.cpp .qml .js .mjs .moc
 TEST_EXTENSIONS = .qml
-EXTRA_DIST = qt6.pro private-core.pro private-gui.pro private-quick.pro quicktest.pro scripts
+EXTRA_DIST = qt6.pro qtest.pro quicktest.pro scripts
 vlc_qt_libs = $(QT_LIBS)
 RCC_EXTRA_PARAMS =
 
@@ -78,18 +78,6 @@ if HAVE_QT_GTK
 libqt_plugin_la_CPPFLAGS += -DQT_HAS_GTK
 endif
 
-if HAVE_QT_CORE_PRIVATE
-libqt_plugin_la_CPPFLAGS += -DQT_CORE_PRIVATE $(QT_CORE_PRIVATE_CFLAGS)
-endif
-
-if HAVE_QT_GUI_PRIVATE
-libqt_plugin_la_CPPFLAGS += -DQT_GUI_PRIVATE $(QT_GUI_PRIVATE_CFLAGS)
-endif
-
-if HAVE_QT_DECLARATIVE_PRIVATE
-libqt_plugin_la_CPPFLAGS += -DQT_DECLARATIVE_PRIVATE $(QT_QUICK_PRIVATE_CFLAGS)
-endif
-
 libqt_plugin_la_SOURCES = \
 	qt.cpp qt.hpp plugins.hpp \
 	dialogs/bookmarks/bookmarks.cpp dialogs/bookmarks/bookmarks.hpp \
@@ -1607,7 +1595,7 @@ QT_QTEST_COMMON_ldflags = $(AM_LDFLAGS) $(QT_LDFLAGS) $(QT_QTEST_LDFLAGS)
 # test_ml_model
 
 test_ml_model_SOURCES = \
-	tests/vlc_stub_modules.cpp \
+	tests/vlc_stub_modules.cpp tests/vlc_stub_modules.hpp \
 	tests/test_ml_model.cpp \
 	util/base_model.hpp util/base_model_p.hpp  util/base_model.cpp \
 	util/listcache.hpp \
@@ -1643,7 +1631,7 @@ TESTS += test_ml_model
 # test_renderer_manager_model
 
 test_renderer_manager_model_SOURCES = \
-	tests/vlc_stub_modules.cpp \
+	tests/vlc_stub_modules.cpp tests/vlc_stub_modules.hpp \
 	tests/test_renderer_manager_model.cpp \
     util/renderer_manager.hpp util/renderer_manager.cpp
 
@@ -1663,7 +1651,7 @@ TESTS += test_renderer_manager_model
 # test_vlc_dialog_model
 
 test_vlc_dialog_model_SOURCES = \
-	tests/vlc_stub_modules.cpp \
+	tests/vlc_stub_modules.cpp tests/vlc_stub_modules.hpp \
 	tests/test_vlc_dialog_model.cpp \
 	dialogs/dialogs/dialogmodel.cpp
 


=====================================
modules/gui/qt/meson.build
=====================================
@@ -961,6 +961,50 @@ if qt6_dep.found()
             dependencies: qt6_dep)
     endforeach
 
+    qt_static_check = '''
+    #include <qconfig.h>
+    #ifndef QT_STATIC
+    # error Qt using shared libraries
+    #endif
+    '''
+
+    if cpp.compiles(qt_static_check, dependencies: qt6_dep, name: 'Qt6 compiled with static libraries')
+        qt_install_bin_directory = qt6_dep.get_variable(pkgconfig: 'bindir', configtool: '-query QT_INSTALL_BINS')
+        qmake6 = find_program(qt_install_bin_directory + '/qmake6', required: true)
+        if qmake6.found()
+            qtcflags = run_command(
+                prog_python,
+                meson.current_source_dir() / 'scripts/static_dirs.py',
+                '--qmake', qmake6.full_path(),
+                '--pro', meson.current_source_dir() / 'qt6.pro',
+                '--builddir', meson.current_build_dir(),
+                '--cflags',
+                check: false,
+            )
+            if qtcflags.returncode() == 0
+                qt_extra_flags += qtcflags.stdout().split()
+            else
+                warning('Failed to get static Qt compilation flags: ' + qtcflags.stderr())
+            endif
+            qtlflags = run_command(
+                prog_python,
+                meson.current_source_dir() / 'scripts/static_dirs.py',
+                '--qmake', qmake6.full_path(),
+                '--pro', meson.current_source_dir() / 'qt6.pro',
+                '--builddir', meson.current_build_dir(),
+                '--libs', '--ldflags',
+                check: false,
+            )
+            if qtlflags.returncode() == 0
+                qt_link_args += qtlflags.stdout().split()
+            else
+                warning('Failed to get static Qt link flags: ' + qtlflags.stderr())
+            endif
+        else
+            warning('Failed to find qmake6 to get static Qt variables')
+        endif
+    endif
+
     qt6pre_qrc = qt6.preprocess(
         qresources: qrc_files,
         include_directories: qt_include_dir,


=====================================
modules/gui/qt/private-core.pro deleted
=====================================
@@ -1,3 +0,0 @@
-QT = core core-private
-CONFIG -= debug_and_release
-CONFIG += no_include_pwd


=====================================
modules/gui/qt/private-gui.pro deleted
=====================================
@@ -1,3 +0,0 @@
-QT = gui gui-private
-CONFIG -= debug_and_release
-CONFIG += no_include_pwd


=====================================
modules/gui/qt/private-quick.pro deleted
=====================================
@@ -1,3 +0,0 @@
-QT = quick quick-private
-CONFIG -= debug_and_release
-CONFIG += no_include_pwd


=====================================
modules/gui/qt/qt6.pro
=====================================
@@ -29,3 +29,18 @@ QTPLUGIN += qcocoa qmacstyle
 emscripten {
 QTPLUGIN += qwasm
 }
+
+qtHaveModule(gui-private) {
+QT += gui-private
+DEFINES += QT_GUI_PRIVATE
+}
+
+qtHaveModule(core-private) {
+QT += core-private
+DEFINES += QT_CORE_PRIVATE
+}
+
+qtHaveModule(quick-private) {
+QT += quick-private
+DEFINES += QT_DECLARATIVE_PRIVATE
+}


=====================================
modules/gui/qt/scripts/static_dirs.py
=====================================
@@ -0,0 +1,113 @@
+#!/usr/bin/env python3
+
+# SPDX-License-Identifier: ISC
+# Copyright © 2025 VideoLabs, VLC authors and VideoLAN
+#
+# Authors: Steve Lhomme <robux4 at videolabs.io>
+
+import argparse
+import os
+import pathlib
+import re
+import subprocess
+import sys
+
+def call_qmake(qmake:str, qtconf, builddir, pro) -> str:
+    if builddir and builddir != '' and not os.path.exists(builddir):
+        os.makedirs(builddir)
+    qmake_cmd = [ qmake ]
+    if qtconf and qtconf != '':
+        qmake_cmd += [ '-qtconf', qtconf ]
+    qmake_cmd += [pro, '-o', '-' ]
+    call = subprocess.Popen(qmake_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=builddir)
+    stdout_bin, stderr_bin = call.communicate()
+    errcode = call.wait()
+
+    if errcode != 0:
+        sys.stderr.write(stderr_bin.decode('utf-8'))
+        sys.exit(errcode)
+
+    return stdout_bin.decode('utf-8')
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser(
+        description="This program provides the list of directories/defines to use with Qt static"
+    )
+    parser.add_argument("--qmake",
+                        type=pathlib.Path, required=True,
+                        help="native qmake path")
+    parser.add_argument("--qtconf",
+                        type=str, required=False,
+                        help="qmake qtconf path")
+    parser.add_argument("--pro",
+                        type=pathlib.Path, required=True,
+                        help=".pro file to use as base")
+    parser.add_argument("--builddir",
+                        type=str, required=True,
+                        help="build directory path")
+
+    parser.add_argument("--cflags",
+                        required=False, action='store_true',
+                        help="get the list of compiler flags")
+    parser.add_argument("--libs",
+                        required=False, action='store_true',
+                        help="get the list of libraries")
+    parser.add_argument("--ldflags",
+                        required=False, action='store_true',
+                        help="get the list of linker flags")
+    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)
+    for line in makefile.splitlines():
+        if in_sources:
+            l = line.strip()
+            in_sources = l.endswith('\\')
+            if in_sources:
+                l = l[:-1].strip()
+            sources += l.split(' ')
+        elif line.startswith('SOURCES '):
+            l = re.sub(r'SOURCES[\W]+=', ' ', line).strip()
+            in_sources = l.endswith(' \\')
+            if in_sources:
+                l = l[:-1].strip()
+            sources += l.split(' ')
+        elif line.startswith('DEFINES '):
+            if args.cflags:
+                l = re.sub(r'DEFINES[\W]+=', ' ', line)
+                for i in l.strip().split(' '):
+                    result += ' ' + i
+        elif line.startswith('INCPATH '):
+            if args.cflags:
+                l = re.sub(r'INCPATH[\W]+=', ' ', line)
+                for i in l.strip().split(' '):
+                    result += ' ' + i
+        elif line.startswith('LFLAGS '):
+            if args.ldflags:
+                l = re.sub(r'LFLAGS[\W]+=', ' ', line)
+                for i in l.strip().split(' '):
+                    result += ' ' + i
+        elif line.startswith('LIBS '):
+            if args.libs:
+                l = re.sub(r'LIBS[\W]+=', ' ', line).split(' ')
+                for lib in l:
+                    if lib == '':
+                        continue
+                    if lib.startswith('-l'):
+                        result += ' ' + lib
+                    elif lib.endswith('.so') or lib.endswith('.a'):
+                        libname = os.path.splitext(os.path.basename(lib))[0]
+                        if libname.startswith('lib'):
+                            libdir = os.path.dirname(lib)
+                            result += ' -L' + libdir
+                            result += ' -l' + libname[3:]
+                    else:
+                        result += ' ' + lib
+
+    for generated in sources:
+        if os.path.exists(generated):
+            os.remove(generated)
+
+    sys.stdout.write(result)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9dd484b10d908b71b695ca3b29ce0d93a07bdbc8...97c00b5819379e631b705666ad13993dbefdecf3

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9dd484b10d908b71b695ca3b29ce0d93a07bdbc8...97c00b5819379e631b705666ad13993dbefdecf3
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