all repos — mgba @ 4c0410a4c8b725e37c9b1b725978f037c7b618e2

mGBA Game Boy Advance Emulator

Qt: Support static build on macOS
Vicki Pfau vi@endrift.com
Mon, 07 May 2018 09:57:50 -0700
commit

4c0410a4c8b725e37c9b1b725978f037c7b618e2

parent

0e5a7ba1ef513da699c1ae116d558d7d6e5aadb2

2 files changed, 22 insertions(+), 4 deletions(-)

jump to
M src/platform/qt/CMakeLists.txtsrc/platform/qt/CMakeLists.txt

@@ -265,9 +265,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.cppsrc/platform/qt/main.cpp

@@ -19,10 +19,16 @@ #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); +#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