[common,addin] make plugin loader path configurable

* Add new option WITH_ABSOLUTE_PLUGIN_LOAD_PATHS to allow overriding
  platform default option (load channel plugins with absolute paths or
  from environment search paths)
* Fix freerdp_get_dynamic_addin_install_path: use native platform path
  separators
This commit is contained in:
Armin Novak 2024-01-25 11:39:49 +01:00 committed by akallabeth
parent 5cb463e74b
commit 33764e603a
3 changed files with 38 additions and 8 deletions

View File

@ -690,6 +690,13 @@ endif()
# Android expects all libraries to be loadable
# without paths.
if (ANDROID OR WIN32 OR MAC_BUNDLE)
set(PLUGIN_ABS_PATHS_DEFAULT OFF)
else()
set(PLUGIN_ABS_PATHS_DEFAULT ON)
endif()
option(WITH_ABSOLUTE_PLUGIN_LOAD_PATHS "Load plugins with absolute paths" ${PLUGIN_ABS_PATHS_DEFAULT})
if (NOT WITH_ABSOLUTE_PLUGIN_LOAD_PATHS)
set(FREERDP_DATA_PATH "share")
if (NOT FREERDP_INSTALL_PREFIX)
set(FREERDP_INSTALL_PREFIX ".")
@ -702,7 +709,11 @@ else()
set(FREERDP_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()
set(FREERDP_LIBRARY_PATH "${CMAKE_INSTALL_LIBDIR}")
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/${FREERDP_MAJOR_DIR}")
if (WIN32)
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_BINDIR}/${FREERDP_MAJOR_DIR}")
else()
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/${FREERDP_MAJOR_DIR}")
endif()
endif()
set(FREERDP_ADDIN_PATH "${FREERDP_PLUGIN_PATH}")

View File

@ -19,6 +19,25 @@
option(WITH_OPAQUE_SETTINGS "Hide rdpSettings struct definition, only allow getter/setter access" OFF)
# prepare paths for C
file(TO_NATIVE_PATH "${FREERDP_DATA_PATH}" NATIVE_FREERDP_DATA_PATH)
file(TO_NATIVE_PATH "${FREERDP_KEYMAP_PATH}" NATIVE_FREERDP_KEYMAP_PATH)
file(TO_NATIVE_PATH "${FREERDP_PLUGIN_PATH}" NATIVE_FREERDP_PLUGIN_PATH)
file(TO_NATIVE_PATH "${FREERDP_INSTALL_PREFIX}" NATIVE_FREERDP_INSTALL_PREFIX)
file(TO_NATIVE_PATH "${FREERDP_LIBRARY_PATH}" NATIVE_FREERDP_LIBRARY_PATH)
file(TO_NATIVE_PATH "${FREERDP_ADDIN_PATH}" NATIVE_FREERDP_ADDIN_PATH)
file(TO_NATIVE_PATH "${FREERDP_PROXY_PLUGINDIR}" NATIVE_FREERDP_PROXY_PLUGINDIR)
if (WIN32)
string(REPLACE "\\" "\\\\" NATIVE_FREERDP_DATA_PATH "${NATIVE_FREERDP_DATA_PATH}")
string(REPLACE "\\" "\\\\" NATIVE_FREERDP_KEYMAP_PATH "${NATIVE_FREERDP_KEYMAP_PATH}")
string(REPLACE "\\" "\\\\" NATIVE_FREERDP_PLUGIN_PATH "${NATIVE_FREERDP_PLUGIN_PATH}")
string(REPLACE "\\" "\\\\" NATIVE_FREERDP_INSTALL_PREFIX "${NATIVE_FREERDP_INSTALL_PREFIX}")
string(REPLACE "\\" "\\\\" NATIVE_FREERDP_LIBRARY_PATH "${NATIVE_FREERDP_LIBRARY_PATH}")
string(REPLACE "\\" "\\\\" NATIVE_FREERDP_ADDIN_PATH "${NATIVE_FREERDP_ADDIN_PATH}")
string(REPLACE "\\" "\\\\" NATIVE_FREERDP_PROXY_PLUGINDIR "${NATIVE_FREERDP_PROXY_PLUGINDIR}")
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/version.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/build-config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/config.h)

View File

@ -1,15 +1,15 @@
#ifndef FREERDP_BUILD_CONFIG_H
#define FREERDP_BUILD_CONFIG_H
#define FREERDP_DATA_PATH "${FREERDP_DATA_PATH}"
#define FREERDP_KEYMAP_PATH "${FREERDP_KEYMAP_PATH}"
#define FREERDP_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}"
#define FREERDP_DATA_PATH "${NATIVE_FREERDP_DATA_PATH}"
#define FREERDP_KEYMAP_PATH "${NATIVE_FREERDP_KEYMAP_PATH}"
#define FREERDP_PLUGIN_PATH "${NATIVE_FREERDP_PLUGIN_PATH}"
#define FREERDP_INSTALL_PREFIX "${FREERDP_INSTALL_PREFIX}"
#define FREERDP_INSTALL_PREFIX "${NATIVE_FREERDP_INSTALL_PREFIX}"
#define FREERDP_LIBRARY_PATH "${FREERDP_LIBRARY_PATH}"
#define FREERDP_LIBRARY_PATH "${NATIVE_FREERDP_LIBRARY_PATH}"
#define FREERDP_ADDIN_PATH "${FREERDP_ADDIN_PATH}"
#define FREERDP_ADDIN_PATH "${NATIVE_FREERDP_ADDIN_PATH}"
#define FREERDP_SHARED_LIBRARY_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}"
#define FREERDP_SHARED_LIBRARY_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}"
@ -17,6 +17,6 @@
#define FREERDP_VENDOR_STRING "${VENDOR}"
#define FREERDP_PRODUCT_STRING "${PRODUCT}"
#define FREERDP_PROXY_PLUGINDIR "${FREERDP_PROXY_PLUGINDIR}"
#define FREERDP_PROXY_PLUGINDIR "${NATIVE_FREERDP_PROXY_PLUGINDIR}"
#endif /* FREERDP_BUILD_CONFIG_H */