From 1214289393ea1208bb4ab86ed68a9fab618c105b Mon Sep 17 00:00:00 2001 From: Hillwood Yang Date: Wed, 24 Dec 2025 19:49:48 +0800 Subject: [PATCH] fix: Respect CMAKE_INSTALL_LIBDIR for module installation and lookup This ensures correct installation and runtime lookup on both lib and lib64 based systems. Log: - Define CMAKE_INSTALL_FULL_LIBDIR in top-level CMakeLists.txt - Replace hardcoded 'lib/dde-session-shell/modules' with '${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules' in all plugin CMakeLists - Update modules_loader.cpp to use CMAKE_INSTALL_FULL_LIBDIR for locating modules and configs --- CMakeLists.txt | 2 ++ debian/rules | 8 ++++---- plugins/assist_login/CMakeLists.txt | 2 +- plugins/assist_login/interface/CMakeLists.txt | 2 +- plugins/examples/login-plugins/login-basic/CMakeLists.txt | 2 +- .../examples/login-plugins/login-complex/CMakeLists.txt | 2 +- .../login-plugins/login-fullManaged/CMakeLists.txt | 2 +- plugins/examples/login-plugins/login-udcp/CMakeLists.txt | 2 +- plugins/examples/tray-plugins/network/CMakeLists.txt | 2 +- plugins/examples/tray-plugins/webview/CMakeLists.txt | 2 +- plugins/one-key-login/CMakeLists.txt | 2 +- src/global_util/plugin_manager/modules_loader.cpp | 4 ++-- 12 files changed, 17 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 903028dc..ec64831d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX /usr) endif () +add_definitions(-DCMAKE_INSTALL_FULL_LIBDIR=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\") + set(CMAKE_CXX_STANDARD 17) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) diff --git a/debian/rules b/debian/rules index 5cea71e9..0fa9968b 100755 --- a/debian/rules +++ b/debian/rules @@ -13,22 +13,22 @@ SYSTYPE=$(shell cat /etc/deepin-version | grep Type= | awk -F'=' '{print $$2}') ifeq ($(DEB_BUILD_ARCH), mipsel) override_dh_auto_configure: - dh_auto_configure -- LOCK_NO_QUIT=YES DISABLE_DEMO_VIDEO=YES DISABLE_TEXT_SHADOW=YES DISABLE_ANIMATIONS=YES USE_CURSOR_LOADING_ANI=YES + dh_auto_configure -- LOCK_NO_QUIT=YES DISABLE_DEMO_VIDEO=YES DISABLE_TEXT_SHADOW=YES DISABLE_ANIMATIONS=YES USE_CURSOR_LOADING_ANI=YES -DCMAKE_INSTALL_LIBDIR=lib endif ifeq ($(DEB_BUILD_ARCH), mips64el) override_dh_auto_configure: - dh_auto_configure -- LOCK_NO_QUIT=YES DISABLE_DEMO_VIDEO=YES DISABLE_TEXT_SHADOW=YES DISABLE_ANIMATIONS=YES USE_CURSOR_LOADING_ANI=YES + dh_auto_configure -- LOCK_NO_QUIT=YES DISABLE_DEMO_VIDEO=YES DISABLE_TEXT_SHADOW=YES DISABLE_ANIMATIONS=YES USE_CURSOR_LOADING_ANI=YES -DCMAKE_INSTALL_LIBDIR=lib endif ifeq ($(DEB_BUILD_ARCH), sw_64) override_dh_auto_configure: - dh_auto_configure -- LOCK_NO_QUIT=YES DISABLE_DEMO_VIDEO=YES DISABLE_TEXT_SHADOW=YES DISABLE_ANIMATIONS=YES USE_CURSOR_LOADING_ANI=YES + dh_auto_configure -- LOCK_NO_QUIT=YES DISABLE_DEMO_VIDEO=YES DISABLE_TEXT_SHADOW=YES DISABLE_ANIMATIONS=YES USE_CURSOR_LOADING_ANI=YES -DCMAKE_INSTALL_LIBDIR=lib endif override_dh_auto_configure: dh_auto_configure -- \ - -DWAIT_DEEPIN_ACCOUNTS_SERVICE=1 + -DWAIT_DEEPIN_ACCOUNTS_SERVICE=1 -DCMAKE_INSTALL_LIBDIR=lib ifeq ($(SYSTYPE), Professional) ifeq ($(DEB_BUILD_ARCH), amd64) diff --git a/plugins/assist_login/CMakeLists.txt b/plugins/assist_login/CMakeLists.txt index 6cfeea0d..a177d20e 100644 --- a/plugins/assist_login/CMakeLists.txt +++ b/plugins/assist_login/CMakeLists.txt @@ -20,4 +20,4 @@ aux_source_directory(. SRCS) add_library(${LIB_NAME} SHARED ${SRCS}) add_subdirectory(interface) -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules) \ No newline at end of file +install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules) diff --git a/plugins/assist_login/interface/CMakeLists.txt b/plugins/assist_login/interface/CMakeLists.txt index 4035bd97..c62c9e35 100644 --- a/plugins/assist_login/interface/CMakeLists.txt +++ b/plugins/assist_login/interface/CMakeLists.txt @@ -28,4 +28,4 @@ link_libraries( # 安装/user/lib install(FILES include/assist_login_interface.h DESTINATION /usr/include/dde-session-shell) -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules) +install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules) diff --git a/plugins/examples/login-plugins/login-basic/CMakeLists.txt b/plugins/examples/login-plugins/login-basic/CMakeLists.txt index 65c1e5dc..9a491042 100644 --- a/plugins/examples/login-plugins/login-basic/CMakeLists.txt +++ b/plugins/examples/login-plugins/login-basic/CMakeLists.txt @@ -81,4 +81,4 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE set(CMAKE_INSTALL_PREFIX "/usr") # 设置执行 make install 时哪个目标应该被 install 到哪个位置 -install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules) +install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules) diff --git a/plugins/examples/login-plugins/login-complex/CMakeLists.txt b/plugins/examples/login-plugins/login-complex/CMakeLists.txt index 5edcf612..ba2814d8 100644 --- a/plugins/examples/login-plugins/login-complex/CMakeLists.txt +++ b/plugins/examples/login-plugins/login-complex/CMakeLists.txt @@ -12,4 +12,4 @@ aux_source_directory(. SRCS) add_library(${LIB_NAME} SHARED ${SRCS}) -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules) +install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules) diff --git a/plugins/examples/login-plugins/login-fullManaged/CMakeLists.txt b/plugins/examples/login-plugins/login-fullManaged/CMakeLists.txt index bba76f7a..6728045b 100644 --- a/plugins/examples/login-plugins/login-fullManaged/CMakeLists.txt +++ b/plugins/examples/login-plugins/login-fullManaged/CMakeLists.txt @@ -12,4 +12,4 @@ aux_source_directory(. SRCS) add_library(${LIB_NAME} SHARED ${SRCS}) -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules) +install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules) diff --git a/plugins/examples/login-plugins/login-udcp/CMakeLists.txt b/plugins/examples/login-plugins/login-udcp/CMakeLists.txt index bdbc6f3f..cc8a78f8 100644 --- a/plugins/examples/login-plugins/login-udcp/CMakeLists.txt +++ b/plugins/examples/login-plugins/login-udcp/CMakeLists.txt @@ -12,4 +12,4 @@ aux_source_directory(. SRCS) add_library(${LIB_NAME} SHARED ${SRCS} login-plugin.qrc) -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules) +install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules) diff --git a/plugins/examples/tray-plugins/network/CMakeLists.txt b/plugins/examples/tray-plugins/network/CMakeLists.txt index b2cf5755..f401b97a 100644 --- a/plugins/examples/tray-plugins/network/CMakeLists.txt +++ b/plugins/examples/tray-plugins/network/CMakeLists.txt @@ -12,4 +12,4 @@ aux_source_directory(. SRCS) add_library(${LIB_NAME} SHARED ${SRCS}) -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules) +install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules) diff --git a/plugins/examples/tray-plugins/webview/CMakeLists.txt b/plugins/examples/tray-plugins/webview/CMakeLists.txt index d74ad2d5..c45855bb 100644 --- a/plugins/examples/tray-plugins/webview/CMakeLists.txt +++ b/plugins/examples/tray-plugins/webview/CMakeLists.txt @@ -23,4 +23,4 @@ target_link_libraries(${LIB_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::WebEngineWidgets ) -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules) +install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules) diff --git a/plugins/one-key-login/CMakeLists.txt b/plugins/one-key-login/CMakeLists.txt index 0c64477e..5eafdc97 100644 --- a/plugins/one-key-login/CMakeLists.txt +++ b/plugins/one-key-login/CMakeLists.txt @@ -12,4 +12,4 @@ aux_source_directory(. SRCS) add_library(${LIB_NAME} SHARED ${SRCS}) -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION lib/dde-session-shell/modules) +install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-session-shell/modules) diff --git a/src/global_util/plugin_manager/modules_loader.cpp b/src/global_util/plugin_manager/modules_loader.cpp index bb97f0a2..1e8b2358 100644 --- a/src/global_util/plugin_manager/modules_loader.cpp +++ b/src/global_util/plugin_manager/modules_loader.cpp @@ -16,8 +16,8 @@ #include -const QString ModulesDir = "/usr/lib/dde-session-shell/modules"; -const QString ModulesConfigDir = "/usr/lib/dde-session-shell/modules/config.d/"; +const QString ModulesDir = QString("%1/dde-session-shell/modules").arg(CMAKE_INSTALL_FULL_LIBDIR); +const QString ModulesConfigDir = QString("%1/dde-session-shell/modules/config.d/").arg(CMAKE_INSTALL_FULL_LIBDIR); const QString LOWEST_VERSION = "1.1.0"; const QString LoginType = "Login"; const QString TrayType = "Tray";