add cmake switch to force recursive plugin loading

This commit is contained in:
Martin Rotter 2025-02-10 13:33:11 +01:00
parent 746e9affd2
commit 0d57cc39ca
3 changed files with 17 additions and 10 deletions

View file

@ -110,14 +110,6 @@ if(APPLE)
add_link_options(-stdlib=libc++)
endif()
if(FORCE_COLORED_OUTPUT)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-fdiagnostics-color=always)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-fcolor-diagnostics)
endif()
endif()
# Global compilation switches.
option(BUILD_WITH_QT6 "Build application with Qt 6." ON)
option(BUILD_MSYS2 "Build application for MSYS2 ecosystem." OFF)
@ -125,6 +117,7 @@ option(USE_SYSTEM_SQLITE "Use system-wide SQLite3 library." ON)
option(NO_LITE "Enable QtWebEngine and other more demanding components." ON)
option(UPDATE_TRANSLATIONS "Call lupdate to update translation files from source (Qt 6 only)." OFF)
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GCC/Clang only)." OFF)
option(LOAD_PLUGINS_FROM_PARENT "Force loading of plugin libraries from parent folder." OFF)
option(REVISION_FROM_GIT "Get revision using `git rev-parse`." ON)
option(NO_UPDATE_CHECK "Disable automatic checking for new application updates." OFF)
option(IS_FLATPAK_BUILD "Set to 'ON' when building RSS Guard with Flatpak." OFF)
@ -163,6 +156,13 @@ if(MINGW AND NO_LITE)
set(NO_LITE OFF)
endif()
if(FORCE_COLORED_OUTPUT)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-fdiagnostics-color=always)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-fcolor-diagnostics)
endif()
endif()
if(ENABLE_MEDIAPLAYER_QTMULTIMEDIA AND ENABLE_MEDIAPLAYER_LIBMPV)
message(FATAL_ERROR "You can only enable 1 media player backend.")

View file

@ -656,6 +656,13 @@ target_compile_definitions(rssguard
RSSGUARD_LIBDIR="${CMAKE_INSTALL_LIBDIR}"
)
if(LOAD_PLUGINS_FROM_PARENT)
target_compile_definitions(rssguard
PRIVATE
LOAD_PLUGINS_FROM_PARENT
)
endif()
# Install public headers.
set(HEADERS_ROOT "${PROJECT_SOURCE_DIR}/src/librssguard")
file(GLOB_RECURSE HEADER_FILES RELATIVE ${HEADERS_ROOT} "*.h")

View file

@ -24,7 +24,7 @@ QList<ServiceEntryPoint*> PluginFactory::loadPlugins() const {
QDirIterator dir_iter(plugin_folder,
{plugin_name_wildcard},
QDir::Filter::Files,
#if !defined(NDEBUG)
#if !defined(NDEBUG) || defined(LOAD_PLUGINS_FROM_PARENT)
QDirIterator::IteratorFlag::Subdirectories);
#else
QDirIterator::IteratorFlag::NoIteratorFlags);
@ -82,7 +82,7 @@ QStringList PluginFactory::pluginPaths() const {
paths << QCoreApplication::applicationDirPath();
#endif
#if !defined(NDEBUG)
#if !defined(NDEBUG) || defined(LOAD_PLUGINS_FROM_PARENT)
paths << QCoreApplication::applicationDirPath() + QDir::separator() + QL1S("..") + QDir::separator();
#endif