From 8090c03dfb56efde420a44b740fe69f5393a1392 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 10 Apr 2022 19:19:43 -0700 Subject: [PATCH] Qt: Support static build on Linux --- src/platform/qt/CMakeLists.txt | 9 ++++++--- src/platform/qt/main.cpp | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/platform/qt/CMakeLists.txt b/src/platform/qt/CMakeLists.txt index 4d65c07d2..fc87441a9 100644 --- a/src/platform/qt/CMakeLists.txt +++ b/src/platform/qt/CMakeLists.txt @@ -342,7 +342,8 @@ if(QT_STATIC) 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" "-framework SystemConfiguration" "-framework Security") set_target_properties(Qt5::Core PROPERTIES INTERFACE_LINK_LIBRARIES "${QTPCRE};${QTHARFBUZZ};${QTFREETYPE}") - link_directories() + elseif(UNIX) + list(APPEND QT_LIBRARIES Qt5::FontDatabaseSupport Qt5::XcbQpa) endif() endif() target_link_libraries(${BINARY_NAME}-qt ${PLATFORM_LIBRARY} ${BINARY_NAME} ${QT_LIBRARIES}) @@ -404,11 +405,13 @@ elseif(WIN32) endif() endif() -if(DISTBUILD AND CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - if(NOT APPLE) +if(DISTBUILD AND NOT APPLE) + if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") add_custom_command(TARGET ${BINARY_NAME}-qt POST_BUILD COMMAND "${OBJCOPY}" --only-keep-debug "$" "$.debug") add_custom_command(TARGET ${BINARY_NAME}-qt POST_BUILD COMMAND "${STRIP}" "$") add_custom_command(TARGET ${BINARY_NAME}-qt POST_BUILD COMMAND "${OBJCOPY}" --add-gnu-debuglink "$.debug" "$") install(FILES "$.debug" DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${BINARY_NAME}-qt-dbg) + elseif(BUILD_STATIC AND (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")) + add_custom_command(TARGET ${BINARY_NAME}-qt POST_BUILD COMMAND "${STRIP}" "$") endif() endif() diff --git a/src/platform/qt/main.cpp b/src/platform/qt/main.cpp index 38a3df725..8a7efef90 100644 --- a/src/platform/qt/main.cpp +++ b/src/platform/qt/main.cpp @@ -36,6 +36,8 @@ Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin); Q_IMPORT_PLUGIN(CoreAudioPlugin); Q_IMPORT_PLUGIN(AVFServicePlugin); #endif +#elif defined(Q_OS_UNIX) +Q_IMPORT_PLUGIN(QXcbIntegrationPlugin); #endif #endif