[vlc-devel] [PATCH 1/9] contrib: qt: pass compiler flags directly to the mkspec file

Pierre Lamot pierre at videolabs.io
Fri Aug 28 16:25:48 CEST 2020


  the -I flags passed to Qt configure script is applied to both target and host
  compilation.
  This may cause issues to compile host tools as the headers of the target may
  be incompatible with the host (ie: pthread header)
---
 ...user-defined-compilation-flags-to-qt.patch | 53 +++++++++++++++++++
 contrib/src/qt/rules.mak                      |  6 ++-
 2 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 contrib/src/qt/0001-allow-to-pass-user-defined-compilation-flags-to-qt.patch

diff --git a/contrib/src/qt/0001-allow-to-pass-user-defined-compilation-flags-to-qt.patch b/contrib/src/qt/0001-allow-to-pass-user-defined-compilation-flags-to-qt.patch
new file mode 100644
index 0000000000..71e707daae
--- /dev/null
+++ b/contrib/src/qt/0001-allow-to-pass-user-defined-compilation-flags-to-qt.patch
@@ -0,0 +1,53 @@
+From 691cced4d252d3b76dce02963c18ca85d125bf09 Mon Sep 17 00:00:00 2001
+From: Pierre Lamot <pierre at videolabs.io>
+Date: Tue, 18 Aug 2020 16:06:06 +0200
+Subject: [PATCH] allow to pass user defined compilation flags to qt
+
+---
+ mkspecs/darwin-g++/qmake.conf      | 4 ++++
+ mkspecs/win32-clang-g++/qmake.conf | 4 ++++
+ mkspecs/win32-g++/qmake.conf       | 4 ++++
+ 3 files changed, 12 insertions(+)
+
+diff --git a/mkspecs/darwin-g++/qmake.conf b/mkspecs/darwin-g++/qmake.conf
+index 85955f7..8602b78 100644
+--- a/mkspecs/darwin-g++/qmake.conf
++++ b/mkspecs/darwin-g++/qmake.conf
+@@ -86,4 +86,8 @@ QMAKE_PCH_OUTPUT_EXT    = .gch
+ QMAKE_CXXFLAGS_PRECOMPILE += -x objective-c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
+ QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+ 
++QMAKE_CFLAGS           += $${VLC_EXTRA_CFLAGS}
++QMAKE_CXXFLAGS         += $${VLC_EXTRA_CXXFLAGS}
++QMAKE_LDFLAGS          += $${VLC_EXTRA_LDFLAGS}
++
+ load(qt_config)
+diff --git a/mkspecs/win32-clang-g++/qmake.conf b/mkspecs/win32-clang-g++/qmake.conf
+index 4630ec4..149f779 100644
+--- a/mkspecs/win32-clang-g++/qmake.conf
++++ b/mkspecs/win32-clang-g++/qmake.conf
+@@ -24,4 +24,8 @@ QMAKE_CXXFLAGS_WARN_ON  = $$QMAKE_CFLAGS_WARN_ON
+ QMAKE_LINK              = $${CROSS_COMPILE}clang++
+ QMAKE_LINK_C            = $${CROSS_COMPILE}clang
+ 
++QMAKE_CFLAGS           += $${VLC_EXTRA_CFLAGS}
++QMAKE_CXXFLAGS         += $${VLC_EXTRA_CXXFLAGS}
++QMAKE_LDFLAGS          += $${VLC_EXTRA_LDFLAGS}
++
+ load(qt_config)
+diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf
+index 5e99233..b22cbce 100644
+--- a/mkspecs/win32-g++/qmake.conf
++++ b/mkspecs/win32-g++/qmake.conf
+@@ -26,4 +26,8 @@ QMAKE_CFLAGS_LTCG       = -flto
+ QMAKE_CXXFLAGS_LTCG     = $$QMAKE_CFLAGS_LTCG
+ QMAKE_LFLAGS_LTCG       = $$QMAKE_CFLAGS_LTCG
+ 
++QMAKE_CFLAGS           += $${VLC_EXTRA_CFLAGS}
++QMAKE_CXXFLAGS         += $${VLC_EXTRA_CXXFLAGS}
++QMAKE_LDFLAGS          += $${VLC_EXTRA_LDFLAGS}
++
+ load(qt_config)
+-- 
+2.25.1
+
diff --git a/contrib/src/qt/rules.mak b/contrib/src/qt/rules.mak
index 1eb09d87ae..901f6f6ce6 100644
--- a/contrib/src/qt/rules.mak
+++ b/contrib/src/qt/rules.mak
@@ -28,6 +28,7 @@ $(TARBALLS)/qtbase-everywhere-src-$(QT_VERSION_FULL).tar.xz:
 
 qt: qtbase-everywhere-src-$(QT_VERSION_FULL).tar.xz .sum-qt
 	$(UNPACK)
+	$(APPLY) $(SRC)/qt/0001-allow-to-pass-user-defined-compilation-flags-to-qt.patch
 ifdef HAVE_WIN32
 	$(APPLY) $(SRC)/qt/0001-Windows-QPA-prefer-lower-value-when-rounding-fractio.patch
 	$(APPLY) $(SRC)/qt/0002-Windows-QPA-Disable-systray-notification-sounds.patch
@@ -81,6 +82,9 @@ endif
 
 endif
 
+QT_PLATFORM += -device-option VLC_EXTRA_CFLAGS="-isystem $(PREFIX)/include" \
+	-device-option VLC_EXTRA_CXXFLAGS="-isystem $(PREFIX)/include"
+
 QT_CONFIG := -static -no-shared -opensource -confirm-license -no-pkg-config \
 	-no-sql-sqlite -no-gif -qt-libjpeg -no-openssl $(QT_OPENGL) -no-dbus \
 	-no-vulkan -no-sql-odbc -no-pch \
@@ -102,7 +106,7 @@ ENV_VARS := $(HOSTVARS) DXSDK_DIR=$(PREFIX)/bin
 .qt: qt
 	# Prevent all Qt contribs from generating and installing libtool .la files
 	cd $< && sed -i "/CONFIG/ s/ create_libtool/ -create_libtool/g" mkspecs/features/qt_module.prf
-	+cd $< && $(ENV_VARS) ./configure $(QT_PLATFORM) $(QT_CONFIG) -prefix $(PREFIX) -I $(PREFIX)/include
+	+cd $< && $(ENV_VARS) ./configure $(QT_PLATFORM) $(QT_CONFIG) -prefix $(PREFIX)
 	# Make && Install libraries
 	cd $< && $(ENV_VARS) $(MAKE)
 	cd $< && $(MAKE) -C src sub-corelib-install_subtargets sub-gui-install_subtargets sub-widgets-install_subtargets sub-platformsupport-install_subtargets sub-zlib-install_subtargets sub-bootstrap-install_subtargets sub-network-install_subtargets sub-testlib-install_subtargets
-- 
2.25.1



More information about the vlc-devel mailing list