Permalink
Browse files

Qt: Support static build on macOS

  • Loading branch information...
endrift committed May 7, 2018
1 parent a0f70c3 commit 09372192d382677e3a6d46d6924f1619c0e63b9c
Showing with 22 additions and 4 deletions.
  1. +15 −3 src/platform/qt/CMakeLists.txt
  2. +7 −1 src/platform/qt/main.cpp
@@ -277,9 +277,21 @@ list(APPEND QT_LIBRARIES Qt5::Widgets)
if(BUILD_GL OR BUILD_GLES2)
list(APPEND QT_LIBRARIES Qt5::OpenGL ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY})
endif()
-if(WIN32 AND QT_STATIC)
- list(APPEND QT_LIBRARIES qwindows dwmapi imm32 uxtheme Qt5EventDispatcherSupport Qt5FontDatabaseSupport Qt5ThemeSupport)
- set_target_properties(Qt5::Core PROPERTIES INTERFACE_LINK_LIBRARIES "qtpcre2;version;winmm;ws2_32")
+if(QT_STATIC)
+ find_library(QTPCRE NAMES qtpcre2 qtpcre)
+ if(WIN32)
+ list(APPEND QT_LIBRARIES qwindows dwmapi imm32 uxtheme Qt5EventDispatcherSupport Qt5FontDatabaseSupport Qt5ThemeSupport)
+ set_target_properties(Qt5::Core PROPERTIES INTERFACE_LINK_LIBRARIES "${QTPCRE};version;winmm;ws2_32")
+ elseif(APPLE)
+ find_package(Cups)
+ find_package(Qt5PrintSupport)
+ find_library(QTFREETYPE NAMES qtfreetype)
+ find_library(QTHARFBUZZ NAMES qtharfbuzzng qtharfbuzz)
+ find_library(QTPLATFORMSUPPORT NAMES Qt5PlatformSupport)
+ list(APPEND QT_LIBRARIES Cups Qt5::PrintSupport Qt5::QCocoaIntegrationPlugin Qt5::CoreAudioPlugin Qt5::AVFServicePlugin Qt5::QCocoaPrinterSupportPlugin ${QTPLATFORMSUPPORT} "-framework AVFoundation" "-framework CoreMedia")
+ set_target_properties(Qt5::Core PROPERTIES INTERFACE_LINK_LIBRARIES "${QTPCRE};${QTHARFBUZZ};${QTFREETYPE}")
+ link_directories()
+ endif()
endif()
target_link_libraries(${BINARY_NAME}-qt ${PLATFORM_LIBRARY} ${BINARY_NAME} ${QT_LIBRARIES})
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE)
View
@@ -19,12 +19,18 @@
#ifdef QT_STATIC
#include <QtPlugin>
-#ifdef _WIN32
+#ifdef Q_OS_WIN
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
#ifdef BUILD_QT_MULTIMEDIA
Q_IMPORT_PLUGIN(QWindowsAudioPlugin);
Q_IMPORT_PLUGIN(DSServicePlugin);
#endif
+#elif defined(Q_OS_MAC)
+Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
+#ifdef BUILD_QT_MULTIMEDIA
+Q_IMPORT_PLUGIN(CoreAudioPlugin);
+Q_IMPORT_PLUGIN(AVFServicePlugin);
+#endif
#endif
#endif

0 comments on commit 0937219

Please sign in to comment.