Fix use of static Qt 5 plugins
This commit is contained in:
parent
70a9d68555
commit
653d954a54
|
@ -20,7 +20,7 @@ if(DBUS_FILES)
|
|||
list(APPEND QT_MODULES DBus)
|
||||
endif()
|
||||
|
||||
if(SVG_SUPPORT OR ((USE_STATIC_QT_BUILD AND (WIDGETS_GUI OR QUICK_GUI)) AND SVG_ICON_SUPPORT))
|
||||
if(SVG_SUPPORT OR (SVG_ICON_SUPPORT AND (USE_STATIC_QT5_Gui OR USE_STATIC_QT5_Widgets OR USE_STATIC_QT5_Quick)))
|
||||
list(APPEND QT_MODULES Svg)
|
||||
list(APPEND QT_REPOS svg)
|
||||
endif()
|
||||
|
@ -61,17 +61,18 @@ foreach(KF_MODULE ${IMPORTED_KF_MODULES})
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
# tune for static build
|
||||
if(USE_STATIC_QT5_CORE AND (WIDGETS_GUI OR QUICK_GUI))
|
||||
# include plugins statically
|
||||
if(WIN32)
|
||||
list(APPEND PRIVATE_LIBRARIES Qt5::static::QWindowsIntegrationPlugin)
|
||||
list(APPEND PRIVATE_STATIC_LIBRARIES Qt5::static::QWindowsIntegrationPlugin)
|
||||
endif()
|
||||
if(SVG_ICON_SUPPORT)
|
||||
list(APPEND PRIVATE_LIBRARIES Qt5::static::QSvgPlugin)
|
||||
list(APPEND PRIVATE_STATIC_LIBRARIES Qt5::static::QSvgPlugin)
|
||||
# built-in plugins when doing static build
|
||||
if(WIN32 AND (USE_STATIC_QT5_Gui OR USE_STATIC_QT5_Widgets OR USE_STATIC_QT5_Quick))
|
||||
if(NOT USE_STATIC_QT5_Gui)
|
||||
find_qt5_module(Gui REQUIRED)
|
||||
endif()
|
||||
use_static_qt5_plugin(Gui WindowsIntegration)
|
||||
endif()
|
||||
if((SVG_SUPPORT OR SVG_ICON_SUPPORT) AND USE_STATIC_QT5_Svg)
|
||||
use_static_qt5_plugin(Svg Svg)
|
||||
endif()
|
||||
if(SVG_ICON_SUPPORT AND USE_STATIC_QT5_Svg)
|
||||
use_static_qt5_plugin(Svg SvgIcon)
|
||||
endif()
|
||||
|
||||
# option for built-in translations
|
||||
|
|
|
@ -36,10 +36,11 @@ if(NOT DEFINED QT_LINKAGE_DETERMINED)
|
|||
find_package(StaticQt5${MODULE})
|
||||
if(StaticQt5${MODULE}_FOUND)
|
||||
if(TARGET StaticQt5::${MODULE})
|
||||
set(QT5_${MODULE}_STATIC_LIB StaticQt5::${MODULE})
|
||||
set(QT5_${MODULE}_STATIC_PREFIX "StaticQt5::")
|
||||
else()
|
||||
set(QT5_${MODULE}_STATIC_LIB Qt5::static::${MODULE})
|
||||
set(QT5_${MODULE}_STATIC_PREFIX "Qt5::static::")
|
||||
endif()
|
||||
set(QT5_${MODULE}_STATIC_LIB "${QT5_${MODULE}_STATIC_PREFIX}${MODULE}")
|
||||
set(QT5_${MODULE}_ASSUME_STATIC OFF)
|
||||
set(QT5_${MODULE}_FOUND ON)
|
||||
# reverse lookup for pkg-config
|
||||
|
@ -51,7 +52,8 @@ if(NOT DEFINED QT_LINKAGE_DETERMINED)
|
|||
if(USE_STATIC_QT_BUILD AND NOT StaticQt5${MODULE}_FOUND AND Qt5${MODULE}_FOUND)
|
||||
find_package(Qt5${MODULE} ${QT_5_${MODULE}_REQUIRED})
|
||||
if(Qt5${MODULE}_FOUND)
|
||||
set(QT5_${MODULE}_STATIC_LIB Qt5::${MODULE})
|
||||
set(QT5_${MODULE}_STATIC_PREFIX "Qt5::")
|
||||
set(QT5_${MODULE}_STATIC_LIB "${QT5_${MODULE}_STATIC_PREFIX}${MODULE}")
|
||||
set(QT5_${MODULE}_ASSUME_STATIC ON)
|
||||
set(QT5_${MODULE}_FOUND ON)
|
||||
# reverse lookup for pkg-config
|
||||
|
@ -85,14 +87,10 @@ if(NOT DEFINED QT_LINKAGE_DETERMINED)
|
|||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(use_static_qt5_plugin PLUGIN)
|
||||
if(TARGET "Qt5::static::Q${PLUGIN}Plugin")
|
||||
list(APPEND LIBRARIES "Qt5::static::Q${PLUGIN}Plugin")
|
||||
list(APPEND STATIC_LIBRARIES "Qt5::static::Q${PLUGIN}Plugin")
|
||||
else()
|
||||
list(APPEND LIBRARIES "Qt5::Q${PLUGIN}Plugin")
|
||||
list(APPEND STATIC_LIBRARIES "Qt5::Q${PLUGIN}Plugin")
|
||||
endif()
|
||||
macro(use_static_qt5_plugin MODULE PLUGIN)
|
||||
list(APPEND PRIVATE_LIBRARIES "${QT5_${MODULE}_STATIC_PREFIX}Q${PLUGIN}Plugin")
|
||||
list(APPEND PRIVATE_STATIC_LIBRARIES "${QT5_${MODULE}_STATIC_PREFIX}Q${PLUGIN}Plugin")
|
||||
message(STATUS "Linking ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} against static Qt 5 plugin ${QT5_${MODULE}_STATIC_PREFIX}Q${PLUGIN}Plugin")
|
||||
endmacro()
|
||||
|
||||
endif(NOT DEFINED QT_LINKAGE_DETERMINED)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#ifdef QT_STATIC
|
||||
# if defined(GUI_QTWIDGETS) || defined(GUI_QTQUICK)
|
||||
# include <QtPlugin>
|
||||
# ifdef PLATFORM_WINDOWS
|
||||
# ifdef Q_OS_WIN32
|
||||
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
|
||||
# endif
|
||||
# ifdef SVG_SUPPORT
|
||||
|
|
Loading…
Reference in New Issue