From b2e7c7a87665f65fce5658265759d7ffb5b234ab Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Sun, 8 Dec 2024 12:40:39 -0500 Subject: [PATCH] make shared library loader optional --- CMakeLists.txt | 6 +++++- src/lib/fcitx/addonmanager.cpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d3ab20d42..d86fa0476 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ option(ENABLE_EMOJI "Enable emoji module" On) option(ENABLE_LIBUUID "Use libuuid for uuid generation" On) option(BUILD_SPELL_DICT "Build en_dict.fscd for English spell check" On) option(BUILD_SHARED_LIBS "Build library as shared libs" On) +option(ENABLE_DL "Enable dynamic loading addons" On) set(NO_PREEDIT_APPS "gvim.*,wps.*,wpp.*,et.*" CACHE STRING "Disable preedit for follwing app by default.") set(EVENT_LOOP_BACKEND "auto" CACHE STRING "Set the underlying event loop implementation, valid values are auto,systemd,libuv,none") @@ -116,7 +117,10 @@ endif() if(${CMAKE_SYSTEM_NAME} MATCHES "BSD|DragonFly") find_package(LibKVM REQUIRED) endif() -find_package(DL REQUIRED) + +if(NOT ENABLE_DL) + add_definitions("-DFCITX_NO_DL") +endif() if (NOT TARGET LibIntl::LibIntl) find_package(LibIntl REQUIRED) diff --git a/src/lib/fcitx/addonmanager.cpp b/src/lib/fcitx/addonmanager.cpp index 55269f333..7c9a4b7e1 100644 --- a/src/lib/fcitx/addonmanager.cpp +++ b/src/lib/fcitx/addonmanager.cpp @@ -250,7 +250,9 @@ void AddonManager::unregisterLoader(const std::string &name) { } void AddonManager::registerDefaultLoader(StaticAddonRegistry *registry) { +#ifndef FCITX_NO_DL registerLoader(std::make_unique()); +#endif if (registry) { registerLoader(std::make_unique(registry)); }