Qt: Support static build on macOS
Vicki Pfau vi@endrift.com
Mon, 07 May 2018 09:57:50 -0700
2 files changed,
22 insertions(+),
4 deletions(-)
M
src/platform/qt/CMakeLists.txt
→
src/platform/qt/CMakeLists.txt
@@ -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)
M
src/platform/qt/main.cpp
→
src/platform/qt/main.cpp
@@ -19,11 +19,17 @@ #include <QTranslator>
#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