mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-23 01:44:35 +08:00
[resource root] unify locations
unify resource locations in case WITH_BINARY_VERSIONING is set.
This commit is contained in:
parent
5538681fc3
commit
a3aa01214c
@ -106,10 +106,16 @@ if (SDL_USE_COMPILED_RESOURCES)
|
||||
endforeach()
|
||||
write_file(${FINIT} "}" APPEND)
|
||||
else()
|
||||
set(SDL_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR}/FreeRDP)
|
||||
if (WITH_BINARY_VERSIONING)
|
||||
string(APPEND SDL_RESOURCE_ROOT "${PROJECT_VERSION_MAJOR}")
|
||||
endif()
|
||||
option(SDL_USE_VENDOR_PRODUCT_CONFIG_DIR "Use <vendor>/<product> path for resources" OFF)
|
||||
set(SDL_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR})
|
||||
if (SDL_USE_VENDOR_PRODUCT_CONFIG_DIR)
|
||||
string(APPEND SDL_RESOURCE_ROOT "/${VENDOR}")
|
||||
endif()
|
||||
string(APPEND SDL_RESOURCE_ROOT "/${PRODUCT}")
|
||||
|
||||
if (WITH_BINARY_VERSIONING)
|
||||
string(APPEND SDL_RESOURCE_ROOT "${FREERDP_VERSION_MAJOR}")
|
||||
endif()
|
||||
|
||||
add_definitions(-DSDL_RESOURCE_ROOT="${SDL_RESOURCE_ROOT}")
|
||||
|
||||
|
@ -3,6 +3,7 @@ option(CMAKE_VERBOSE_MAKEFILE "verbose CMake makefile" ON)
|
||||
option(CMAKE_POSITION_INDEPENDENT_CODE "build with position independent code (-fPIC or -fPIE)" ON)
|
||||
option(WITH_LIBRARY_VERSIONING "Use library version triplet" ON)
|
||||
option(WITH_BINARY_VERSIONING "Use binary versioning" OFF)
|
||||
option(WITH_RESOURCE_VERSIONING "Use resource versioning" OFF)
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
|
||||
# We want to control the winpr assert for the whole project
|
||||
|
@ -18,6 +18,17 @@
|
||||
set(MODULE_NAME "freerdp")
|
||||
set(MODULE_PREFIX "FREERDP")
|
||||
|
||||
option(FREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR "Use <vendor>/<product> path for resources" OFF)
|
||||
set(FREERDP_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR})
|
||||
if (FREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR)
|
||||
string(APPEND FREERDP_RESOURCE_ROOT "/${VENDOR}")
|
||||
endif()
|
||||
string(APPEND FREERDP_RESOURCE_ROOT "/${PRODUCT}")
|
||||
|
||||
if (WITH_RESOURCE_VERSIONING)
|
||||
string(APPEND FREERDP_RESOURCE_ROOT "${FREERDP_VERSION_MAJOR}")
|
||||
endif()
|
||||
|
||||
# CMake modules includes
|
||||
include(FindCairo)
|
||||
|
||||
@ -198,6 +209,13 @@ endif()
|
||||
|
||||
AddTargetWithResourceFile(${MODULE_NAME} FALSE "${FREERDP_VERSION}" LIBFREERDP_SRCS)
|
||||
|
||||
if (WITH_RESOURCE_VERSIONING)
|
||||
target_compile_definitions(${MODULE_NAME} PRIVATE -DWITH_RESOURCE_VERSIONING)
|
||||
endif()
|
||||
if (FREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR)
|
||||
target_compile_definitions(${MODULE_NAME} PRIVATE -DFREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR)
|
||||
endif()
|
||||
|
||||
add_definitions(${LIBFREERDP_DEFINITIONS})
|
||||
|
||||
if (LIBFREERDP_COMPILE_OPTIONS)
|
||||
|
@ -45,8 +45,7 @@ set(APPLE_SRCS
|
||||
include(CMakeDependentOption)
|
||||
cmake_dependent_option(WITH_KEYBOARD_LAYOUT_FROM_FILE "Use keyboard definitions from JSON file" OFF WITH_WINPR_JSON OFF)
|
||||
if (WITH_KEYBOARD_LAYOUT_FROM_FILE)
|
||||
set(FREERDP_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR}/${PRODUCT})
|
||||
freerdp_definition_add(-DFREERDP_RESOURCE_ROOT="${FREERDP_RESOURCE_ROOT}")
|
||||
freerdp_definition_add(-DFREERDP_RESOURCE_ROOT="${FREERDP_RESOURCE_ROOT}")
|
||||
freerdp_definition_add(-DWITH_KEYBOARD_LAYOUT_FROM_FILE)
|
||||
|
||||
install(FILES KeyboardLayoutMap.json DESTINATION ${FREERDP_RESOURCE_ROOT})
|
||||
|
@ -21,17 +21,30 @@
|
||||
#include <freerdp/utils/helpers.h>
|
||||
|
||||
#include <winpr/path.h>
|
||||
#include <freerdp/version.h>
|
||||
#include <freerdp/build-config.h>
|
||||
|
||||
#define STR(x) #x
|
||||
|
||||
char* freerdp_GetConfigFilePath(BOOL system, const char* filename)
|
||||
{
|
||||
eKnownPathTypes id = system ? KNOWN_PATH_SYSTEM_CONFIG_HOME : KNOWN_PATH_XDG_CONFIG_HOME;
|
||||
|
||||
#if defined(FREERDP_USE_VENDOR_PRODUCT_CONFIG_DIR)
|
||||
char* vendor = GetKnownSubPath(id, FREERDP_VENDOR_STRING);
|
||||
#else
|
||||
char* vendor = GetKnownPath(id);
|
||||
#endif
|
||||
if (!vendor)
|
||||
return NULL;
|
||||
|
||||
char* base = GetCombinedPath(vendor, FREERDP_PRODUCT_STRING);
|
||||
#if defined(WITH_RESOURCE_VERSIONING)
|
||||
char* verstr = FREERDP_PRODUCT_STRING STR(FREERDP_VERSION_MAJOR);
|
||||
#else
|
||||
char* verstr = FREERDP_PRODUCT_STRING;
|
||||
#endif
|
||||
|
||||
char* base = GetCombinedPath(vendor, verstr);
|
||||
free(vendor);
|
||||
|
||||
if (!base)
|
||||
|
@ -32,11 +32,17 @@ if (CHANNEL_AINPUT_SERVER)
|
||||
list(APPEND SRCS sf_ainput.c sf_ainput.h)
|
||||
endif()
|
||||
|
||||
if (WITH_BINARY_VERSIONING)
|
||||
set(SAMPLE_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR}/FreeRDP${FREERDP_VERSION_MAJOR}/images)
|
||||
else()
|
||||
set(SAMPLE_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR}/FreeRDP/images)
|
||||
option(SAMPLE_USE_VENDOR_PRODUCT_CONFIG_DIR "Use <vendor>/<product> path for resources" OFF)
|
||||
set(SAMPLE_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR})
|
||||
if (SAMPLE_USE_VENDOR_PRODUCT_CONFIG_DIR)
|
||||
string(APPEND SAMPLE_RESOURCE_ROOT "/${VENDOR}")
|
||||
endif()
|
||||
string(APPEND SAMPLE_RESOURCE_ROOT "/${PRODUCT}")
|
||||
|
||||
if (WITH_RESOURCE_VERSIONING)
|
||||
string(APPEND SAMPLE_RESOURCE_ROOT "${FREERDP_VERSION_MAJOR}")
|
||||
endif()
|
||||
string(APPEND SAMPLE_RESOURCE_ROOT "/images")
|
||||
|
||||
set(SAMPLE_ICONS
|
||||
test_icon.bmp
|
||||
|
@ -87,6 +87,8 @@ option(WITH_INTERNAL_RC4 "Use compiled in rc4 functions instead of OpenSSL/MBedT
|
||||
option(WITH_INTERNAL_MD4 "Use compiled in md4 hash functions instead of OpenSSL/MBedTLS" ${WITH_INTERNAL_MD4_DEFAULT})
|
||||
option(WITH_INTERNAL_MD5 "Use compiled in md5 hash functions instead of OpenSSL/MBedTLS" ${WITH_INTERNAL_MD5_DEFAULT})
|
||||
option(WITH_UNICODE_BUILTIN "Use built-in Unicode conversion (don't use system-provided libraries)" OFF)
|
||||
option(WINPR_USE_LEGACY_RESOURCE_DIR "use a resource directory of <base>/WinPR instead of <base>/<product>" ON)
|
||||
option(WINPR_USE_VENDOR_PRODUCT_CONFIG_DIR "use a configuration <base>/<product>/<vendor>/ subdirectory instead of </base>/winpr" OFF)
|
||||
|
||||
# This option MUST be off to avoid symbol conflicts when loading an external SSPI module library
|
||||
option(SSPI_DLL "Define and export SSPI API symbols for usage as a Windows SSPI DLL replacement" OFF)
|
||||
@ -158,6 +160,24 @@ else()
|
||||
set(WINPR_VERSION_FULL "${WINPR_VERSION}")
|
||||
endif()
|
||||
|
||||
set(WINPR_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR})
|
||||
|
||||
# Quite the compatiblity show here (newest to oldest):
|
||||
# * <base>[/<vendor>]/<product>[<version>]
|
||||
# * <base>[/<vendor>]/WinPR[<version>]
|
||||
# * <base>/winpr
|
||||
if (WINPR_USE_LEGACY_RESOURCE_DIR)
|
||||
string(APPEND WINPR_RESOURCE_ROOT "/WinPR")
|
||||
else()
|
||||
if (WINPR_USE_VENDOR_PRODUCT_CONFIG_DIR)
|
||||
string(APPEND WINPR_RESOURCE_ROOT "/${VENDOR}/")
|
||||
endif()
|
||||
string(APPEND WINPR_RESOURCE_ROOT "/${PRODUCT}")
|
||||
if (WITH_RESOURCE_VERSIONING)
|
||||
string(APPEND WINPR_RESOURCE_ROOT "${WINPR_VERSION_MAJOR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CheckTypeSize)
|
||||
check_type_size(ssize_t SSIZE_T)
|
||||
set(WINPR_HAVE_SSIZE_T ${HAVE_SSIZE_T})
|
||||
|
@ -20,6 +20,4 @@
|
||||
|
||||
#define WINPR_PROXY_PLUGINDIR "${WINPR_PROXY_PLUGINDIR}"
|
||||
|
||||
#cmakedefine WINPR_USE_VENDOR_PRODUCT_CONFIG_DIR
|
||||
|
||||
#endif /* WINPR_BUILD_CONFIG_H */
|
||||
|
@ -167,6 +167,13 @@ list(REMOVE_DUPLICATES WINPR_INCLUDES)
|
||||
|
||||
AddTargetWithResourceFile(${MODULE_NAME} FALSE "${WINPR_VERSION}" WINPR_SRCS)
|
||||
|
||||
if (WITH_RESOURCE_VERSIONING)
|
||||
target_compile_definitions(${MODULE_NAME} PRIVATE -DWITH_RESOURCE_VERSIONING)
|
||||
endif()
|
||||
if (WINPR_USE_VENDOR_PRODUCT_CONFIG_DIR)
|
||||
target_compile_definitions(${MODULE_NAME} PRIVATE -DWINPR_USE_VENDOR_PRODUCT_CONFIG_DIR)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION FALSE)
|
||||
endif()
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
winpr_module_add(path.c shell.c)
|
||||
|
||||
option(WINPR_USE_VENDOR_PRODUCT_CONFIG_DIR "use a configuration <base>/<product>/<vendor>/ subdirectory instead of </base>/winpr" OFF)
|
||||
|
||||
if (MSVC OR MINGW)
|
||||
winpr_library_add_public(shlwapi)
|
||||
endif()
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <winpr/config.h>
|
||||
#include <winpr/version.h>
|
||||
#include <winpr/build-config.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
@ -26,6 +27,8 @@
|
||||
#include <winpr/path.h>
|
||||
#include <winpr/file.h>
|
||||
|
||||
#define STR(x) #x
|
||||
|
||||
#define PATH_SLASH_CHR '/'
|
||||
#define PATH_SLASH_STR "/"
|
||||
|
||||
@ -1190,7 +1193,12 @@ char* winpr_GetConfigFilePath(BOOL system, const char* filename)
|
||||
char* vendor = GetKnownSubPath(id, WINPR_VENDOR_STRING);
|
||||
if (!vendor)
|
||||
return NULL;
|
||||
char* base = GetCombinedPath(vendor, WINPR_PRODUCT_STRING);
|
||||
#if defined(WITH_RESOURCE_VERSIONING)
|
||||
const char* prod = WINPR_PRODUCT_STRING STR(WINPR_VERSION_MAJOR);
|
||||
#else
|
||||
const char* prod = WINPR_PRODUCT_STRING;
|
||||
#endif
|
||||
char* base = GetCombinedPath(vendor, prod);
|
||||
free(vendor);
|
||||
#else
|
||||
char* base = GetKnownSubPath(id, "winpr");
|
||||
|
@ -23,7 +23,7 @@ endif()
|
||||
include(CMakeDependentOption)
|
||||
cmake_dependent_option(WITH_TIMEZONE_FROM_FILE "Use timezone definitions from JSON file" OFF WITH_WINPR_JSON OFF)
|
||||
if (WITH_TIMEZONE_FROM_FILE)
|
||||
set(WINPR_RESOURCE_ROOT ${CMAKE_INSTALL_FULL_DATAROOTDIR}/WinPR)
|
||||
|
||||
winpr_definition_add(-DWINPR_RESOURCE_ROOT="${WINPR_RESOURCE_ROOT}")
|
||||
winpr_definition_add(-DWITH_TIMEZONE_FROM_FILE)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user