summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2021-07-19 16:27:05 +0200
committerDaniel Schürmann <daschuer@mixxx.org>2021-07-19 17:08:09 +0200
commitc75927e467041e093f290b1fccd49e0c239a354e (patch)
tree566052b487d6afeca1fbcbab421d34e5a969d7c4
parenteb76915bfd6f822f2cd7cb75ab5af999654e8f53 (diff)
clean ups static qt plug-in linking, add macOs requirements
-rw-r--r--CMakeLists.txt68
-rw-r--r--src/mixxxapplication.cpp26
2 files changed, 53 insertions, 41 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d63d64eac..a005a57ef9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2064,6 +2064,46 @@ target_link_libraries(mixxx-lib PUBLIC
Qt5::Widgets
Qt5::Xml)
target_compile_definitions(mixxx-lib PUBLIC QT_TABLET_SUPPORT QT_USE_QSTRINGBUILDER)
+get_target_property(QT5_TYPE Qt5::Core TYPE)
+if(QT5_TYPE STREQUAL "STATIC_LIBRARY")
+
+ # NOTE(rryan): If you are adding a plugin here, you must also
+ # update src/mixxxapplication.cpp to define a Q_IMPORT_PLUGIN
+ # for it. Not all imageformats plugins are built as .libs when
+ # building Qt statically on Windows. Check the build environment
+ # to see exactly what's available as a standalone .lib vs linked
+ # into Qt .libs by default.
+
+ set_property(TARGET mixxx-lib APPEND PROPERTY INTERFACE_LINK_LIBRARIES
+ # platform plugins
+ Qt5::QOffscreenIntegrationPlugin
+ Qt5::QMinimalIntegrationPlugin
+
+ # imageformats plugins
+ Qt5::QGifPlugin
+ Qt5::QICOPlugin
+ Qt5::QJpegPlugin
+
+ # sqldrivers
+ Qt5::QSQLiteDriverPlugin
+ )
+
+ if(WIN32)
+ set_property(TARGET mixxx-lib APPEND PROPERTY INTERFACE_LINK_LIBRARIES
+ Qt5::QWindowsIntegrationPlugin
+ Qt5::QWindowsVistaStylePlugin
+ )
+ endif()
+
+ if(APPLE)
+ set_property(TARGET mixxx-lib APPEND PROPERTY INTERFACE_LINK_LIBRARIES
+ Qt5::QCocoaIntegrationPlugin
+ Qt5::QMacStylePlugin
+ )
+ endif()
+
+endif()
+
if(UNIX AND NOT APPLE)
find_package(X11 REQUIRED)
find_package(Qt5 COMPONENTS X11Extras DBus REQUIRED)
@@ -2074,9 +2114,7 @@ if(UNIX AND NOT APPLE)
Qt5::DBus
)
elseif(WIN32)
- get_target_property(QT5_TYPE Qt5::Core TYPE)
if(QT5_TYPE STREQUAL "STATIC_LIBRARY")
- target_compile_definitions(mixxx-lib PUBLIC QT_NODLL)
target_link_libraries(mixxx-lib PRIVATE
# Pulled from qt-4.8.2-source\mkspecs\win32-msvc2010\qmake.conf
# QtCore
@@ -2110,32 +2148,6 @@ elseif(WIN32)
uxtheme # ?
version # ?
wtsapi32 # ?
-
- # NOTE(rryan): If you are adding a plugin here, you must also
- # update src/mixxxapplication.cpp to define a Q_IMPORT_PLUGIN
- # for it. Not all imageformats plugins are built as .libs when
- # building Qt statically on Windows. Check the build environment
- # to see exactly what's available as a standalone .lib vs linked
- # into Qt .libs by default.
-
- # iconengines plugins
- Qt5::QSvgIconPlugin
-
- # imageformats plugins
- Qt5::QGifPlugin
- Qt5::QICOPlugin
- Qt5::QJpegPlugin
- Qt5::QSvgPlugin
- Qt5::QTgaPlugin
-
- # platform plugins (new in Qt5 for Windows)
- Qt5::QWindowsIntegrationPlugin
-
- # styles (new in Qt5 for Windows)
- Qt5::QWindowsVistaStylePlugin
-
- # sqldrivers (new in Qt5? or did we just start enabling them)
- Qt5::QSQLiteDriverPlugin
)
find_library(QT5FONTDATABASESUPPORT_LIBRARY Qt5FontDatabaseSupport)
diff --git a/src/mixxxapplication.cpp b/src/mixxxapplication.cpp
index 5d21deedfc..e963a93982 100644
--- a/src/mixxxapplication.cpp
+++ b/src/mixxxapplication.cpp
@@ -19,25 +19,25 @@
// When linking Qt statically on Windows we have to Q_IMPORT_PLUGIN all the
// plugins we link in build/depends.py.
-#ifdef QT_NODLL
+#ifdef QT_STATIC
#include <QtPlugin>
-// sqldrivers plugins
-Q_IMPORT_PLUGIN(QSQLiteDriverPlugin)
-// platform plugins
+#if defined(Q_OS_WIN)
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
-// style plugins
Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
-// imageformats plugins
-Q_IMPORT_PLUGIN(QSvgPlugin)
-Q_IMPORT_PLUGIN(QSvgIconPlugin)
+#elif defined(Q_OS_MACOS)
+Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
+Q_IMPORT_PLUGIN(QMacStylePlugin)
+#else
+#error "Q_IMPORT_PLUGIN() for the current patform is missing"
+#endif
+Q_IMPORT_PLUGIN(QOffscreenIntegrationPlugin)
+Q_IMPORT_PLUGIN(QMinimalIntegrationPlugin)
+
+Q_IMPORT_PLUGIN(QSQLiteDriverPlugin)
Q_IMPORT_PLUGIN(QICOPlugin)
-Q_IMPORT_PLUGIN(QTgaPlugin)
Q_IMPORT_PLUGIN(QJpegPlugin)
Q_IMPORT_PLUGIN(QGifPlugin)
-// accessible plugins
-// TODO(rryan): This is supposed to exist but does not in our builds.
-//Q_IMPORT_PLUGIN(AccessibleFactory)
-#endif
+#endif // QT_STATIC
namespace {