[vlc-commits] [Git][videolan/vlc][master] qt: pass debug mode (if enabled) to qmake

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Mar 8 15:59:52 UTC 2025


Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
dd4bc208 by Fatih Uzunoglu at 2025-03-08T15:44:09+00:00
qt: pass debug mode (if enabled) to qmake

The behavior may be different when qmake
generates the build files depending on
the build mode.

For example, with MinGW-w64 `-Wl,-s` (which
stands for stripping symbol information) is
added to the linker flags if build mode is
(directed or assumed to be) release.

If debug mode is not enabled, the default
behavior is retained, which appears to be
release. I specifically did not request
release mode when debug is false, because
debug being false does not necessarily mean
release.

- - - - -


3 changed files:

- configure.ac
- modules/gui/qt/meson.build
- modules/gui/qt/scripts/static_dirs.py


Changes:

=====================================
configure.ac
=====================================
@@ -4083,12 +4083,17 @@ AS_IF([test "${enable_qt}" != "no"], [
   ],[
 
   AC_MSG_CHECKING([for Qt libraries])
+  qmake_additional_params=""
+  AS_IF([test "${enable_debug}" != "no"], [
+    qmake_additional_params="$qmake_additional_params --debug"
+  ])
   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)
+    --libs \
+    ${qmake_additional_params})
   ac_status=$?
   AS_IF([test $ac_status = 0],[
 
@@ -4098,12 +4103,14 @@ AS_IF([test "${enable_qt}" != "no"], [
         --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
         --pro ${srcdir_abs}/modules/gui/qt/qt6.pro \
         --builddir ${ac_pwd}/modules/gui/qt \
-        --cflags)
+        --cflags \
+        ${qmake_additional_params})
       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)
+        --ldflags \
+        ${qmake_additional_params})
       AC_SUBST([QT_LIBS])
       AC_SUBST([QT_CFLAGS])
       AC_SUBST([QT_LDFLAGS])
@@ -4168,7 +4175,8 @@ AS_IF([test "${enable_qt}" != "no"], [
             --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
             --pro ${srcdir_abs}/modules/gui/qt/qtest.pro \
             --builddir ${ac_pwd}/modules/gui/qt \
-            --libs) 2>/dev/null
+            --libs \
+            ${qmake_additional_params}) 2>/dev/null
       ac_status=$?
       AS_IF([test $ac_status = 0],[
         AC_MSG_RESULT([yes])
@@ -4177,12 +4185,14 @@ AS_IF([test "${enable_qt}" != "no"], [
             --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
             --pro ${srcdir_abs}/modules/gui/qt/qtest.pro \
             --builddir ${ac_pwd}/modules/gui/qt \
-            --cflags)
+            --cflags \
+            ${qmake_additional_params})
         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)
+            --ldflags \
+            ${qmake_additional_params})
         AC_SUBST([QT_QTEST_LIBS])
         AC_SUBST([QT_QTEST_CFLAGS])
         AC_SUBST([QT_QTEST_LDFLAGS])
@@ -4196,7 +4206,8 @@ AS_IF([test "${enable_qt}" != "no"], [
             --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
             --pro ${srcdir_abs}/modules/gui/qt/quicktest.pro \
             --builddir ${ac_pwd}/modules/gui/qt \
-            --libs) 2>/dev/null
+            --libs \
+            ${qmake_additional_params}) 2>/dev/null
       ac_status=$?
       AS_IF([test $ac_status = 0],[
         AS_IF([${PYTHON3} ${srcdir}/buildsystem/check_qml_module.py \
@@ -4210,12 +4221,14 @@ AS_IF([test "${enable_qt}" != "no"], [
                 --qmake "${QMAKE6}" --qtconf "${with_qtconf}" \
                 --pro ${srcdir_abs}/modules/gui/qt/quicktest.pro \
                 --builddir ${ac_pwd}/modules/gui/qt \
-                --cflags)
+                --cflags \
+                ${qmake_additional_params})
             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)
+                --ldflags \
+                ${qmake_additional_params})
             AC_SUBST([QT_QUICK_TEST_LIBS])
             AC_SUBST([QT_QUICK_TEST_CFLAGS])
             AC_SUBST([QT_QUICK_TEST_LDFLAGS])


=====================================
modules/gui/qt/meson.build
=====================================
@@ -989,6 +989,10 @@ if qt6_dep.found()
         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()
+            qmake_additional_params = []
+            if get_option('buildtype') == 'debug'
+                qmake_additional_params += '--debug'
+            endif
             qtcflags = run_command(
                 prog_python,
                 meson.current_source_dir() / 'scripts/static_dirs.py',
@@ -996,6 +1000,7 @@ if qt6_dep.found()
                 '--pro', meson.current_source_dir() / 'qt6.pro',
                 '--builddir', meson.current_build_dir(),
                 '--cflags',
+                qmake_additional_params,
                 check: false,
             )
             if qtcflags.returncode() == 0
@@ -1010,6 +1015,7 @@ if qt6_dep.found()
                 '--pro', meson.current_source_dir() / 'qt6.pro',
                 '--builddir', meson.current_build_dir(),
                 '--libs', '--ldflags',
+                qmake_additional_params,
                 check: false,
             )
             if qtlflags.returncode() == 0


=====================================
modules/gui/qt/scripts/static_dirs.py
=====================================
@@ -12,10 +12,12 @@ import re
 import subprocess
 import sys
 
-def call_qmake(qmake:str, qtconf, builddir, pro) -> str:
+def call_qmake(qmake:str, qtconf, builddir, pro, debug:bool) -> str:
     if builddir and builddir != '' and not os.path.exists(builddir):
         os.makedirs(builddir)
     qmake_cmd = [ qmake ]
+    if debug:
+        qmake_cmd += ['CONFIG+=debug']
     if qtconf and qtconf != '':
         qmake_cmd += [ '-qtconf', qtconf ]
     qmake_cmd += [pro, '-o', '-' ]
@@ -55,12 +57,15 @@ if __name__ == "__main__":
     parser.add_argument("--ldflags",
                         required=False, action='store_true',
                         help="get the list of linker flags")
+    parser.add_argument("--debug",
+                        required=False, action='store_true',
+                        help="debug mode")
     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)
+    makefile = call_qmake(args.qmake, args.qtconf, args.builddir, args.pro, args.debug)
     for line in makefile.splitlines():
         if in_sources:
             l = line.strip()



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/dd4bc2087964ba1f19c219563f925a4283643bff

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/dd4bc2087964ba1f19c219563f925a4283643bff
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