[vlc-devel] [PATCH] Qt5 static and shared support

Martell Malone martellmalone at gmail.com
Tue Nov 25 14:23:38 CET 2014


Some platforms cough*mac*cough
do not like including <QtCore/qconfig.h>
changed to #include <qconfig.h> to reflect this

>From 7bbf5b7eba4455c8535b24af7aa516716c6a4c02 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone at gmail.com>
Date: Tue, 25 Nov 2014 10:41:09 +0000
Subject: [PATCH] gui-qt4: added QT_STATICPLUGIN define based on static or
 shared as per the qt spec

---
 modules/gui/qt4/Makefile.am | 2 +-
 modules/gui/qt4/qt4.cpp     | 6 ++++--
 modules/gui/qt4/qt4.hpp     | 6 ++++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/Makefile.am b/modules/gui/qt4/Makefile.am
index c608999..1a564cf 100644
--- a/modules/gui/qt4/Makefile.am
+++ b/modules/gui/qt4/Makefile.am
@@ -20,7 +20,7 @@ libqt4_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath
'$(guidir)'
 if HAVE_OS2
 else
 if HAVE_WIN32
-libqt4_plugin_la_LIBADD += -lole32
+libqt4_plugin_la_LIBADD += -lole32 -lcomctl32 -luuid
 else
 libqt4_plugin_la_LIBADD += $(X_LIBS) $(X_PRE_LIB) -lX11
 endif
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 1e25371..b6aef43 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -52,8 +52,10 @@
 #ifdef _WIN32 /* For static builds */
  #include <QtPlugin>
  #if HAS_QT5
-  Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
-  Q_IMPORT_PLUGIN(AccessibleFactory)
+  #ifdef QT_STATICPLUGIN
+   Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
+   Q_IMPORT_PLUGIN(AccessibleFactory)
+  #endif
  #else
   Q_IMPORT_PLUGIN(qjpeg)
   Q_IMPORT_PLUGIN(qtaccessiblewidgets)
diff --git a/modules/gui/qt4/qt4.hpp b/modules/gui/qt4/qt4.hpp
index 6244763..258557c 100644
--- a/modules/gui/qt4/qt4.hpp
+++ b/modules/gui/qt4/qt4.hpp
@@ -33,6 +33,12 @@
 #include <vlc_interface.h> /* intf_thread_t */
 #include <vlc_playlist.h>  /* playlist_t */

+#include <qconfig.h>
+
+#ifdef QT_STATIC
+#define QT_STATICPLUGIN
+#endif
+
 #define QT_NO_CAST_TO_ASCII
 #include <QString>

-- 
2.1.3

On Tue, Nov 25, 2014 at 12:08 PM, Martell Malone <martellmalone at gmail.com>
wrote:

> My full name keeps getting stripped and the last line of the patch.
> I will have to fix this git bug
>
> From 7bbf5b7eba4455c8535b24af7aa516716c6a4c02 Mon Sep 17 00:00:00 2001
> From: Martell Malone <martellmalone at gmail.com>
> Date: Tue, 25 Nov 2014 10:41:09 +0000
> Subject: [PATCH] gui-qt4: added QT_STATICPLUGIN define based on static or
>  shared as per the qt spec
>
> ---
>  modules/gui/qt4/Makefile.am | 2 +-
>  modules/gui/qt4/qt4.cpp     | 6 ++++--
>  modules/gui/qt4/qt4.hpp     | 6 ++++++
>  3 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/modules/gui/qt4/Makefile.am b/modules/gui/qt4/Makefile.am
> index c608999..1a564cf 100644
> --- a/modules/gui/qt4/Makefile.am
> +++ b/modules/gui/qt4/Makefile.am
> @@ -20,7 +20,7 @@ libqt4_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath
> '$(guidir)'
>  if HAVE_OS2
>  else
>  if HAVE_WIN32
> -libqt4_plugin_la_LIBADD += -lole32
> +libqt4_plugin_la_LIBADD += -lole32 -lcomctl32 -luuid
>  else
>  libqt4_plugin_la_LIBADD += $(X_LIBS) $(X_PRE_LIB) -lX11
>  endif
> diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
> index 1e25371..b6aef43 100644
> --- a/modules/gui/qt4/qt4.cpp
> +++ b/modules/gui/qt4/qt4.cpp
> @@ -52,8 +52,10 @@
>  #ifdef _WIN32 /* For static builds */
>   #include <QtPlugin>
>   #if HAS_QT5
> -  Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
> -  Q_IMPORT_PLUGIN(AccessibleFactory)
> +  #ifdef QT_STATICPLUGIN
> +   Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
> +   Q_IMPORT_PLUGIN(AccessibleFactory)
> +  #endif
>   #else
>    Q_IMPORT_PLUGIN(qjpeg)
>    Q_IMPORT_PLUGIN(qtaccessiblewidgets)
> diff --git a/modules/gui/qt4/qt4.hpp b/modules/gui/qt4/qt4.hpp
> index 6244763..258557c 100644
> --- a/modules/gui/qt4/qt4.hpp
> +++ b/modules/gui/qt4/qt4.hpp
> @@ -33,6 +33,12 @@
>  #include <vlc_interface.h> /* intf_thread_t */
>  #include <vlc_playlist.h>  /* playlist_t */
>
> +#include <qtconfig.h>
> +
> +#ifdef QT_STATIC
> +#define QT_STATICPLUGIN
> +#endif
> +
>  #define QT_NO_CAST_TO_ASCII
>  #include <QString>
>
> --
> 2.1.3
>
> On Tue, Nov 25, 2014 at 10:49 AM, Martell Malone <martellmalone at gmail.com>
> wrote:
>
>> The QT spec says we should use QT_STATICPLUGIN defined if building a
>> static plugin.
>>
>> As we are using out own makefile and not a qt .pro project we have to
>> define it ourselves.
>>
>> This is then used to decide if we should import the modules
>> QWindowsIntegrationPlugin and AccessibleFactory as these are not needed on
>> a shared build.
>>
>> Also added some extra missing libs for linking on mingw-w64 we
>> need -lcomctl32 -luuid
>>
>> comments and changes welcome :)
>>
>> From 7bbf5b7eba4455c8535b24af7aa516716c6a4c02 Mon Sep 17 00:00:00 2001
>> From: martell <martellmalone at gmail.com>
>> Date: Tue, 25 Nov 2014 10:41:09 +0000
>> Subject: [PATCH] gui-qt4: added QT_STATICPLUGIN define based on static or
>>  shared as per the qt spec
>>
>> ---
>>  modules/gui/qt4/Makefile.am | 2 +-
>>  modules/gui/qt4/qt4.cpp     | 6 ++++--
>>  modules/gui/qt4/qt4.hpp     | 6 ++++++
>>  3 files changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/modules/gui/qt4/Makefile.am b/modules/gui/qt4/Makefile.am
>> index c608999..1a564cf 100644
>> --- a/modules/gui/qt4/Makefile.am
>> +++ b/modules/gui/qt4/Makefile.am
>> @@ -20,7 +20,7 @@ libqt4_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath
>> '$(guidir)'
>>  if HAVE_OS2
>>  else
>>  if HAVE_WIN32
>> -libqt4_plugin_la_LIBADD += -lole32
>> +libqt4_plugin_la_LIBADD += -lole32 -lcomctl32 -luuid
>>  else
>>  libqt4_plugin_la_LIBADD += $(X_LIBS) $(X_PRE_LIB) -lX11
>>  endif
>> diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
>> index 1e25371..b6aef43 100644
>> --- a/modules/gui/qt4/qt4.cpp
>> +++ b/modules/gui/qt4/qt4.cpp
>> @@ -52,8 +52,10 @@
>>  #ifdef _WIN32 /* For static builds */
>>   #include <QtPlugin>
>>   #if HAS_QT5
>> -  Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
>> -  Q_IMPORT_PLUGIN(AccessibleFactory)
>> +  #ifdef QT_STATICPLUGIN
>> +   Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
>> +   Q_IMPORT_PLUGIN(AccessibleFactory)
>> +  #endif
>>   #else
>>    Q_IMPORT_PLUGIN(qjpeg)
>>    Q_IMPORT_PLUGIN(qtaccessiblewidgets)
>> diff --git a/modules/gui/qt4/qt4.hpp b/modules/gui/qt4/qt4.hpp
>> index 6244763..258557c 100644
>> --- a/modules/gui/qt4/qt4.hpp
>> +++ b/modules/gui/qt4/qt4.hpp
>> @@ -33,6 +33,12 @@
>>  #include <vlc_interface.h> /* intf_thread_t */
>>  #include <vlc_playlist.h>  /* playlist_t */
>>
>> +#include <qtconfig.h>
>> +
>> +#ifdef QT_STATIC
>> +#define QT_STATICPLUGIN
>> +#endif
>> +
>>  #define QT_NO_CAST_TO_ASCII
>>  #include <QString>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20141125/a6919ca7/attachment.html>


More information about the vlc-devel mailing list