From 926c3119df0b9873537a19209277252004ef1af3 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 17 Jun 2023 02:50:51 +0400 Subject: [PATCH] Migrate from qt_static_plugins.cpp to the Qt6-pregenerated initializators --- external/fcitx5_qt/CMakeLists.txt | 5 ++ external/fcitx5_qt/init.cpp | 10 +++ external/fcitx_qt5/CMakeLists.txt | 5 ++ external/fcitx_qt5/init.cpp | 10 +++ external/hime_qt/CMakeLists.txt | 5 ++ external/hime_qt/init.cpp | 10 +++ external/kimageformats/CMakeLists.txt | 4 ++ external/kimageformats/init.cpp | 12 ++++ external/nimf_qt5/CMakeLists.txt | 5 ++ external/nimf_qt5/init.cpp | 10 +++ external/qt/CMakeLists.txt | 37 ++++++++++- .../qt_static_plugins/qt_static_plugins.cpp | 64 +------------------ 12 files changed, 112 insertions(+), 65 deletions(-) create mode 100644 external/fcitx5_qt/init.cpp create mode 100644 external/fcitx_qt5/init.cpp create mode 100644 external/hime_qt/init.cpp create mode 100644 external/kimageformats/init.cpp create mode 100644 external/nimf_qt5/init.cpp diff --git a/external/fcitx5_qt/CMakeLists.txt b/external/fcitx5_qt/CMakeLists.txt index b002d59..0d76b46 100644 --- a/external/fcitx5_qt/CMakeLists.txt +++ b/external/fcitx5_qt/CMakeLists.txt @@ -22,6 +22,11 @@ set(FCITX5_QT_EXTRA_PLUGIN_NAME "") configure_file("${fcitx5_qt_src}/fcitx5.json.in" "${CMAKE_CURRENT_BINARY_DIR}/fcitx5.json") +nice_target_sources(external_fcitx5_qt ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + nice_target_sources(external_fcitx5_qt ${fcitx5_qt_src} PRIVATE qfcitxplatforminputcontext.cpp diff --git a/external/fcitx5_qt/init.cpp b/external/fcitx5_qt/init.cpp new file mode 100644 index 0000000..d8adcf1 --- /dev/null +++ b/external/fcitx5_qt/init.cpp @@ -0,0 +1,10 @@ +/* +This file is part of Desktop App Toolkit, +a set of libraries for developing nice desktop applications. + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL +*/ +#include + +Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin) diff --git a/external/fcitx_qt5/CMakeLists.txt b/external/fcitx_qt5/CMakeLists.txt index 7f4a8b5..76337c8 100644 --- a/external/fcitx_qt5/CMakeLists.txt +++ b/external/fcitx_qt5/CMakeLists.txt @@ -19,6 +19,11 @@ set(fcitx_qt5_src ${fcitx_qt5_loc}/qt${QT_VERSION_MAJOR}/platforminputcontext) set_target_properties(external_fcitx_qt5 PROPERTIES AUTOMOC ON) +nice_target_sources(external_fcitx_qt5 ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + nice_target_sources(external_fcitx_qt5 ${fcitx_qt5_src} PRIVATE fcitxinputcontextproxy.cpp diff --git a/external/fcitx_qt5/init.cpp b/external/fcitx_qt5/init.cpp new file mode 100644 index 0000000..86d9dd1 --- /dev/null +++ b/external/fcitx_qt5/init.cpp @@ -0,0 +1,10 @@ +/* +This file is part of Desktop App Toolkit, +a set of libraries for developing nice desktop applications. + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL +*/ +#include + +Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) diff --git a/external/hime_qt/CMakeLists.txt b/external/hime_qt/CMakeLists.txt index 869b10f..562f0d7 100644 --- a/external/hime_qt/CMakeLists.txt +++ b/external/hime_qt/CMakeLists.txt @@ -19,6 +19,11 @@ set(hime_qt_src ${hime_loc}/src/qt5-im) set_target_properties(external_hime_qt PROPERTIES AUTOMOC ON) +nice_target_sources(external_hime_qt ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + nice_target_sources(external_hime_qt ${hime_qt_src} PRIVATE hime-imcontext-qt.cpp diff --git a/external/hime_qt/init.cpp b/external/hime_qt/init.cpp new file mode 100644 index 0000000..d7b9784 --- /dev/null +++ b/external/hime_qt/init.cpp @@ -0,0 +1,10 @@ +/* +This file is part of Desktop App Toolkit, +a set of libraries for developing nice desktop applications. + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL +*/ +#include + +Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) diff --git a/external/kimageformats/CMakeLists.txt b/external/kimageformats/CMakeLists.txt index 813ce77..121eed5 100644 --- a/external/kimageformats/CMakeLists.txt +++ b/external/kimageformats/CMakeLists.txt @@ -30,6 +30,10 @@ DEPENDS ${kimageformats_src}/jxl.json ) +nice_target_sources(external_kimageformats ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) nice_target_sources(external_kimageformats ${kimageformats_src} PRIVATE avif.cpp diff --git a/external/kimageformats/init.cpp b/external/kimageformats/init.cpp new file mode 100644 index 0000000..9713d57 --- /dev/null +++ b/external/kimageformats/init.cpp @@ -0,0 +1,12 @@ +/* +This file is part of Desktop App Toolkit, +a set of libraries for developing nice desktop applications. + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL +*/ +#include + +Q_IMPORT_PLUGIN(QAVIFPlugin) +Q_IMPORT_PLUGIN(HEIFPlugin) +Q_IMPORT_PLUGIN(QJpegXLPlugin) diff --git a/external/nimf_qt5/CMakeLists.txt b/external/nimf_qt5/CMakeLists.txt index c409663..53b0803 100644 --- a/external/nimf_qt5/CMakeLists.txt +++ b/external/nimf_qt5/CMakeLists.txt @@ -20,6 +20,11 @@ set(nimf_qt5_src ${nimf_loc}/modules/clients/qt5) set_target_properties(external_nimf_qt5 PROPERTIES AUTOMOC ON) +nice_target_sources(external_nimf_qt5 ${CMAKE_CURRENT_SOURCE_DIR} +PRIVATE + init.cpp +) + nice_target_sources(external_nimf_qt5 ${nimf_qt5_src} PRIVATE im-nimf-qt5.cpp diff --git a/external/nimf_qt5/init.cpp b/external/nimf_qt5/init.cpp new file mode 100644 index 0000000..491fc1f --- /dev/null +++ b/external/nimf_qt5/init.cpp @@ -0,0 +1,10 @@ +/* +This file is part of Desktop App Toolkit, +a set of libraries for developing nice desktop applications. + +For license and copyright information please follow this link: +https://github.com/desktop-app/legal/blob/master/LEGAL +*/ +#include + +Q_IMPORT_PLUGIN(NimfInputContextPlugin) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 4b6829f..1223c6a 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -149,6 +149,14 @@ else() endif() set(qt_libs_list "") +if (QT_VERSION_MAJOR GREATER_EQUAL 6) + list(APPEND qt_libs_list + $ + $ + $ + ) +endif() + if (WIN32) target_include_directories(external_qt SYSTEM INTERFACE @@ -186,12 +194,15 @@ elseif (APPLE) plugins/tls/${qt_lib_prefix}qsecuretransportbackend plugins/networkinformation/${qt_lib_prefix}qscnetworkreachability ) + list(APPEND qt_libs_list + $ + $ + $ + $ + ) foreach (lib ${qt_libs}) list(APPEND qt_libs_list "${qt_loc}/${lib}${qt_lib_suffix}") endforeach() - list(APPEND qt_libs_list - $ - ) else() set(qt_libs plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin @@ -204,6 +215,15 @@ else() lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}XcbQpa ${common_qt_libs} ) + list(APPEND qt_libs_list + $ + $ + $ + $ + $ + $ + $ + ) if (TARGET Qt::DBus) list(APPEND qt_libs plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin @@ -211,6 +231,10 @@ else() lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}DBus lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core ) + list(APPEND qt_libs_list + $ + $ + ) endif() if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) list(PREPEND qt_libs @@ -222,6 +246,13 @@ else() lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandEglClientHwIntegration lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}WaylandClient ) + list(APPEND qt_libs_list + $ + $ + $ + $ + $ + ) endif() if (TARGET Qt::WaylandCompositor) list(PREPEND qt_libs diff --git a/external/qt/qt_static_plugins/qt_static_plugins.cpp b/external/qt/qt_static_plugins/qt_static_plugins.cpp index f6580f4..af68849 100644 --- a/external/qt/qt_static_plugins/qt_static_plugins.cpp +++ b/external/qt/qt_static_plugins/qt_static_plugins.cpp @@ -7,70 +7,10 @@ https://github.com/desktop-app/legal/blob/master/LEGAL */ #include -#ifndef DESKTOP_APP_USE_PACKAGED -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - -#ifdef Q_OS_MAC -Q_IMPORT_PLUGIN(QSecureTransportBackend) -Q_IMPORT_PLUGIN(QSCNetworkReachabilityNetworkInformationBackendFactory) -#else // Q_OS_MAC -Q_IMPORT_PLUGIN(QTlsBackendOpenSSL) -#endif // Q_OS_MAC - -#else // Qt >= 6.0.0 +#if !defined DESKTOP_APP_USE_PACKAGED && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined Q_OS_WIN Q_IMPORT_PLUGIN(QGenericEnginePlugin) -#endif // Qt < 6.0.0 - Q_IMPORT_PLUGIN(QWebpPlugin) Q_IMPORT_PLUGIN(QJpegPlugin) Q_IMPORT_PLUGIN(QGifPlugin) - -#ifdef Q_OS_WIN Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) -#elif defined Q_OS_MAC // Q_OS_WIN -Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) -#elif defined Q_OS_UNIX // Q_OS_WIN | Q_OS_MAC -Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) -Q_IMPORT_PLUGIN(QXcbEglIntegrationPlugin) -Q_IMPORT_PLUGIN(QXcbGlxIntegrationPlugin) -Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) -Q_IMPORT_PLUGIN(QSvgIconPlugin) -#ifdef QT_DBUS_LIB -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -Q_IMPORT_PLUGIN(QConnmanEnginePlugin) -Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) -#endif // Qt < 6.0.0 -Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) -Q_IMPORT_PLUGIN(QXdgDesktopPortalThemePlugin) -#endif // QT_DBUS_LIB -#ifndef DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION -Q_IMPORT_PLUGIN(QWaylandIntegrationPlugin) -Q_IMPORT_PLUGIN(QWaylandEglPlatformIntegrationPlugin) -Q_IMPORT_PLUGIN(QWaylandEglClientBufferPlugin) -Q_IMPORT_PLUGIN(QWaylandXdgShellIntegrationPlugin) -Q_IMPORT_PLUGIN(QWaylandBradientDecorationPlugin) -#endif // !DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION -Q_IMPORT_PLUGIN(QGtk3ThemePlugin) -#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_UNIX -#endif // !DESKTOP_APP_USE_PACKAGED - -#if !defined DESKTOP_APP_USE_PACKAGED || defined DESKTOP_APP_USE_PACKAGED_LAZY -#if defined Q_OS_WIN || (defined Q_OS_UNIX && !defined Q_OS_MAC) -Q_IMPORT_PLUGIN(QAVIFPlugin) -Q_IMPORT_PLUGIN(HEIFPlugin) -Q_IMPORT_PLUGIN(QJpegXLPlugin) -#endif // Q_OS_WIN || (Q_OS_UNIX && !Q_OS_MAC) - -#if defined Q_OS_UNIX && !defined Q_OS_MAC -Q_IMPORT_PLUGIN(NimfInputContextPlugin) -#ifdef QT_DBUS_LIB -Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) -#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION -Q_IMPORT_PLUGIN(QFcitx5PlatformInputContextPlugin) -#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION -#endif // QT_DBUS_LIB -#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION -Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) -#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION -#endif // Q_OS_UNIX && !Q_OS_MAC -#endif // !DESKTOP_APP_USE_PACKAGED || DESKTOP_APP_USE_PACKAGED_LAZY +#endif // !DESKTOP_APP_USE_PACKAGED && Qt < 6.0.0 && Q_OS_WIN