diff --git a/CMakeLists.txt b/CMakeLists.txt index cd3dfb197..5d9a1a32b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 1fe53b9a9..62caf275d 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -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) diff --git a/include/config/build-config.h.in b/include/config/build-config.h.in index 362429a92..9f16f02c5 100644 --- a/include/config/build-config.h.in +++ b/include/config/build-config.h.in @@ -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 */