diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index ca749c0cc..d4c4944e4 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -2,8 +2,6 @@ # Generate .txt license file for CPack (PackageMaker requires a file extension) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt @ONLY) -SET(CPACK_BINARY_ZIP "ON") - # Workaround to remove c++ compiler macros and defines for Eclipse. # If c++ macros/defines are set __cplusplus is also set which causes # problems when compiling freerdp/jni. To prevent this problem we set the macros to "". diff --git a/CMakeLists.txt b/CMakeLists.txt index c6f3010cc..bd368c431 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ cmake_minimum_required(VERSION 3.4) -project(FreeRDP C CXX) +project(FreeRDP C) if(NOT DEFINED VENDOR) set(VENDOR "FreeRDP" CACHE STRING "FreeRDP package vendor") @@ -67,7 +67,6 @@ include(ConfigOptions) include(ComplexLibrary) include(FeatureSummary) include(CheckCCompilerFlag) -include(CheckCXXCompilerFlag) include(GNUInstallDirsWrapper) include(CMakePackageConfigHelpers) include(InstallFreeRDPMan) @@ -130,17 +129,9 @@ endif(CMAKE_CROSSCOMPILING) find_program(CCACHE ccache) if(CCACHE AND WITH_CCACHE) - if(CMAKE_VERSION VERSION_GREATER 3.3.2) - if(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER) - SET(CMAKE_C_COMPILER_LAUNCHER ${CCACHE}) - endif(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER) - if(NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER) - SET(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE}) - endif(NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER) - else() - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE}) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE}) - endif() + if(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER) + SET(CMAKE_C_COMPILER_LAUNCHER ${CCACHE}) + endif(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER) endif(CCACHE AND WITH_CCACHE) if(EXISTS "${CMAKE_SOURCE_DIR}/.source_version" ) @@ -170,13 +161,12 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() -if(NOT DEFINED BUILD_SHARED_LIBS) - if(IOS) - set(BUILD_SHARED_LIBS OFF) - else() - set(BUILD_SHARED_LIBS ON) - endif() +set(LIB_DEFAULT ON) +if (IOS) + set(LIB_DEFAULT OFF) endif() +option(BUILD_SHARED_LIBS "Build shared libraries" ${LIB_DEFAULT}) +option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) if(BUILD_TESTING) set(EXPORT_ALL_SYMBOLS TRUE) @@ -254,12 +244,6 @@ if(CMAKE_COMPILER_IS_GNUCC) else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686") endif() - else() - if(CMAKE_POSITION_INDEPENDENT_CODE) - if(${CMAKE_VERSION} VERSION_LESS 2.8.9) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") - endif() - endif() endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") @@ -276,10 +260,6 @@ if(CMAKE_COMPILER_IS_GNUCC) if(Wno-deprecated-declarations) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") endif() - CHECK_CXX_COMPILER_FLAG(-Wno-deprecated-declarations Wno-deprecated-declarationsCXX) - if(Wno-deprecated-declarationsCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") - endif() if(NOT EXPORT_ALL_SYMBOLS) message(STATUS "GCC default symbol visibility: hidden") @@ -306,7 +286,6 @@ if(CMAKE_COMPILER_IS_GNUCC) add_definitions(-DNDEBUG) else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") endif() endif() @@ -319,11 +298,6 @@ if (CMAKE_GENERATOR MATCHES "Unix Makefile*") if(Wno-builtin-macro-redefined) set(CMAKE_C_FLAGS_${UPPER_BUILD_TYPE} "${CMAKE_C_FLAGS_${UPPER_BUILD_TYPE}} -Wno-builtin-macro-redefined -D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'") endif() - - CHECK_CXX_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefinedCXX) - if(Wno-builtin-macro-redefinedCXX) - set(CMAKE_CXX_FLAGS_${UPPER_BUILD_TYPE} "${CMAKE_CXX_FLAGS_${UPPER_BUILD_TYPE}} -Wno-builtin-macro-redefined -D__FILE__='\"$(subst ${CMAKE_BINARY_DIR}/,,$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<)))\"'") - endif() endif() endif() @@ -336,10 +310,6 @@ if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang") if(Wno-deprecated-declarations) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") endif() - CHECK_CXX_COMPILER_FLAG(-Wno-deprecated-declarations Wno-deprecated-declarationsCXX) - if(Wno-deprecated-declarationsCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") - endif() endif() set(THREAD_PREFER_PTHREAD_FLAG TRUE) @@ -440,10 +410,6 @@ if(MSVC) # NMake is otherwise complaining. foreach (flags_var_to_scrub CMAKE_C_FLAGS - CMAKE_CXX_FLAGS - CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_MINSIZEREL) @@ -460,7 +426,6 @@ if(MSVC) if(CMAKE_BUILD_TYPE STREQUAL "Release") else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi") endif() endif() @@ -468,9 +433,7 @@ endif() if(ANDROID) # workaround for https://github.com/android-ndk/ndk/issues/243 string(REPLACE "-g " "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) - string(REPLACE "-g " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g") endif() if(WIN32) @@ -515,7 +478,7 @@ if(WIN32) endif() endif() -add_definitions(-DWINPR_EXPORTS -DFREERDP_EXPORTS) +add_definitions(-DFREERDP_EXPORTS) # Include files if(NOT IOS) @@ -564,7 +527,6 @@ if(APPLE) if (WITH_VERBOSE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -v") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v") endif() endif(APPLE) @@ -1017,23 +979,22 @@ if(BUILD_TESTING) endif() # WinPR -include_directories("${CMAKE_SOURCE_DIR}/winpr/include") -include_directories("${CMAKE_BINARY_DIR}/winpr/include") +if (FREERDP_UNIFIED_BUILD) + add_subdirectory(winpr) + if (WITH_WAYLAND) + add_subdirectory(uwac) + endif() + if (WITH_SERVER) + add_subdirectory(rdtk) + endif() -if (${CMAKE_VERSION} VERSION_LESS 2.8.12) - set(PUBLIC_KEYWORD "") - set(PRIVATE_KEYWORD "") + include_directories(${CMAKE_SOURCE_DIR}/winpr/include) + include_directories(${CMAKE_BINARY_DIR}/winpr/include) else() - set(PUBLIC_KEYWORD "PUBLIC") - set(PRIVATE_KEYWORD "PRIVATE") + find_package(WinPR 3 REQUIRED) + include_directories(${WinPR_INCLUDE_DIR}) endif() -if(BUILD_SHARED_LIBS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_DLL") -endif() - -add_subdirectory(winpr) - # Sub-directories if(WITH_THIRD_PARTY) @@ -1047,16 +1008,6 @@ add_subdirectory(include) add_subdirectory(libfreerdp) -# RdTk -include_directories("${CMAKE_SOURCE_DIR}/rdtk/include") -include_directories("${CMAKE_BINARY_DIR}/rdtk/include") - -add_subdirectory(rdtk) - -if(WAYLAND_FOUND) - add_subdirectory(uwac) -endif() - if(BSD) if(IS_DIRECTORY /usr/local/include) include_directories(/usr/local/include) diff --git a/channels/CMakeLists.txt b/channels/CMakeLists.txt index 882fef72c..17715a3dc 100644 --- a/channels/CMakeLists.txt +++ b/channels/CMakeLists.txt @@ -7,7 +7,7 @@ # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -21,157 +21,157 @@ include(CMakeParseArguments) include(CMakeDependentOption) macro(define_channel_options) - set(PREFIX "CHANNEL") + set(PREFIX "CHANNEL") - cmake_parse_arguments(${PREFIX} - "" - "NAME;TYPE;DESCRIPTION;SPECIFICATIONS;DEFAULT" - "" - ${ARGN}) + cmake_parse_arguments(${PREFIX} + "" + "NAME;TYPE;DESCRIPTION;SPECIFICATIONS;DEFAULT" + "" + ${ARGN}) - string(TOUPPER "CHANNEL_${CHANNEL_NAME}" CHANNEL_OPTION) - string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" CHANNEL_CLIENT_OPTION) - string(TOUPPER "CHANNEL_${CHANNEL_NAME}_SERVER" CHANNEL_SERVER_OPTION) - string(TOUPPER "${CHANNEL_TYPE}" CHANNEL_TYPE) + string(TOUPPER "CHANNEL_${CHANNEL_NAME}" CHANNEL_OPTION) + string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" CHANNEL_CLIENT_OPTION) + string(TOUPPER "CHANNEL_${CHANNEL_NAME}_SERVER" CHANNEL_SERVER_OPTION) + string(TOUPPER "${CHANNEL_TYPE}" CHANNEL_TYPE) - if(${${CHANNEL_CLIENT_OPTION}}) - set(OPTION_CLIENT_DEFAULT ${${CHANNEL_CLIENT_OPTION}}) - endif() - - if(${${CHANNEL_SERVER_OPTION}}) - set(OPTION_SERVER_DEFAULT ${${CHANNEL_SERVER_OPTION}}) - endif() - - if(${${CHANNEL_OPTION}}) - set(OPTION_DEFAULT ${${CHANNEL_OPTION}}) - endif() - - if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT}) - set(OPTION_DEFAULT "ON") - endif() - - set(CHANNEL_DEFAULT ${OPTION_DEFAULT}) - - set(CHANNEL_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel") + if(${${CHANNEL_CLIENT_OPTION}}) + set(OPTION_CLIENT_DEFAULT ${${CHANNEL_CLIENT_OPTION}}) + endif() - if ("${CHANNEL_TYPE}" STREQUAL "DYNAMIC") - CMAKE_DEPENDENT_OPTION(${CHANNEL_OPTION} "${CHANNEL_OPTION_DOC}" ${CHANNEL_DEFAULT} "CHANNEL_DRDYNVC" OFF) - else() - option(${CHANNEL_OPTION} "${CHANNEL_OPTION_DOC}" ${CHANNEL_DEFAULT}) - endif() + if(${${CHANNEL_SERVER_OPTION}}) + set(OPTION_SERVER_DEFAULT ${${CHANNEL_SERVER_OPTION}}) + endif() + + if(${${CHANNEL_OPTION}}) + set(OPTION_DEFAULT ${${CHANNEL_OPTION}}) + endif() + + if(${OPTION_CLIENT_DEFAULT} OR ${OPTION_SERVER_DEFAULT}) + set(OPTION_DEFAULT "ON") + endif() + + set(CHANNEL_DEFAULT ${OPTION_DEFAULT}) + + set(CHANNEL_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel") + + if ("${CHANNEL_TYPE}" STREQUAL "DYNAMIC") + CMAKE_DEPENDENT_OPTION(${CHANNEL_OPTION} "${CHANNEL_OPTION_DOC}" ${CHANNEL_DEFAULT} "CHANNEL_DRDYNVC" OFF) + else() + option(${CHANNEL_OPTION} "${CHANNEL_OPTION_DOC}" ${CHANNEL_DEFAULT}) + endif() endmacro(define_channel_options) macro(define_channel_client_options _channel_client_default) - string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" CHANNEL_CLIENT_OPTION) - string(TOUPPER "CHANNEL_${CHANNEL_NAME}" CHANNEL_OPTION) - set(CHANNEL_CLIENT_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel client") + string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" CHANNEL_CLIENT_OPTION) + string(TOUPPER "CHANNEL_${CHANNEL_NAME}" CHANNEL_OPTION) + set(CHANNEL_CLIENT_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel client") - CMAKE_DEPENDENT_OPTION(${CHANNEL_CLIENT_OPTION} "${CHANNEL_CLIENT_OPTION_DOC}" - ${_channel_client_default} "${CHANNEL_OPTION}" OFF) + CMAKE_DEPENDENT_OPTION(${CHANNEL_CLIENT_OPTION} "${CHANNEL_CLIENT_OPTION_DOC}" + ${_channel_client_default} "${CHANNEL_OPTION}" OFF) endmacro(define_channel_client_options) macro(define_channel_server_options _channel_server_default) - string(TOUPPER "CHANNEL_${CHANNEL_NAME}_SERVER" CHANNEL_SERVER_OPTION) - string(TOUPPER "CHANNEL_${CHANNEL_NAME}" CHANNEL_OPTION) - set(CHANNEL_SERVER_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel server") + string(TOUPPER "CHANNEL_${CHANNEL_NAME}_SERVER" CHANNEL_SERVER_OPTION) + string(TOUPPER "CHANNEL_${CHANNEL_NAME}" CHANNEL_OPTION) + set(CHANNEL_SERVER_OPTION_DOC "Build ${CHANNEL_NAME} ${CHANNEL_TYPE} channel server") - CMAKE_DEPENDENT_OPTION(${CHANNEL_SERVER_OPTION} "${CHANNEL_SERVER_OPTION_DOC}" - ${_channel_server_default} "${CHANNEL_OPTION}" OFF) + CMAKE_DEPENDENT_OPTION(${CHANNEL_SERVER_OPTION} "${CHANNEL_SERVER_OPTION_DOC}" + ${_channel_server_default} "${CHANNEL_OPTION}" OFF) endmacro(define_channel_server_options) macro(define_channel _channel_name) - set(CHANNEL_NAME ${_channel_name}) - set(MODULE_NAME ${CHANNEL_NAME}) - string(TOUPPER "CHANNEL_${CHANNEL_NAME}" MODULE_PREFIX) + set(CHANNEL_NAME ${_channel_name}) + set(MODULE_NAME ${CHANNEL_NAME}) + string(TOUPPER "CHANNEL_${CHANNEL_NAME}" MODULE_PREFIX) endmacro(define_channel) macro(define_channel_client _channel_name) - set(CHANNEL_NAME ${_channel_name}) - set(MODULE_NAME "${CHANNEL_NAME}-client") - string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" MODULE_PREFIX) + set(CHANNEL_NAME ${_channel_name}) + set(MODULE_NAME "${CHANNEL_NAME}-client") + string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" MODULE_PREFIX) endmacro(define_channel_client) macro(define_channel_server _channel_name) - set(CHANNEL_NAME ${_channel_name}) - set(MODULE_NAME "${CHANNEL_NAME}-server") - string(TOUPPER "CHANNEL_${CHANNEL_NAME}_SERVER" MODULE_PREFIX) + set(CHANNEL_NAME ${_channel_name}) + set(MODULE_NAME "${CHANNEL_NAME}-server") + string(TOUPPER "CHANNEL_${CHANNEL_NAME}_SERVER" MODULE_PREFIX) endmacro(define_channel_server) macro(define_channel_client_subsystem _channel_name _subsystem _type) - set(CHANNEL_NAME ${_channel_name}) - set(CHANNEL_SUBSYSTEM ${_subsystem}) - string(LENGTH "${_type}" _type_length) - string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" CHANNEL_PREFIX) - if(_type_length GREATER 0) - set(SUBSYSTEM_TYPE ${_type}) - set(MODULE_NAME "${CHANNEL_NAME}-client-${CHANNEL_SUBSYSTEM}-${SUBSYSTEM_TYPE}") - string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT_${CHANNEL_SUBSYSTEM}_${SUBSYSTEM_TYPE}" MODULE_PREFIX) - else() - set(MODULE_NAME "${CHANNEL_NAME}-client-${CHANNEL_SUBSYSTEM}") - string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT_${CHANNEL_SUBSYSTEM}" MODULE_PREFIX) - endif() + set(CHANNEL_NAME ${_channel_name}) + set(CHANNEL_SUBSYSTEM ${_subsystem}) + string(LENGTH "${_type}" _type_length) + string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT" CHANNEL_PREFIX) + if(_type_length GREATER 0) + set(SUBSYSTEM_TYPE ${_type}) + set(MODULE_NAME "${CHANNEL_NAME}-client-${CHANNEL_SUBSYSTEM}-${SUBSYSTEM_TYPE}") + string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT_${CHANNEL_SUBSYSTEM}_${SUBSYSTEM_TYPE}" MODULE_PREFIX) + else() + set(MODULE_NAME "${CHANNEL_NAME}-client-${CHANNEL_SUBSYSTEM}") + string(TOUPPER "CHANNEL_${CHANNEL_NAME}_CLIENT_${CHANNEL_SUBSYSTEM}" MODULE_PREFIX) + endif() endmacro(define_channel_client_subsystem) macro(define_channel_server_subsystem _channel_name _subsystem _type) - set(CHANNEL_NAME ${_channel_name}) - set(CHANNEL_SUBSYSTEM ${_subsystem}) - set(MODULE_NAME "${CHANNEL_NAME}-server-${CHANNEL_SUBSYSTEM}") - string(TOUPPER "CHANNEL_${CHANNEL_NAME}_server_${CHANNEL_SUBSYSTEM}" MODULE_PREFIX) + set(CHANNEL_NAME ${_channel_name}) + set(CHANNEL_SUBSYSTEM ${_subsystem}) + set(MODULE_NAME "${CHANNEL_NAME}-server-${CHANNEL_SUBSYSTEM}") + string(TOUPPER "CHANNEL_${CHANNEL_NAME}_server_${CHANNEL_SUBSYSTEM}" MODULE_PREFIX) endmacro(define_channel_server_subsystem) macro(add_channel_client _channel_prefix _channel_name) - add_subdirectory(client) - if(${${_channel_prefix}_CLIENT_STATIC}) - set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${_channel_prefix} PARENT_SCOPE) - set(${_channel_prefix}_CLIENT_NAME ${${_channel_prefix}_CLIENT_NAME} PARENT_SCOPE) - set(${_channel_prefix}_CLIENT_CHANNEL ${${_channel_prefix}_CLIENT_CHANNEL} PARENT_SCOPE) - set(${_channel_prefix}_CLIENT_ENTRY ${${_channel_prefix}_CLIENT_ENTRY} PARENT_SCOPE) - set(CHANNEL_STATIC_CLIENT_ENTRIES ${CHANNEL_STATIC_CLIENT_ENTRIES} ${${_channel_prefix}_CLIENT_ENTRY} PARENT_SCOPE) - endif() + add_subdirectory(client) + if(${${_channel_prefix}_CLIENT_STATIC}) + set(CHANNEL_STATIC_CLIENT_MODULES ${CHANNEL_STATIC_CLIENT_MODULES} ${_channel_prefix} PARENT_SCOPE) + set(${_channel_prefix}_CLIENT_NAME ${${_channel_prefix}_CLIENT_NAME} PARENT_SCOPE) + set(${_channel_prefix}_CLIENT_CHANNEL ${${_channel_prefix}_CLIENT_CHANNEL} PARENT_SCOPE) + set(${_channel_prefix}_CLIENT_ENTRY ${${_channel_prefix}_CLIENT_ENTRY} PARENT_SCOPE) + set(CHANNEL_STATIC_CLIENT_ENTRIES ${CHANNEL_STATIC_CLIENT_ENTRIES} ${${_channel_prefix}_CLIENT_ENTRY} PARENT_SCOPE) + endif() endmacro(add_channel_client) macro(add_channel_server _channel_prefix _channel_name) - add_subdirectory(server) - if(${${_channel_prefix}_SERVER_STATIC}) - set(CHANNEL_STATIC_SERVER_MODULES ${CHANNEL_STATIC_SERVER_MODULES} ${_channel_prefix} PARENT_SCOPE) - set(${_channel_prefix}_SERVER_NAME ${${_channel_prefix}_SERVER_NAME} PARENT_SCOPE) - set(${_channel_prefix}_SERVER_CHANNEL ${${_channel_prefix}_SERVER_CHANNEL} PARENT_SCOPE) - set(${_channel_prefix}_SERVER_ENTRY ${${_channel_prefix}_SERVER_ENTRY} PARENT_SCOPE) - set(CHANNEL_STATIC_SERVER_ENTRIES ${CHANNEL_STATIC_SERVER_ENTRIES} ${${_channel_prefix}_SERVER_ENTRY} PARENT_SCOPE) - endif() + add_subdirectory(server) + if(${${_channel_prefix}_SERVER_STATIC}) + set(CHANNEL_STATIC_SERVER_MODULES ${CHANNEL_STATIC_SERVER_MODULES} ${_channel_prefix} PARENT_SCOPE) + set(${_channel_prefix}_SERVER_NAME ${${_channel_prefix}_SERVER_NAME} PARENT_SCOPE) + set(${_channel_prefix}_SERVER_CHANNEL ${${_channel_prefix}_SERVER_CHANNEL} PARENT_SCOPE) + set(${_channel_prefix}_SERVER_ENTRY ${${_channel_prefix}_SERVER_ENTRY} PARENT_SCOPE) + set(CHANNEL_STATIC_SERVER_ENTRIES ${CHANNEL_STATIC_SERVER_ENTRIES} ${${_channel_prefix}_SERVER_ENTRY} PARENT_SCOPE) + endif() endmacro(add_channel_server) macro(add_channel_client_subsystem _channel_prefix _channel_name _subsystem _type) - add_subdirectory(${_subsystem}) - set(_channel_module_name "${_channel_name}-client") - string(LENGTH "${_type}" _type_length) - if(_type_length GREATER 0) - string(TOUPPER "CHANNEL_${_channel_name}_CLIENT_${_subsystem}_${_type}" _subsystem_prefix) - else() - string(TOUPPER "CHANNEL_${_channel_name}_CLIENT_${_subsystem}" _subsystem_prefix) - endif() - if(${${_subsystem_prefix}_STATIC}) - get_target_property(CHANNEL_SUBSYSTEMS ${_channel_module_name} SUBSYSTEMS) - if(_type_length GREATER 0) - set(SUBSYSTEMS ${SUBSYSTEMS} "${_subsystem}-${_type}") - else() - set(SUBSYSTEMS ${SUBSYSTEMS} ${_subsystem}) - endif() - set_target_properties(${_channel_module_name} PROPERTIES SUBSYSTEMS "${SUBSYSTEMS}") - endif() + add_subdirectory(${_subsystem}) + set(_channel_module_name "${_channel_name}-client") + string(LENGTH "${_type}" _type_length) + if(_type_length GREATER 0) + string(TOUPPER "CHANNEL_${_channel_name}_CLIENT_${_subsystem}_${_type}" _subsystem_prefix) + else() + string(TOUPPER "CHANNEL_${_channel_name}_CLIENT_${_subsystem}" _subsystem_prefix) + endif() + if(${${_subsystem_prefix}_STATIC}) + get_target_property(CHANNEL_SUBSYSTEMS ${_channel_module_name} SUBSYSTEMS) + if(_type_length GREATER 0) + set(SUBSYSTEMS ${SUBSYSTEMS} "${_subsystem}-${_type}") + else() + set(SUBSYSTEMS ${SUBSYSTEMS} ${_subsystem}) + endif() + set_target_properties(${_channel_module_name} PROPERTIES SUBSYSTEMS "${SUBSYSTEMS}") + endif() endmacro(add_channel_client_subsystem) macro(channel_install _targets _destination _export_target) - install(TARGETS ${_targets} DESTINATION ${_destination} EXPORT ${_export_target}) + install(TARGETS ${_targets} DESTINATION ${_destination} EXPORT ${_export_target}) endmacro(channel_install) macro(server_channel_install _targets _destination) - channel_install(${_targets} ${_destination} "FreeRDP-ServerTargets") + channel_install(${_targets} ${_destination} "FreeRDP-ServerTargets") endmacro(server_channel_install) macro(client_channel_install _targets _destination) - channel_install(${_targets} ${_destination} "FreeRDP-ClientTargets") + channel_install(${_targets} ${_destination} "FreeRDP-ClientTargets") endmacro(client_channel_install) macro(add_channel_client_library _module_prefix _module_name _channel_name _dynamic _entry) @@ -181,8 +181,8 @@ macro(add_channel_client_library _module_prefix _module_name _channel_name _dyna endif() if(${_dynamic} AND (NOT BUILTIN_CHANNELS)) -# On windows create dll version information. -# Vendor, product and year are already set in top level CMakeLists.txt + # On windows create dll version information. + # Vendor, product and year are already set in top level CMakeLists.txt if (WIN32) set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR}) @@ -191,9 +191,9 @@ macro(add_channel_client_library _module_prefix _module_name _channel_name _dyna set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${_module_name}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) configure_file( - ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in - ${CMAKE_CURRENT_BINARY_DIR}/version.rc - @ONLY) + ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in + ${CMAKE_CURRENT_BINARY_DIR}/version.rc + @ONLY) set ( ${_module_prefix}_SRCS ${${_module_prefix}_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) endif() @@ -209,7 +209,7 @@ macro(add_channel_client_library _module_prefix _module_name _channel_name _dyna add_library(${_module_name} STATIC ${${_module_prefix}_SRCS}) target_link_libraries(${_module_name} ${${_module_prefix}_LIBS}) - if (${CMAKE_VERSION} VERSION_LESS 2.8.12 OR NOT BUILD_SHARED_LIBS) + if (NOT BUILTIN_CHANNELS) client_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) endif() endif() @@ -222,8 +222,8 @@ macro(add_channel_client_subsystem_library _module_prefix _module_name _channel_ endif() if(${_dynamic} AND (NOT BUILTIN_CHANNELS)) -# On windows create dll version information. -# Vendor, product and year are already set in top level CMakeLists.txt + # On windows create dll version information. + # Vendor, product and year are already set in top level CMakeLists.txt if (WIN32) set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR}) @@ -232,9 +232,9 @@ macro(add_channel_client_subsystem_library _module_prefix _module_name _channel_ set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${_module_name}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) configure_file( - ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in - ${CMAKE_CURRENT_BINARY_DIR}/version.rc - @ONLY) + ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in + ${CMAKE_CURRENT_BINARY_DIR}/version.rc + @ONLY) set ( ${_module_prefix}_SRCS ${${_module_prefix}_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) endif() @@ -249,7 +249,7 @@ macro(add_channel_client_subsystem_library _module_prefix _module_name _channel_ add_library(${_module_name} STATIC ${${_module_prefix}_SRCS}) target_link_libraries(${_module_name} ${${_module_prefix}_LIBS}) - if (${CMAKE_VERSION} VERSION_LESS 2.8.12 OR NOT BUILD_SHARED_LIBS) + if (NOT BUILTIN_CHANNELS) client_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) endif() endif() @@ -262,34 +262,34 @@ macro(add_channel_server_library _module_prefix _module_name _channel_name _dyna endif() if(${_dynamic} AND (NOT BUILTIN_CHANNELS)) -# On windows create dll version information. -# Vendor, product and year are already set in top level CMakeLists.txt + # On windows create dll version information. + # Vendor, product and year are already set in top level CMakeLists.txt if (WIN32) set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR}) set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION}) - set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${_module_name}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${_module_name}${FREERDP_VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) configure_file( - ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in - ${CMAKE_CURRENT_BINARY_DIR}/version.rc - @ONLY) + ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in + ${CMAKE_CURRENT_BINARY_DIR}/version.rc + @ONLY) set ( ${_module_prefix}_SRCS ${${_module_prefix}_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) endif() - add_library(${_module_name} ${${_module_prefix}_SRCS}) - server_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) - else() - set(${_module_prefix}_STATIC ON PARENT_SCOPE) - set(${_module_prefix}_NAME ${_module_name} PARENT_SCOPE) - set(${_module_prefix}_CHANNEL ${_channel_name} PARENT_SCOPE) - set(${_module_prefix}_ENTRY ${_entry} PARENT_SCOPE) - add_library(${_module_name} STATIC ${${_module_prefix}_SRCS}) - if (${CMAKE_VERSION} VERSION_LESS 2.8.12 OR NOT BUILD_SHARED_LIBS) - server_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) - endif() - endif() + add_library(${_module_name} ${${_module_prefix}_SRCS}) + server_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) + else() + set(${_module_prefix}_STATIC ON PARENT_SCOPE) + set(${_module_prefix}_NAME ${_module_name} PARENT_SCOPE) + set(${_module_prefix}_CHANNEL ${_channel_name} PARENT_SCOPE) + set(${_module_prefix}_ENTRY ${_entry} PARENT_SCOPE) + add_library(${_module_name} STATIC ${${_module_prefix}_SRCS}) + if (NOT BUILTIN_CHANNELS) + server_channel_install(${_module_name} ${FREERDP_ADDIN_PATH}) + endif() + endif() endmacro(add_channel_server_library) set(FILENAME "ChannelOptions.cmake") @@ -301,46 +301,46 @@ file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}") set(DRDYNVC_MATCH "") foreach(FILEPATH ${FILEPATHS}) - if(${FILEPATH} MATCHES "^([^/]*)drdynvc/+${FILENAME}") - set(DRDYNVC_MATCH ${FILEPATH}) - endif() + if(${FILEPATH} MATCHES "^([^/]*)drdynvc/+${FILENAME}") + set(DRDYNVC_MATCH ${FILEPATH}) + endif() endforeach() if (NOT "${DRDYNVC_MATCH}" STREQUAL "") - list(REMOVE_ITEM FILEPATHS ${DRDYNVC_MATCH}) - list(APPEND FILEPATHS ${DRDYNVC_MATCH}) - list(REVERSE FILEPATHS) # list PREPEND is not available on old CMake3 + list(REMOVE_ITEM FILEPATHS ${DRDYNVC_MATCH}) + list(APPEND FILEPATHS ${DRDYNVC_MATCH}) + list(REVERSE FILEPATHS) # list PREPEND is not available on old CMake3 endif() foreach(FILEPATH ${FILEPATHS}) - if(${FILEPATH} MATCHES "^([^/]*)/+${FILENAME}") - string(REGEX REPLACE "^([^/]*)/+${FILENAME}" "\\1" DIR ${FILEPATH}) - set(CHANNEL_OPTION) - include(${FILEPATH}) - if(${CHANNEL_OPTION}) - set(CHANNEL_MESSAGE "Adding ${CHANNEL_TYPE} channel") - if(${CHANNEL_CLIENT_OPTION}) - set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE} client") - endif() - if(${CHANNEL_SERVER_OPTION}) - set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE} server") - endif() - set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE} \"${CHANNEL_NAME}\"") - set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE}: ${CHANNEL_DESCRIPTION}") - message(STATUS "${CHANNEL_MESSAGE}") - add_subdirectory(${DIR}) - endif() - endif() + if(${FILEPATH} MATCHES "^([^/]*)/+${FILENAME}") + string(REGEX REPLACE "^([^/]*)/+${FILENAME}" "\\1" DIR ${FILEPATH}) + set(CHANNEL_OPTION) + include(${FILEPATH}) + if(${CHANNEL_OPTION}) + set(CHANNEL_MESSAGE "Adding ${CHANNEL_TYPE} channel") + if(${CHANNEL_CLIENT_OPTION}) + set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE} client") + endif() + if(${CHANNEL_SERVER_OPTION}) + set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE} server") + endif() + set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE} \"${CHANNEL_NAME}\"") + set(CHANNEL_MESSAGE "${CHANNEL_MESSAGE}: ${CHANNEL_DESCRIPTION}") + message(STATUS "${CHANNEL_MESSAGE}") + add_subdirectory(${DIR}) + endif() + endif() endforeach(FILEPATH) if(WITH_CLIENT_CHANNELS) - add_subdirectory(client) - set(FREERDP_CHANNELS_CLIENT_SRCS ${FREERDP_CHANNELS_CLIENT_SRCS} PARENT_SCOPE) - set(FREERDP_CHANNELS_CLIENT_LIBS ${FREERDP_CHANNELS_CLIENT_LIBS} PARENT_SCOPE) + add_subdirectory(client) + set(FREERDP_CHANNELS_CLIENT_SRCS ${FREERDP_CHANNELS_CLIENT_SRCS} PARENT_SCOPE) + set(FREERDP_CHANNELS_CLIENT_LIBS ${FREERDP_CHANNELS_CLIENT_LIBS} PARENT_SCOPE) endif() if(WITH_SERVER_CHANNELS) - add_subdirectory(server) - set(FREERDP_CHANNELS_SERVER_SRCS ${FREERDP_CHANNELS_SERVER_SRCS} PARENT_SCOPE) - set(FREERDP_CHANNELS_SERVER_LIBS ${FREERDP_CHANNELS_SERVER_LIBS} PARENT_SCOPE) + add_subdirectory(server) + set(FREERDP_CHANNELS_SERVER_SRCS ${FREERDP_CHANNELS_SERVER_SRCS} PARENT_SCOPE) + set(FREERDP_CHANNELS_SERVER_LIBS ${FREERDP_CHANNELS_SERVER_LIBS} PARENT_SCOPE) endif() diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 7cba44e94..4288dad2d 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -81,22 +81,21 @@ endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-client.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-client${FREERDP_VERSION_MAJOR}.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-client${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -if(${CMAKE_VERSION} VERSION_GREATER "2.8.10") - export(PACKAGE freerdp-client) +export(PACKAGE freerdp-client) - SetFreeRDPCMakeInstallDir(FREERDP_CLIENT_CMAKE_INSTALL_DIR "FreeRDP-Client${FREERDP_VERSION_MAJOR}") +SetFreeRDPCMakeInstallDir(FREERDP_CLIENT_CMAKE_INSTALL_DIR "FreeRDP-Client${FREERDP_VERSION_MAJOR}") - configure_package_config_file(FreeRDP-ClientConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfig.cmake - INSTALL_DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR} - PATH_VARS FREERDP_INCLUDE_DIR) +configure_package_config_file(FreeRDP-ClientConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfig.cmake + INSTALL_DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR} + PATH_VARS FREERDP_INCLUDE_DIR) - write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfigVersion.cmake - VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) +write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfigVersion.cmake + VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfigVersion.cmake - DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ClientConfigVersion.cmake + DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR}) +if (NOT BUILTIN_CHANNELS) install(EXPORT FreeRDP-ClientTargets DESTINATION ${FREERDP_CLIENT_CMAKE_INSTALL_DIR}) - endif() diff --git a/client/Mac/CMakeLists.txt b/client/Mac/CMakeLists.txt index b3eb59187..381b4ba45 100644 --- a/client/Mac/CMakeLists.txt +++ b/client/Mac/CMakeLists.txt @@ -2,10 +2,8 @@ project(MacFreeRDP-library) -if(${CMAKE_VERSION} GREATER 2.8.12) - cmake_policy(SET CMP0026 OLD) - cmake_policy(SET CMP0045 OLD) -endif() +cmake_policy(SET CMP0026 OLD) +cmake_policy(SET CMP0045 OLD) set(MODULE_NAME "MacFreeRDP-library") set(MODULE_OUTPUT_NAME "MacFreeRDP") diff --git a/client/Wayland/CMakeLists.txt b/client/Wayland/CMakeLists.txt index a9e19e36e..f881fe9a8 100644 --- a/client/Wayland/CMakeLists.txt +++ b/client/Wayland/CMakeLists.txt @@ -20,7 +20,6 @@ set(MODULE_NAME "wlfreerdp") set(MODULE_PREFIX "FREERDP_CLIENT_WAYLAND") include_directories(${WAYLAND_INCLUDE_DIR}) -include_directories(${CMAKE_SOURCE_DIR}/uwac/include) set(${MODULE_PREFIX}_SRCS wlfreerdp.c @@ -37,6 +36,14 @@ set(${MODULE_PREFIX}_SRCS wlf_channels.h ) +if (FREERDP_UNIFIED_BUILD) + include_directories(${CMAKE_SOURCE_DIR}/uwac/include) + include_directories(${CMAKE_BINARY_DIR}/uwac/include) +else() + find_package(uwac 0 REQUIRED) + include_directories(${UWAC_INCLUDE_DIR}) +endif() + list (APPEND ${MODULE_PREFIX}_LIBS freerdp-client freerdp uwac) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) diff --git a/client/Windows/CMakeLists.txt b/client/Windows/CMakeLists.txt index 627457198..9cef17f60 100644 --- a/client/Windows/CMakeLists.txt +++ b/client/Windows/CMakeLists.txt @@ -45,7 +45,7 @@ if (WIN32 AND BUILD_SHARED_LIBS) set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR}) set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION}) if(WITH_CLIENT_INTERFACE) - set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${FREERDP_API_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) else() set (RC_VERSION_FILE "${MODULE_NAME}${CMAKE_EXECUTABLE_SUFFIX}" ) endif() @@ -60,6 +60,7 @@ endif() if(WITH_CLIENT_INTERFACE) + set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${FREERDP_API_VERSION}) if(CLIENT_INTERFACE_SHARED) add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS}) else() diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 2b5a6a0b1..774272d31 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -221,8 +221,8 @@ endif() if(WITH_XRANDR) add_definitions(-DWITH_XRANDR) - include_directories(${XRANDR_INCLUDE_DIRS}) - set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XRANDR_LIBRARIES}) + include_directories(${XRandR_INCLUDE_DIRS}) + set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${XRandR_LIBRARIES}) endif() if(WITH_XFIXES) @@ -245,10 +245,10 @@ set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client freerdp m) if (NOT APPLE) list(APPEND ${MODULE_PREFIX}_LIBS rt) endif() -target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${${MODULE_PREFIX}_LIBS}) +target_link_libraries(${MODULE_NAME} PRIVATE ${${MODULE_PREFIX}_LIBS}) if(WITH_IPP) - target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${IPP_LIBRARY_LIST}) + target_link_libraries(${MODULE_NAME} PRIVATE ${IPP_LIBRARY_LIST}) endif() if(WITH_CLIENT_INTERFACE) diff --git a/client/common/CMakeLists.txt b/client/common/CMakeLists.txt index 095039d57..65f82d7fa 100644 --- a/client/common/CMakeLists.txt +++ b/client/common/CMakeLists.txt @@ -46,7 +46,7 @@ if (WIN32 AND BUILD_SHARED_LIBS) set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR}) set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION}) - set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${FREERDP_API_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) configure_file( ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in @@ -66,11 +66,11 @@ endif() set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr) -target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${FREERDP_CHANNELS_CLIENT_LIBS}) +target_link_libraries(${MODULE_NAME} PRIVATE ${FREERDP_CHANNELS_CLIENT_LIBS}) if(OPENBSD) - target_link_libraries(${MODULE_NAME} ${PUBLIC_KEYWORD} ${${MODULE_PREFIX}_LIBS} sndio) + target_link_libraries(${MODULE_NAME} PUBLIC ${${MODULE_PREFIX}_LIBS} sndio) else() - target_link_libraries(${MODULE_NAME} ${PUBLIC_KEYWORD} ${${MODULE_PREFIX}_LIBS}) + target_link_libraries(${MODULE_NAME} PUBLIC ${${MODULE_PREFIX}_LIBS}) endif() diff --git a/cmake/CheckCmakeCompat.cmake b/cmake/CheckCmakeCompat.cmake index d616ad7dd..a6e3804b2 100644 --- a/cmake/CheckCmakeCompat.cmake +++ b/cmake/CheckCmakeCompat.cmake @@ -24,19 +24,3 @@ endmacro() # Compatibility includes - order does matter! enable_cmake_compat(3.7.0) -enable_cmake_compat(2.8.11) -enable_cmake_compat(2.8.6) -enable_cmake_compat(2.8.3) -enable_cmake_compat(2.8.2) - -# GetGitRevisionDescription requires FindGit which was added in version 2.8.2 -# build won't fail but GIT_REVISION is set to n/a -if(${CMAKE_VERSION} VERSION_LESS 2.8.2) - message(WARNING "GetGitRevisionDescription reqires (FindGit) cmake >= 2.8.2 to work properly - GIT_REVISION will be set to n/a") -endif() - -# Since cmake 2.8.9 modules/library names without lib/.so can be used -# for dependencies -if(IOS AND ${CMAKE_VERSION} VERSION_LESS 2.8.9) - message(FATAL_ERROR "CMAKE version >= 2.8.9 required to build the IOS client") -endif() diff --git a/cmake/ComplexLibrary.cmake b/cmake/ComplexLibrary.cmake index 703e9376a..433bf2966 100644 --- a/cmake/ComplexLibrary.cmake +++ b/cmake/ComplexLibrary.cmake @@ -64,10 +64,6 @@ macro(add_complex_library) endmacro(add_complex_library) -if(${CMAKE_VERSION} VERSION_GREATER 2.8.8) - set(CMAKE_OBJECT_TARGET_SUPPORT 1) -endif() - function(create_object_cotarget target) set(cotarget "${target}-objects") diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake index 0226f761e..3535853bc 100644 --- a/cmake/ConfigOptions.cmake +++ b/cmake/ConfigOptions.cmake @@ -79,7 +79,7 @@ option(BUILTIN_CHANNELS "Combine all channels into their respective base library option(WITH_CHANNELS "Build virtual channel plugins" ON) -option(WITH_WINPR_TOOLS "Build WinPR helper binaries" ON) +option(FREERDP_UNIFIED_BUILD "Build WinPR, uwac, RdTk and FreeRDP in one go" ON) CMAKE_DEPENDENT_OPTION(WITH_CLIENT_CHANNELS "Build virtual channel plugins" ON "WITH_CLIENT_COMMON;WITH_CHANNELS" OFF) diff --git a/cmake/FindXRandR.cmake b/cmake/FindXRandR.cmake index 7b0ec7185..fb554f3b3 100644 --- a/cmake/FindXRandR.cmake +++ b/cmake/FindXRandR.cmake @@ -1,13 +1,13 @@ -# - Find XRANDR -# Find the XRANDR libraries +# - Find XRandR +# Find the XRandR libraries # # This module defines the following variables: -# XRANDR_FOUND - true if XRANDR_INCLUDE_DIR & XRANDR_LIBRARY are found -# XRANDR_LIBRARIES - Set when XRANDR_LIBRARY is found -# XRANDR_INCLUDE_DIRS - Set when XRANDR_INCLUDE_DIR is found +# XRandR_FOUND - true if XRANDR_INCLUDE_DIR & XRANDR_LIBRARY are found +# XRandR_LIBRARIES - Set when XRANDR_LIBRARY is found +# XRandR_INCLUDE_DIRS - Set when XRANDR_INCLUDE_DIR is found # -# XRANDR_INCLUDE_DIR - where to find Xrandr.h, etc. -# XRANDR_LIBRARY - the XRANDR library +# XRandR_INCLUDE_DIR - where to find Xrandr.h, etc. +# XRandR_LIBRARY - the XRANDR library # #============================================================================= @@ -26,24 +26,24 @@ # limitations under the License. #============================================================================= -find_path(XRANDR_INCLUDE_DIR NAMES X11/extensions/Xrandr.h +find_path(XRandR_INCLUDE_DIR NAMES X11/extensions/Xrandr.h PATH_SUFFIXES X11/extensions PATHS /opt/X11/include - DOC "The XRANDR include directory" + DOC "The XRandR include directory" ) -find_library(XRANDR_LIBRARY NAMES Xrandr +find_library(XRandR_LIBRARY NAMES Xrandr PATHS /opt/X11/lib - DOC "The XRANDR library" + DOC "The XRandR library" ) include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(XRANDR DEFAULT_MSG XRANDR_LIBRARY XRANDR_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(XRandR DEFAULT_MSG XRandR_LIBRARY XRandR_INCLUDE_DIR) -if(XRANDR_FOUND) - set( XRANDR_LIBRARIES ${XRANDR_LIBRARY} ) - set( XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDE_DIR} ) +if(XRandR_FOUND) + set( XRandR_LIBRARIES ${XRandR_LIBRARY} ) + set( XRandR_INCLUDE_DIRS ${XRandR_INCLUDE_DIR} ) endif() -mark_as_advanced(XRANDR_INCLUDE_DIR XRANDR_LIBRARY) +mark_as_advanced(XRandR_INCLUDE_DIR XRandR_LIBRARY) diff --git a/cmake/today.cmake b/cmake/today.cmake index 659e5eced..9e88801bc 100644 --- a/cmake/today.cmake +++ b/cmake/today.cmake @@ -6,14 +6,6 @@ MACRO (TODAY RESULT) if (DEFINED ENV{SOURCE_DATE_EPOCH} AND NOT WIN32) EXECUTE_PROCESS(COMMAND "date" "-u" "-d" "@$ENV{SOURCE_DATE_EPOCH}" "+%Y-%m-%d" OUTPUT_VARIABLE ${RESULT} OUTPUT_STRIP_TRAILING_WHITESPACE) - elseif(CMAKE_VERSION VERSION_LESS "2.8.11") - if (WIN32) - message(FATAL_ERROR "Your CMake version is too old. Please update to a more recent version >= 2.8.11") - else() - EXECUTE_PROCESS(COMMAND "date" "-u" "+%Y-%m-%d" - OUTPUT_VARIABLE ${RESULT} OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() - else() STRING(TIMESTAMP ${RESULT} "%Y-%m-%d" UTC) endif() ENDMACRO (TODAY) diff --git a/libfreerdp/CMakeLists.txt b/libfreerdp/CMakeLists.txt index 7ee155d40..f7e8da9e5 100644 --- a/libfreerdp/CMakeLists.txt +++ b/libfreerdp/CMakeLists.txt @@ -366,7 +366,7 @@ if (WIN32) set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR}) set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION}) - set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${FREERDP_API_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) configure_file( ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in @@ -387,7 +387,7 @@ if (WITH_LIBRARY_VERSIONING) endif() -target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${LIBFREERDP_LIBS} winpr) +target_link_libraries(${MODULE_NAME} PRIVATE ${LIBFREERDP_LIBS} winpr) install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT FreeRDPTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -405,22 +405,18 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp.pc.in ${CMAKE_CURRENT_BINARY_ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ## cmake project -if(${CMAKE_VERSION} VERSION_GREATER "2.8.10") +export(PACKAGE freerdp) - export(PACKAGE freerdp) +SetFreeRDPCMakeInstallDir(FREERDP_CMAKE_INSTALL_DIR "FreeRDP${FREERDP_VERSION_MAJOR}") - SetFreeRDPCMakeInstallDir(FREERDP_CMAKE_INSTALL_DIR "FreeRDP${FREERDP_VERSION_MAJOR}") +configure_package_config_file(FreeRDPConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfig.cmake +INSTALL_DESTINATION ${FREERDP_CMAKE_INSTALL_DIR} +PATH_VARS FREERDP_INCLUDE_DIR) - configure_package_config_file(FreeRDPConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfig.cmake - INSTALL_DESTINATION ${FREERDP_CMAKE_INSTALL_DIR} - PATH_VARS FREERDP_INCLUDE_DIR) +write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfigVersion.cmake +VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) - write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfigVersion.cmake - VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfigVersion.cmake +DESTINATION ${FREERDP_CMAKE_INSTALL_DIR}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDPConfigVersion.cmake - DESTINATION ${FREERDP_CMAKE_INSTALL_DIR}) - - install(EXPORT FreeRDPTargets DESTINATION ${FREERDP_CMAKE_INSTALL_DIR}) - -endif() +install(EXPORT FreeRDPTargets DESTINATION ${FREERDP_CMAKE_INSTALL_DIR}) diff --git a/libfreerdp/core/autodetect.c b/libfreerdp/core/autodetect.c index 94e001b43..02a789f9c 100644 --- a/libfreerdp/core/autodetect.c +++ b/libfreerdp/core/autodetect.c @@ -309,6 +309,7 @@ static BOOL autodetect_send_bandwidth_measure_results(rdpRdp* rdp, UINT16 respon "sending Bandwidth Measure Results PDU -> timeDelta=%" PRIu64 ", byteCount=%" PRIu32 "", timeDelta, rdp->autodetect->bandwidthMeasureByteCount); + Stream_Write_UINT8(s, 0x0E); /* headerLength (1 byte) */ Stream_Write_UINT8(s, TYPE_ID_AUTODETECT_RESPONSE); /* headerTypeId (1 byte) */ Stream_Write_UINT16(s, sequenceNumber); /* sequenceNumber (2 bytes) */ diff --git a/libfreerdp/core/gateway/ntlm.c b/libfreerdp/core/gateway/ntlm.c index 3d5634e88..3577fcc6a 100644 --- a/libfreerdp/core/gateway/ntlm.c +++ b/libfreerdp/core/gateway/ntlm.c @@ -78,6 +78,7 @@ BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL http, LPCSTR user, LPCSTR domain, LPCS SecPkgContext_Bindings* Bindings) { SECURITY_STATUS status; + ntlm->http = http; ntlm->Bindings = Bindings; ntlm->table = InitSecurityInterfaceEx(0); diff --git a/rdtk/CMakeLists.txt b/rdtk/CMakeLists.txt index dce2ec612..e78a1f826 100644 --- a/rdtk/CMakeLists.txt +++ b/rdtk/CMakeLists.txt @@ -15,11 +15,40 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +# Soname versioning +set(RDTK_VERSION_MAJOR "0") +set(RDTK_VERSION_MINOR "2") +set(RDTK_VERSION_REVISION "0") +set(RDTK_VERSION "${RDTK_VERSION_MAJOR}.${RDTK_VERSION_MINOR}.${RDTK_VERSION_REVISION}") +set(RDTK_VERSION_FULL "${RDTK_VERSION}") +set(RDTK_API_VERSION "${RDTK_VERSION_MAJOR}") -project(RdTk C) +if (NOT FREERDP_UNIFIED_BUILD) + cmake_minimum_required(VERSION 3.4) + project(RdTk VERSION ${RDTK_VERSION} LANGUAGES C) -set(CMAKE_COLOR_MAKEFILE ON) + set(CMAKE_COLOR_MAKEFILE ON) + + option(BUILD_SHARED_LIBS "Build shared libraries" ON) + option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) + option(BUILD_TESTING "Build library unit tests" ON) + option(WITH_LIBRARY_VERSIONING "Use library version triplet" ON) + + # Default to release build type + if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") + endif() + + if(CMAKE_COMPILER_IS_GNUCC) + if(NOT EXPORT_ALL_SYMBOLS) + message(STATUS "GCC default symbol visibility: hidden") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + endif() + endif() +endif() + +# Include our extra modules +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/) # Include cmake modules include(CheckIncludeFiles) @@ -28,25 +57,16 @@ include(CheckStructHasMember) include(FindPkgConfig) include(TestBigEndian) -# Include our extra modules -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/) - # Check for cmake compatibility (enable/disable features) include(CheckCmakeCompat) include(FindFeature) -include(ConfigOptions) include(CheckCCompilerFlag) include(GNUInstallDirsWrapper) include(CMakePackageConfigHelpers) +include (SetFreeRDPCMakeInstallDir) -# Default to release build type -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif() - -# Default to build shared libs -if(NOT DEFINED BUILD_SHARED_LIBS) - set(BUILD_SHARED_LIBS ON) +if(BUILD_SHARED_LIBS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRDTK_EXPORTS") endif() if (NOT IOS) @@ -58,15 +78,26 @@ else() set(WINPR_HAVE_STDBOOL_H 1) endif() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRDTK_EXPORTS") - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) +if (FREERDP_UNIFIED_BUILD) + include_directories(${CMAKE_SOURCE_DIR}/winpr/include) + include_directories(${CMAKE_BINARY_DIR}/winpr/include) +else() + find_package(WinPR 3 REQUIRED) + include_directories(${WinPR_INCLUDE_DIR}) +endif() + +SetFreeRDPCMakeInstallDir(RDTK_CMAKE_INSTALL_DIR "rdtk${RDTK_VERSION_MAJOR}") +add_subdirectory(include) add_subdirectory(librdtk) +add_subdirectory(templates) +install(EXPORT rdtk DESTINATION ${RDTK_CMAKE_INSTALL_DIR}) if(WITH_SAMPLE) if(WITH_X11) add_subdirectory(sample) endif() endif() + diff --git a/rdtk/include/CMakeLists.txt b/rdtk/include/CMakeLists.txt new file mode 100644 index 000000000..5e84ceb6d --- /dev/null +++ b/rdtk/include/CMakeLists.txt @@ -0,0 +1,2 @@ +file(GLOB RDTK_HEADERS "rdkt/*.h") +install(FILES ${RDTK_HEADERS} DESTINATION include/rdkt${RDTK_API_VERSION}/rdkt COMPONENT headers) diff --git a/rdtk/include/rdtk/api.h b/rdtk/include/rdtk/api.h index d28493a04..b5cee542a 100644 --- a/rdtk/include/rdtk/api.h +++ b/rdtk/include/rdtk/api.h @@ -21,8 +21,6 @@ #include -/* Don't do any export */ -#if 0 #if defined _WIN32 || defined __CYGWIN__ #ifdef RDTK_EXPORTS #ifdef __GNUC__ @@ -44,7 +42,5 @@ #define RDTK_EXPORT #endif #endif -#endif -#define RDTK_EXPORT #endif /* RDTK_API_H */ diff --git a/rdtk/librdtk/CMakeLists.txt b/rdtk/librdtk/CMakeLists.txt index 000e6d25e..e56434660 100644 --- a/rdtk/librdtk/CMakeLists.txt +++ b/rdtk/librdtk/CMakeLists.txt @@ -36,12 +36,33 @@ set(${MODULE_PREFIX}_SRCS rdtk_engine.c rdtk_engine.h) -add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) +# On windows create dll version information. +# Vendor, product and year are already set in top level CMakeLists.txt +if (WIN32) + set (RC_VERSION_MAJOR ${RDTK_VERSION_MAJOR}) + set (RC_VERSION_MINOR ${RDTK_VERSION_MINOR}) + set (RC_VERSION_BUILD ${RDTK_VERSION_REVISION}) + set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${RDTK_API_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + + configure_file( + ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in + ${CMAKE_CURRENT_BINARY_DIR}/version.rc + @ONLY) + + list (APPEND ${MODULE_PREFIX}_SRCS ${CMAKE_CURRENT_BINARY_DIR}/version.rc) +endif() + +add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) list(APPEND ${MODULE_PREFIX}_LIBS winpr) -list(APPEND ${MODULE_PREFIX}_LIBS freerdp) -target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${${MODULE_PREFIX}_LIBS}) +target_link_libraries(${MODULE_NAME} PRIVATE ${${MODULE_PREFIX}_LIBS}) + +set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) +set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${RDTK_API_VERSION}) +if (WITH_LIBRARY_VERSIONING) + set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${RDTK_VERSION} SOVERSION ${RDTK_API_VERSION}) +endif() set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "RdTk") @@ -49,6 +70,12 @@ if(BUILD_TESTING) add_subdirectory(test) endif() -if (NOT BUILD_SHARED_LIBS) - install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT FreeRDP-ShadowTargets) +install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT rdtk + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + +if (WITH_DEBUG_SYMBOLS AND MSVC AND BUILD_SHARED_LIBS) + get_target_property(OUTPUT_FILENAME ${MODULE_NAME} OUTPUT_NAME) + install(FILES ${CMAKE_PDB_BINARY_DIR}/${OUTPUT_FILENAME}.pdb DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT symbols) endif() diff --git a/rdtk/librdtk/test/CMakeLists.txt b/rdtk/librdtk/test/CMakeLists.txt index c570541ed..97a04cc36 100644 --- a/rdtk/librdtk/test/CMakeLists.txt +++ b/rdtk/librdtk/test/CMakeLists.txt @@ -13,7 +13,7 @@ create_test_sourcelist(${MODULE_PREFIX}_SRCS add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -target_link_libraries(${MODULE_NAME} rdtk) +target_link_libraries(${MODULE_NAME} winpr rdtk) set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") diff --git a/rdtk/templates/.gitignore b/rdtk/templates/.gitignore new file mode 100644 index 000000000..1a7da6d22 --- /dev/null +++ b/rdtk/templates/.gitignore @@ -0,0 +1,3 @@ +*.h +*.pc +*.cmake diff --git a/rdtk/templates/CMakeLists.txt b/rdtk/templates/CMakeLists.txt new file mode 100644 index 000000000..3433ac9ac --- /dev/null +++ b/rdtk/templates/CMakeLists.txt @@ -0,0 +1,45 @@ + +include (SetFreeRDPCMakeInstallDir) + +set(RDTK_INCLUDE_DIR "include/rdtk${RDTK_VERSION_MAJOR}") + +# cmake package +export(PACKAGE rdtk) + +configure_package_config_file( + ${CMAKE_CURRENT_SOURCE_DIR}/rdtkConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfig.cmake + INSTALL_DESTINATION ${RDTK_CMAKE_INSTALL_DIR} + PATH_VARS RDTK_INCLUDE_DIR) + +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfigVersion.cmake + VERSION ${RDTK_VERSION} + COMPATIBILITY SameMajorVersion) + +set(RDTK_BUILD_CONFIG_LIST "") +GET_CMAKE_PROPERTY(res VARIABLES) +FOREACH(var ${res}) + IF (var MATCHES "^WITH_*|^BUILD_TESTING|^BUILTIN_CHANNELS|^HAVE_*") + LIST(APPEND RDTK_BUILD_CONFIG_LIST "${var}=${${var}}") + ENDIF() +ENDFOREACH() +string(REPLACE ";" " " RDTK_BUILD_CONFIG "${RDTK_BUILD_CONFIG_LIST}") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/buildflags.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/build-config.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/rdtk.pc.in ${CMAKE_CURRENT_BINARY_DIR}/rdtk${RDTK_VERSION_MAJOR}.pc @ONLY) + +set(RDTK_INSTALL_INCLUDE_DIR include/rdtk${RDTK_API_VERSION}/rdtk) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.h DESTINATION ${RDTK_INSTALL_INCLUDE_DIR} COMPONENT headers) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION ${RDTK_INSTALL_INCLUDE_DIR} COMPONENT headers) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/build-config.h DESTINATION ${RDTK_INSTALL_INCLUDE_DIR} COMPONENT headers) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/buildflags.h DESTINATION ${RDTK_INSTALL_INCLUDE_DIR} COMPONENT headers) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/rdtk${RDTK_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/rdtkConfigVersion.cmake + DESTINATION ${RDTK_CMAKE_INSTALL_DIR}) + + diff --git a/rdtk/templates/build-config.h.in b/rdtk/templates/build-config.h.in new file mode 100644 index 000000000..f1fe835b6 --- /dev/null +++ b/rdtk/templates/build-config.h.in @@ -0,0 +1,20 @@ +#ifndef RDTK_BUILD_CONFIG_H +#define RDTK_BUILD_CONFIG_H + +#define RDTK_DATA_PATH "${WINPR_DATA_PATH}" +#define RDTK_KEYMAP_PATH "${WINPR_KEYMAP_PATH}" +#define RDTK_PLUGIN_PATH "${WINPR_PLUGIN_PATH}" + +#define RDTK_INSTALL_PREFIX "${WINPR_INSTALL_PREFIX}" + +#define RDTK_LIBRARY_PATH "${WINPR_LIBRARY_PATH}" + +#define RDTK_ADDIN_PATH "${WINPR_ADDIN_PATH}" + +#define RDTK_SHARED_LIBRARY_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}" +#define RDTK_SHARED_LIBRARY_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}" + +#define RDTK_VENDOR_STRING "${VENDOR}" +#define RDTK_PRODUCT_STRING "${PRODUCT}" + +#endif /* RDTK_BUILD_CONFIG_H */ diff --git a/rdtk/templates/buildflags.h.in b/rdtk/templates/buildflags.h.in new file mode 100644 index 000000000..de54a0996 --- /dev/null +++ b/rdtk/templates/buildflags.h.in @@ -0,0 +1,11 @@ +#ifndef RDTK_BUILD_FLAGS_H +#define RDTK_BUILD_FLAGS_H + +#define CFLAGS "${CMAKE_C_FLAGS}" +#define COMPILER_ID "${CMAKE_C_COMPILER_ID}" +#define COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION}" +#define TARGET_ARCH "${TARGET_ARCH}" +#define BUILD_CONFIG "${RDTK_BUILD_CONFIG}" +#define BUILD_TYPE "${CMAKE_BUILD_TYPE}" + +#endif /* RDTK_BUILD_FLAGS_H */ diff --git a/rdtk/templates/config.h.in b/rdtk/templates/config.h.in new file mode 100644 index 000000000..c6243d341 --- /dev/null +++ b/rdtk/templates/config.h.in @@ -0,0 +1,4 @@ +#ifndef RDTK_CONFIG_H +#define RDTK_CONFIG_H + +#endif /* RDTK_CONFIG_H */ diff --git a/rdtk/templates/rdtk.pc.in b/rdtk/templates/rdtk.pc.in new file mode 100644 index 000000000..86bc1c9e2 --- /dev/null +++ b/rdtk/templates/rdtk.pc.in @@ -0,0 +1,15 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=${prefix}/@RDTK_INCLUDE_DIR@ +libs=-lrdtk@RDTK_VERSION_MAJOR@ + +Name: rdtk@RDTK_API_VERSION@ +Description: rdtk: +URL: http://www.freerdp.com/ +Version: @RDTK_VERSION@ +Requires: +Requires.private: winpr@WINPR_VERSION_MAJOR@ +Libs: -L${libdir} ${libs} +Libs.private: +Cflags: -I${includedir} diff --git a/rdtk/templates/rdtkConfig.cmake.in b/rdtk/templates/rdtkConfig.cmake.in new file mode 100644 index 000000000..230e92c44 --- /dev/null +++ b/rdtk/templates/rdtkConfig.cmake.in @@ -0,0 +1,9 @@ +@PACKAGE_INIT@ + +set(RDTK_VERSION_MAJOR "@RDTK_VERSION_MAJOR@") +set(RDTK_VERSION_MINOR "@RDTK_VERSION_MINOR@") +set(RDTK_VERSION_REVISION "@RDTK_VERSION_REVISION@") + +set_and_check(RDTK_INCLUDE_DIR "@PACKAGE_RDTK_INCLUDE_DIR@") + +include("${CMAKE_CURRENT_LIST_DIR}/rdtk.cmake") diff --git a/rdtk/templates/version.h.in b/rdtk/templates/version.h.in new file mode 100644 index 000000000..d1fd20067 --- /dev/null +++ b/rdtk/templates/version.h.in @@ -0,0 +1,32 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Version includes + * + * Copyright 2021 Thincast Technologies GmbH + * Copyright 2021 Armin Novak + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef RDTK_VERSION_H +#define RDTK_VERSION_H + +#define RDTK_VERSION_MAJOR ${RDTK_VERSION_MAJOR} +#define RDTK_VERSION_MINOR ${RDTK_VERSION_MINOR} +#define RDTK_VERSION_REVISION ${RDTK_VERSION_REVISION} +#define RDTK_VERSION_SUFFIX "${RDTK_VERSION_SUFFIX}" +#define RDTK_API_VERSION "${RDTK_API_VERSION}" +#define RDTK_VERSION "${RDTK_VERSION}" +#define RDTK_VERSION_FULL "${RDTK_VERSION_FULL}" +#define RDTK_GIT_REVISION "${GIT_REVISION}" + +#endif /* RDTK_VERSION_H */ diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index e91757e12..742c99e6f 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -76,22 +76,20 @@ endforeach() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-server.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-server${FREERDP_VERSION_MAJOR}.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-server${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -if(${CMAKE_VERSION} VERSION_GREATER "2.8.10") +export(PACKAGE freerdp-server) - export(PACKAGE freerdp-server) +SetFreeRDPCMakeInstallDir(FREERDP_SERVER_CMAKE_INSTALL_DIR "FreeRDP-Server${FREERDP_VERSION_MAJOR}") - SetFreeRDPCMakeInstallDir(FREERDP_SERVER_CMAKE_INSTALL_DIR "FreeRDP-Server${FREERDP_VERSION_MAJOR}") +configure_package_config_file(FreeRDP-ServerConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfig.cmake + INSTALL_DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR} + PATH_VARS FREERDP_INCLUDE_DIR) - configure_package_config_file(FreeRDP-ServerConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfig.cmake - INSTALL_DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR} - PATH_VARS FREERDP_INCLUDE_DIR) +write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfigVersion.cmake + VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) - write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfigVersion.cmake - VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) - - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfigVersion.cmake - DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ServerConfigVersion.cmake + DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR}) +if (NOT BUILTIN_CHANNELS) install(EXPORT FreeRDP-ServerTargets DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR}) - endif() diff --git a/server/Windows/CMakeLists.txt b/server/Windows/CMakeLists.txt index f12687c0c..cb8092558 100644 --- a/server/Windows/CMakeLists.txt +++ b/server/Windows/CMakeLists.txt @@ -37,7 +37,7 @@ set(${MODULE_PREFIX}_SRCS wf_settings.h wf_info.c wf_info.h) - + if(CHANNEL_RDPSND AND NOT WITH_RDPSND_DSOUND) set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} @@ -64,7 +64,7 @@ set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR}) set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION}) if(WITH_SERVER_INTERFACE) - set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${FREERDP_API_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) else() set (RC_VERSION_FILE "${MODULE_NAME}${CMAKE_EXECUTABLE_SUFFIX}" ) endif() @@ -81,7 +81,7 @@ if(WITH_SERVER_INTERFACE) if (WITH_LIBRARY_VERSIONING) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION}) endif() - + else() set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} cli/wfreerdp.c cli/wfreerdp.h) add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) diff --git a/server/common/CMakeLists.txt b/server/common/CMakeLists.txt index 2ba633dec..aa11dd06a 100644 --- a/server/common/CMakeLists.txt +++ b/server/common/CMakeLists.txt @@ -43,7 +43,7 @@ if (WIN32) set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}) set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR}) set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION}) - set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${FREERDP_API_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) configure_file( ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in @@ -60,8 +60,8 @@ if (WITH_LIBRARY_VERSIONING) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION}) endif() -target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${FREERDP_CHANNELS_SERVER_LIBS}) -target_link_libraries(${MODULE_NAME} ${PUBLIC_KEYWORD} winpr freerdp) +target_link_libraries(${MODULE_NAME} PRIVATE ${FREERDP_CHANNELS_SERVER_LIBS}) +target_link_libraries(${MODULE_NAME} PUBLIC winpr freerdp) install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT FreeRDP-ServerTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/server/shadow/CMakeLists.txt b/server/shadow/CMakeLists.txt index cee142333..9ef73472c 100644 --- a/server/shadow/CMakeLists.txt +++ b/server/shadow/CMakeLists.txt @@ -54,6 +54,14 @@ set(${MODULE_PREFIX}_SRCS shadow_server.c shadow.h) +if (NOT FREERDP_UNIFIED_BUILD) + find_package(rdtk 0 REQUIRED) + include_directories(${RDTK_INCLUDE_DIR}) +else() + include_directories(${CMAKE_SOURCE_DIR}/rdtk/include) + include_directories(${CMAKE_BINARY_DIR}/rdtk/include) +endif() + # On windows create dll version information. # Vendor, product and year are already set in top level CMakeLists.txt if (WIN32) @@ -61,7 +69,7 @@ if (WIN32) set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR}) set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION}) set (RC_VERSION_PATCH 0) - set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${FREERDP_API_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) configure_file( ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in @@ -79,7 +87,7 @@ list(APPEND ${MODULE_PREFIX}_LIBS winpr) list(APPEND ${MODULE_PREFIX}_LIBS winpr-tools) list(APPEND ${MODULE_PREFIX}_LIBS rdtk) -target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${${MODULE_PREFIX}_LIBS}) +target_link_libraries(${MODULE_NAME} PRIVATE ${${MODULE_PREFIX}_LIBS}) set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${FREERDP_VERSION_MAJOR}) if (WITH_LIBRARY_VERSIONING) @@ -103,8 +111,8 @@ set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow") set(MODULE_NAME "freerdp-shadow-subsystem") set(MODULE_PREFIX "FREERDP_SERVER_SHADOW_SUBSYSTEM") -set(${MODULE_PREFIX}_SRCS - shadow_subsystem_builtin.c) +set(${MODULE_PREFIX}_SRCS + shadow_subsystem_builtin.c) if(WIN32) set(WITH_SHADOW_WIN 1) @@ -287,7 +295,7 @@ add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-shadow freerdp winpr) -target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${${MODULE_PREFIX}_LIBS}) +target_link_libraries(${MODULE_NAME} PRIVATE ${${MODULE_PREFIX}_LIBS}) set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${FREERDP_API_VERSION}) if (WITH_LIBRARY_VERSIONING) @@ -335,7 +343,7 @@ add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-shadow-subsystem freerdp-shadow winpr) -target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${${MODULE_PREFIX}_LIBS}) +target_link_libraries(${MODULE_NAME} PRIVATE ${${MODULE_PREFIX}_LIBS}) install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT server) if (WITH_DEBUG_SYMBOLS AND MSVC) @@ -351,21 +359,20 @@ install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow-cli.1 1) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -if(${CMAKE_VERSION} VERSION_GREATER "2.8.10") +export(PACKAGE freerdp-shadow) - export(PACKAGE freerdp-shadow) +SetFreeRDPCMakeInstallDir(FREERDP_SERVER_CMAKE_INSTALL_DIR "FreeRDP-Shadow${FREERDP_VERSION_MAJOR}") - SetFreeRDPCMakeInstallDir(FREERDP_SERVER_CMAKE_INSTALL_DIR "FreeRDP-Shadow${FREERDP_VERSION_MAJOR}") +configure_package_config_file(FreeRDP-ShadowConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfig.cmake + INSTALL_DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR} + PATH_VARS FREERDP_INCLUDE_DIR) - configure_package_config_file(FreeRDP-ShadowConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfig.cmake - INSTALL_DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR} - PATH_VARS FREERDP_INCLUDE_DIR) +write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfigVersion.cmake + VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) - write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfigVersion.cmake - VERSION ${FREERDP_VERSION} COMPATIBILITY SameMajorVersion) - - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfigVersion.cmake - DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FreeRDP-ShadowConfigVersion.cmake + DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR}) +if (NOT BUILTIN_CHANNELS) install(EXPORT FreeRDP-ShadowTargets DESTINATION ${FREERDP_SERVER_CMAKE_INSTALL_DIR}) endif() diff --git a/uwac/CMakeLists.txt b/uwac/CMakeLists.txt index c2eba9f33..f8543f54d 100644 --- a/uwac/CMakeLists.txt +++ b/uwac/CMakeLists.txt @@ -23,30 +23,75 @@ set(UWAC_VERSION "${UWAC_VERSION_MAJOR}.${UWAC_VERSION_MINOR}.${UWAC_VERSION_REV set(UWAC_VERSION_FULL "${UWAC_VERSION}") set(UWAC_API_VERSION "${UWAC_VERSION_MAJOR}") -add_subdirectory(include) -add_subdirectory(libuwac) +if (NOT FREERDP_UNIFIED_BUILD) + cmake_minimum_required(VERSION 3.4) + project(uwac VERSION ${UWAC_VERSION} LANGUAGES C) -set(UWAC_INCLUDE_DIR "include/uwac${UWAC_VERSION_MAJOR}") -# cmake package -if(${CMAKE_VERSION} VERSION_GREATER "2.8.10") + set(CMAKE_COLOR_MAKEFILE ON) - export(PACKAGE uwac) + option(BUILD_SHARED_LIBS "Build shared libraries" ON) + option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) + option(BUILD_TESTING "Build library unit tests" ON) + option(WITH_LIBRARY_VERSIONING "Use library version triplet" ON) - SetFreeRDPCMakeInstallDir(UWAC_CMAKE_INSTALL_DIR "uwac${UWAC_VERSION_MAJOR}") - - - configure_package_config_file(uwacConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake - INSTALL_DESTINATION ${UWAC_CMAKE_INSTALL_DIR} - PATH_VARS UWAC_INCLUDE_DIR) - - write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake - VERSION ${UWAC_VERSION} COMPATIBILITY SameMajorVersion) - - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake - DESTINATION ${UWAC_CMAKE_INSTALL_DIR}) - - install(EXPORT uwac DESTINATION ${UWAC_CMAKE_INSTALL_DIR}) + if(CMAKE_COMPILER_IS_GNUCC) + if(NOT EXPORT_ALL_SYMBOLS) + message(STATUS "GCC default symbol visibility: hidden") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + endif() + endif() endif() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/uwac.pc.in ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc @ONLY) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +option(HAVE_PIXMAN_REGION "Use PIXMAN or FreeRDP for region calculations" "NOT FREERDP_UNIFIED_BUILD") + +# Include our extra modules +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/) + +# Check for cmake compatibility (enable/disable features) +include(FindFeature) +include(SetFreeRDPCMakeInstallDir) +include(CMakePackageConfigHelpers) +include(GNUInstallDirsWrapper) + +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +if (NOT IOS) + check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H) + if (NOT WINPR_HAVE_STDBOOL_H) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool) + endif() +else() + set(WINPR_HAVE_STDBOOL_H 1) +endif() + +# Find required libraries +if (HAVE_PIXMAN_REGION) + include(FindPkgConfig) + pkg_check_modules(pixman REQUIRED pixman-1) + include_directories(${pixman_INCLUDE_DIRS}) + add_definitions(-DHAVE_PIXMAN_REGION) +elseif (FREERDP_UNIFIED_BUILD) + include_directories(${CMAKE_SOURCE_DIR}/winpr/include) + include_directories(${CMAKE_BINARY_DIR}/winpr/include) + include_directories(${CMAKE_SOURCE_DIR}/include) + include_directories(${CMAKE_BINARY_DIR}/include) +else() + find_package(WinPR 3 REQUIRED) + find_package(FreeRDP 3 REQUIRED) + include_directories(${WinPR_INCLUDE_DIR}) + include_directories(${FreeRDP_INCLUDE_DIR}) +endif() + +set(WAYLAND_FEATURE_PURPOSE "Wayland") +set(WAYLAND_FEATURE_DESCRIPTION "Wayland client") +set(WAYLAND_FEATURE_TYPE "REQUIRED") +find_feature(Wayland ${WAYLAND_FEATURE_TYPE} ${WAYLAND_FEATURE_PURPOSE} ${WAYLAND_FEATURE_DESCRIPTION}) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}/templates) + +add_subdirectory(libuwac) +add_subdirectory(include) +add_subdirectory(templates) + diff --git a/uwac/libuwac/.gitignore b/uwac/libuwac/.gitignore index 11b3543b4..ada506734 100644 --- a/uwac/libuwac/.gitignore +++ b/uwac/libuwac/.gitignore @@ -1,7 +1 @@ -fullscreen-shell-client-protocol.h -fullscreen-shell-protocol.c -ivi-application-client-protocol.h -ivi-application-protocol.c -xdg-shell-client-protocol.h -xdg-shell-protocol.c - +protocols/* diff --git a/uwac/libuwac/CMakeLists.txt b/uwac/libuwac/CMakeLists.txt index cfadba8ae..a61471365 100644 --- a/uwac/libuwac/CMakeLists.txt +++ b/uwac/libuwac/CMakeLists.txt @@ -17,23 +17,24 @@ set(MODULE_NAME "uwac") set(MODULE_PREFIX "UWAC") - set(GENERATED_SOURCES "") macro(generate_protocol_file PROTO) add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${PROTO}-protocol.c" - COMMAND ${WAYLAND_SCANNER} code < ${CMAKE_SOURCE_DIR}/uwac/protocols/${PROTO}.xml > ${CMAKE_CURRENT_BINARY_DIR}/${PROTO}-protocol.c - DEPENDS ${CMAKE_SOURCE_DIR}/uwac/protocols/${PROTO}.xml + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-protocol.c" + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/protocols + COMMAND ${WAYLAND_SCANNER} code < ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml > ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-protocol.c + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml ) add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${PROTO}-client-protocol.h" - COMMAND ${WAYLAND_SCANNER} client-header < ${CMAKE_SOURCE_DIR}/uwac/protocols/${PROTO}.xml > ${CMAKE_CURRENT_BINARY_DIR}/${PROTO}-client-protocol.h - DEPENDS ${CMAKE_SOURCE_DIR}/uwac/protocols/${PROTO}.xml + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-client-protocol.h" + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/protocols + COMMAND ${WAYLAND_SCANNER} client-header < ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml > ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-client-protocol.h + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../protocols/${PROTO}.xml ) - list(APPEND GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${PROTO}-client-protocol.h) - list(APPEND GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${PROTO}-protocol.c) + list(APPEND GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-client-protocol.h) + list(APPEND GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/protocols/${PROTO}-protocol.c) endmacro() generate_protocol_file(xdg-shell) @@ -48,9 +49,9 @@ if(FREEBSD) endif() include_directories(${WAYLAND_INCLUDE_DIR}) include_directories(${XKBCOMMON_INCLUDE_DIR}) -include_directories("${CMAKE_SOURCE_DIR}/uwac/include") -include_directories("${CMAKE_BINARY_DIR}/uwac/include") -include_directories("${CMAKE_BINARY_DIR}/uwac/libuwac") +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include") +include_directories("${CMAKE_CURRENT_BINARY_DIR}/../include") +include_directories("${CMAKE_CURRENT_BINARY_DIR}/protocols") add_definitions(-DBUILD_IVI -DBUILD_FULLSCREEN_SHELL -DENABLE_XKBCOMMON) @@ -70,16 +71,23 @@ set(${MODULE_PREFIX}_SRCS add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) - +set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) set_target_properties(${MODULE_NAME} PROPERTIES OUTPUT_NAME ${MODULE_NAME}${UWAC_API_VERSION}) if (WITH_LIBRARY_VERSIONING) set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${UWAC_VERSION} SOVERSION ${UWAC_API_VERSION}) endif() -target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} ${PRIVATE_KEYWORD} ${WAYLAND_LIBS} ${XKBCOMMON_LIBS} ${EPOLLSHIM_LIBS} freerdp) - -install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT uwac) +target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} PRIVATE ${WAYLAND_LIBS} ${XKBCOMMON_LIBS} ${EPOLLSHIM_LIBS}) +if (HAVE_PIXMAN_REGION) + target_link_libraries(${MODULE_NAME} PRIVATE ${pixman_LINK_LIBRARIES}) +else() + target_link_libraries(${MODULE_NAME} PRIVATE freerdp) +endif() +install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT uwac + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "uwac") diff --git a/uwac/libuwac/uwac-os.c b/uwac/libuwac/uwac-os.c index 7e3672110..31302e753 100644 --- a/uwac/libuwac/uwac-os.c +++ b/uwac/libuwac/uwac-os.c @@ -51,7 +51,7 @@ #include #include -#include "../config.h" +#include "config.h" #include "uwac-os.h" #include "uwac-utils.h" diff --git a/uwac/templates/.gitignore b/uwac/templates/.gitignore new file mode 100644 index 000000000..1a7da6d22 --- /dev/null +++ b/uwac/templates/.gitignore @@ -0,0 +1,3 @@ +*.h +*.pc +*.cmake diff --git a/uwac/templates/CMakeLists.txt b/uwac/templates/CMakeLists.txt new file mode 100644 index 000000000..4549ed3c8 --- /dev/null +++ b/uwac/templates/CMakeLists.txt @@ -0,0 +1,44 @@ +set(UWAC_INCLUDE_DIR "include/uwac${UWAC_VERSION_MAJOR}") +# cmake package +export(PACKAGE uwac) + +SetFreeRDPCMakeInstallDir(UWAC_CMAKE_INSTALL_DIR "uwac${UWAC_VERSION_MAJOR}") + +configure_package_config_file( + ${CMAKE_CURRENT_SOURCE_DIR}/uwacConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake + INSTALL_DESTINATION ${UWAC_CMAKE_INSTALL_DIR} + PATH_VARS UWAC_INCLUDE_DIR) + +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake + VERSION ${UWAC_VERSION} + COMPATIBILITY SameMajorVersion) + +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/uwacConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/uwacConfigVersion.cmake + DESTINATION ${UWAC_CMAKE_INSTALL_DIR}) + +install(EXPORT uwac DESTINATION ${UWAC_CMAKE_INSTALL_DIR}) + +set(UWAC_BUILD_CONFIG_LIST "") +GET_CMAKE_PROPERTY(res VARIABLES) +FOREACH(var ${res}) + IF (var MATCHES "^WITH_*|^BUILD_TESTING|^BUILTIN_CHANNELS|^HAVE_*") + LIST(APPEND UWAC_BUILD_CONFIG_LIST "${var}=${${var}}") + ENDIF() +ENDFOREACH() +string(REPLACE ";" " " UWAC_BUILD_CONFIG "${UWAC_BUILD_CONFIG_LIST}") +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/buildflags.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/build-config.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/uwac.pc.in ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc @ONLY) + +set(UWAC_INSTALL_INCLUDE_DIR include/uwac${UWAC_API_VERSION}/uwac) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.h DESTINATION ${UWAC_INSTALL_INCLUDE_DIR} COMPONENT headers) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION ${UWAC_INSTALL_INCLUDE_DIR} COMPONENT headers) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/build-config.h DESTINATION ${UWAC_INSTALL_INCLUDE_DIR} COMPONENT headers) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/buildflags.h DESTINATION ${UWAC_INSTALL_INCLUDE_DIR} COMPONENT headers) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) diff --git a/uwac/templates/build-config.h.in b/uwac/templates/build-config.h.in new file mode 100644 index 000000000..a2c103e99 --- /dev/null +++ b/uwac/templates/build-config.h.in @@ -0,0 +1,22 @@ +#ifndef UWAC_BUILD_CONFIG_H +#define UWAC_BUILD_CONFIG_H + +#define UWAC_DATA_PATH "${WINPR_DATA_PATH}" +#define UWAC_KEYMAP_PATH "${WINPR_KEYMAP_PATH}" +#define UWAC_PLUGIN_PATH "${WINPR_PLUGIN_PATH}" + +#define UWAC_INSTALL_PREFIX "${WINPR_INSTALL_PREFIX}" + +#define UWAC_LIBRARY_PATH "${WINPR_LIBRARY_PATH}" + +#define UWAC_ADDIN_PATH "${WINPR_ADDIN_PATH}" + +#define UWAC_SHARED_LIBRARY_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}" +#define UWAC_SHARED_LIBRARY_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}" + +#define UWAC_VENDOR_STRING "${VENDOR}" +#define UWAC_PRODUCT_STRING "${PRODUCT}" + +#define UWAC_PROXY_PLUGINDIR "${WINPR_PROXY_PLUGINDIR}" + +#endif /* UWAC_BUILD_CONFIG_H */ diff --git a/uwac/templates/buildflags.h.in b/uwac/templates/buildflags.h.in new file mode 100644 index 000000000..0b8cbae3a --- /dev/null +++ b/uwac/templates/buildflags.h.in @@ -0,0 +1,11 @@ +#ifndef UWAC_BUILD_FLAGS_H +#define UWAC_BUILD_FLAGS_H + +#define CFLAGS "${CMAKE_C_FLAGS}" +#define COMPILER_ID "${CMAKE_C_COMPILER_ID}" +#define COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION}" +#define TARGET_ARCH "${TARGET_ARCH}" +#define BUILD_CONFIG "${UWAC_BUILD_CONFIG}" +#define BUILD_TYPE "${CMAKE_BUILD_TYPE}" + +#endif /* UWAC_BUILD_FLAGS_H */ diff --git a/uwac/templates/config.h.in b/uwac/templates/config.h.in new file mode 100644 index 000000000..96a53a55f --- /dev/null +++ b/uwac/templates/config.h.in @@ -0,0 +1,31 @@ +#ifndef UWAC_CONFIG_H +#define UWAC_CONFIG_H + +/* Include files */ +#cmakedefine HAVE_FCNTL_H +#if defined(__APPLE__) && !defined(__IOS__) +#cmakedefine01 HAVE_UNISTD_H +#else +#cmakedefine HAVE_UNISTD_H +#endif +#cmakedefine HAVE_INTTYPES_H +#cmakedefine HAVE_SYS_MODEM_H +#cmakedefine HAVE_SYS_FILIO_H +#cmakedefine HAVE_SYS_SELECT_H +#cmakedefine HAVE_SYS_SOCKIO_H +#cmakedefine HAVE_SYS_STRTIO_H +#cmakedefine HAVE_SYS_EVENTFD_H +#cmakedefine HAVE_SYS_TIMERFD_H +#cmakedefine HAVE_TM_GMTOFF +#cmakedefine HAVE_AIO_H +#cmakedefine HAVE_POLL_H +#cmakedefine HAVE_SYSLOG_H +#cmakedefine HAVE_JOURNALD_H +#cmakedefine HAVE_PTHREAD_MUTEX_TIMEDLOCK +#cmakedefine HAVE_VALGRIND_MEMCHECK_H +#cmakedefine HAVE_EXECINFO_H +#cmakedefine HAVE_GETLOGIN_R +#cmakedefine HAVE_STRNDUP +#cmakedefine HAVE_PIXMAN_REGION + +#endif /* UWAC_CONFIG_H */ diff --git a/uwac/uwac.pc.in b/uwac/templates/uwac.pc.in similarity index 93% rename from uwac/uwac.pc.in rename to uwac/templates/uwac.pc.in index 0885b0e60..499d98335 100644 --- a/uwac/uwac.pc.in +++ b/uwac/templates/uwac.pc.in @@ -4,7 +4,7 @@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=${prefix}/@UWAC_INCLUDE_DIR@ libs=-luwac@UWAC_VERSION_MAJOR@ -Name: uwac +Name: uwac@UWAC_API_VERSION@ Description: uwac: using wayland as a client URL: http://www.freerdp.com/ Version: @UWAC_VERSION@ diff --git a/uwac/uwacConfig.cmake.in b/uwac/templates/uwacConfig.cmake.in similarity index 100% rename from uwac/uwacConfig.cmake.in rename to uwac/templates/uwacConfig.cmake.in diff --git a/uwac/templates/version.h.in b/uwac/templates/version.h.in new file mode 100644 index 000000000..1b941b6a0 --- /dev/null +++ b/uwac/templates/version.h.in @@ -0,0 +1,32 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Version includes + * + * Copyright 2021 Thincast Technologies GmbH + * Copyright 2021 Armin Novak + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef UWAC_VERSION_H +#define UWAC_VERSION_H + +#define UWAC_VERSION_MAJOR ${UWAC_VERSION_MAJOR} +#define UWAC_VERSION_MINOR ${UWAC_VERSION_MINOR} +#define UWAC_VERSION_REVISION ${UWAC_VERSION_REVISION} +#define UWAC_VERSION_SUFFIX "${UWAC_VERSION_SUFFIX}" +#define UWAC_API_VERSION "${UWAC_API_VERSION}" +#define UWAC_VERSION "${UWAC_VERSION}" +#define UWAC_VERSION_FULL "${UWAC_VERSION_FULL}" +#define UWAC_GIT_REVISION "${GIT_REVISION}" + +#endif /* UWAC_VERSION_H */ diff --git a/uwac/uwacVersion.cmake b/uwac/uwacVersion.cmake deleted file mode 100644 index 2a789d7d0..000000000 --- a/uwac/uwacVersion.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# This is a basic version file for the Config-mode of find_package(). -# It is used by write_basic_package_version_file() as input file for configure_file() -# to create a version-file which can be installed along a config.cmake file. -# -# The created file sets PACKAGE_VERSION_EXACT if the current version string and -# the requested version string are exactly the same and it sets -# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version, -# but only if the requested major version is the same as the current one. -# The variable CVF_VERSION must be set before calling configure_file(). - - -set(PACKAGE_VERSION "0.0.1") - -if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) - set(PACKAGE_VERSION_COMPATIBLE FALSE) -else() - - if("0.0.1" MATCHES "^([0-9]+)\\.") - set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}") - else() - set(CVF_VERSION_MAJOR "0.0.1") - endif() - - if("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "${CVF_VERSION_MAJOR}") - set(PACKAGE_VERSION_COMPATIBLE TRUE) - else() - set(PACKAGE_VERSION_COMPATIBLE FALSE) - endif() - - if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") - set(PACKAGE_VERSION_EXACT TRUE) - endif() -endif() - - -# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") - return() -endif() - -# check that the installed version has the same 32/64bit-ness as the one which is currently searching: -if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") - math(EXPR installedBits "8 * 8") - set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") - set(PACKAGE_VERSION_UNSUITABLE TRUE) -endif() diff --git a/winpr/.gitignore b/winpr/.gitignore index 487041de6..bc3bba696 100644 --- a/winpr/.gitignore +++ b/winpr/.gitignore @@ -1 +1,2 @@ tools/reg/winpr-reg +include/winpr/build-config.h diff --git a/winpr/CMakeLists.txt b/winpr/CMakeLists.txt index 4bdbd43cb..e5dfd61ca 100644 --- a/winpr/CMakeLists.txt +++ b/winpr/CMakeLists.txt @@ -15,21 +15,31 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 3.4) +if (NOT FREERDP_UNIFIED_BUILD) + cmake_minimum_required(VERSION 3.4) + project(WinPR LANGUAGES C) -project(WinPR C CXX) + set(CMAKE_COLOR_MAKEFILE ON) + option(WITH_LIBRARY_VERSIONING "Use library version triplet" ON) -set(CMAKE_COLOR_MAKEFILE ON) + # Default to build shared libs + option(BUILD_SHARED_LIBS "Build shared libraries" ON) + option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF) + if(CMAKE_COMPILER_IS_GNUCC) + if(NOT EXPORT_ALL_SYMBOLS) + message(STATUS "GCC default symbol visibility: hidden") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + endif() + endif() +endif() option(WITH_VERBOSE_WINPR_ASSERT "Compile with verbose WINPR_ASSERT." ON) +option(WITH_WINPR_TOOLS "Build WinPR helper binaries" ON) if (WITH_VERBOSE_WINPR_ASSERT) add_definitions(-DWITH_VERBOSE_WINPR_ASSERT) endif() -if(FREERDP_VERSION) - set(FREERDP_BUILD 1) -endif() # Include cmake modules include(CheckIncludeFiles) @@ -45,11 +55,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/) # Check for cmake compatibility (enable/disable features) include(CheckCmakeCompat) include(FindFeature) -include(ConfigOptions) include(ComplexLibrary) include(FeatureSummary) include(CheckCCompilerFlag) include(GNUInstallDirsWrapper) +include(InstallFreeRDPMan) +include(SetFreeRDPCMakeInstallDir) include(CMakePackageConfigHelpers) if (NOT WIN32) @@ -83,20 +94,22 @@ else() endif() if(NOT IOS) - check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H) check_include_files(stdint.h WINPR_HAVE_STDINT_H) check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H) else(NOT IOS) - set(WINPR_HAVE_STDBOOL_H 1) set(WINPR_HAVE_STDINT_H 1) set(WINPR_HAVE_INTTYPES_H 1) endif(NOT IOS) -if(FREERDP_BUILD) - set(WINPR_VERSION_FULL ${WINPR_VERSION_FULL} PARENT_SCOPE) - set(WINPR_VERSION ${WINPR_VERSION} PARENT_SCOPE) - set(WINPR_API_VERSION ${WINPR_API_VERSION} PARENT_SCOPE) +if (NOT IOS) + check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H) + if (NOT WINPR_HAVE_STDBOOL_H) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool) + endif() else() + set(WINPR_HAVE_STDBOOL_H 1) +endif() + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) if(NOT IOS) @@ -141,7 +154,7 @@ else() endif (HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS) endif() - set(OPENSSL_FEATURE_TYPE "OPTIONAL") +set(OPENSSL_FEATURE_TYPE "RECOMMENDED") set(OPENSSL_FEATURE_PURPOSE "cryptography") set(OPENSSL_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions") @@ -160,6 +173,10 @@ else() add_definitions("-DWITH_MBEDTLS") endif() + if (NOT OPENSSL_FOUND AND NOT MBEDTLS_FOUND) + message(FATAL_ERROR "OpenSSL or MBedTLS are required, none enabled/found") + endif() + # Include directories include_directories(${CMAKE_CURRENT_BINARY_DIR}) @@ -173,7 +190,6 @@ else() set(TESTING_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") else() set(TESTING_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Testing") - endif() endif() # Default to release build type @@ -181,11 +197,6 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() -# Default to build shared libs -if(NOT DEFINED BUILD_SHARED_LIBS) - set(BUILD_SHARED_LIBS ON) -endif() - if(BUILD_SHARED_LIBS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_DLL") endif() @@ -215,30 +226,24 @@ endif() install_freerdp_man(wlog.7 7) # Exporting -if(${CMAKE_VERSION} VERSION_GREATER "2.8.10") +export(PACKAGE winpr) - export(PACKAGE winpr) +SetFreeRDPCMakeInstallDir(WINPR_CMAKE_INSTALL_DIR "WinPR${WINPR_VERSION_MAJOR}") - SetFreeRDPCMakeInstallDir(WINPR_CMAKE_INSTALL_DIR "WinPR${WINPR_VERSION_MAJOR}") +set(WINPR_INCLUDE_DIR "include/winpr${WINPR_VERSION_MAJOR}") - set(WINPR_INCLUDE_DIR "include/winpr${WINPR_VERSION_MAJOR}") +configure_package_config_file(WinPRConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfig.cmake + INSTALL_DESTINATION ${WINPR_CMAKE_INSTALL_DIR} + PATH_VARS WINPR_INCLUDE_DIR) - configure_package_config_file(WinPRConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfig.cmake - INSTALL_DESTINATION ${WINPR_CMAKE_INSTALL_DIR} - PATH_VARS WINPR_INCLUDE_DIR) +write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/WinPRConfigVersion.cmake + VERSION ${WINPR_VERSION} COMPATIBILITY SameMajorVersion) - write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/WinPRConfigVersion.cmake - VERSION ${WINPR_VERSION} COMPATIBILITY SameMajorVersion) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfigVersion.cmake + DESTINATION ${WINPR_CMAKE_INSTALL_DIR}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfigVersion.cmake - DESTINATION ${WINPR_CMAKE_INSTALL_DIR}) +install(EXPORT WinPRTargets DESTINATION ${WINPR_CMAKE_INSTALL_DIR}) - install(EXPORT WinPRTargets DESTINATION ${WINPR_CMAKE_INSTALL_DIR}) - -endif() - -if(FREERDP_BUILD) - set(WINPR_PKG_CONFIG_FILENAME winpr${WINPR_VERSION_MAJOR} PARENT_SCOPE) -endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr${WINPR_VERSION_MAJOR}.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr${WINPR_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/buildflags.h) diff --git a/winpr/buildflags.h.in b/winpr/buildflags.h.in new file mode 100644 index 000000000..8dc1cacdc --- /dev/null +++ b/winpr/buildflags.h.in @@ -0,0 +1,11 @@ +#ifndef WINPR_BUILD_FLAGS_H +#define WINPR_BUILD_FLAGS_H + +#define CFLAGS "${CMAKE_C_FLAGS}" +#define COMPILER_ID "${CMAKE_C_COMPILER_ID}" +#define COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION}" +#define TARGET_ARCH "${TARGET_ARCH}" +#define BUILD_CONFIG "${WINPR_BUILD_CONFIG}" +#define BUILD_TYPE "${CMAKE_BUILD_TYPE}" + +#endif /* WINPR_BUILD_FLAGS_H */ diff --git a/winpr/include/CMakeLists.txt b/winpr/include/CMakeLists.txt index 452383d0d..0c6a67c3d 100644 --- a/winpr/include/CMakeLists.txt +++ b/winpr/include/CMakeLists.txt @@ -17,10 +17,12 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/version.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr/wtypes.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/wtypes.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/build-config.h) set(WINPR_INSTALL_INCLUDE_DIR include/winpr${WINPR_VERSION_MAJOR}/winpr) file(GLOB WINPR_HEADERS "winpr/*.h") install(FILES ${WINPR_HEADERS} DESTINATION ${WINPR_INSTALL_INCLUDE_DIR} COMPONENT headers) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr/version.h DESTINATION ${WINPR_INSTALL_INCLUDE_DIR} COMPONENT headers) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr/wtypes.h DESTINATION ${WINPR_INSTALL_INCLUDE_DIR} COMPONENT headers) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr/build-config.h DESTINATION ${WINPR_INSTALL_INCLUDE_DIR} COMPONENT headers) install(DIRECTORY winpr/tools DESTINATION ${WINPR_INSTALL_INCLUDE_DIR} COMPONENT headers FILES_MATCHING PATTERN "*.h") diff --git a/winpr/include/winpr/build-config.h.in b/winpr/include/winpr/build-config.h.in new file mode 100644 index 000000000..823f4182a --- /dev/null +++ b/winpr/include/winpr/build-config.h.in @@ -0,0 +1,22 @@ +#ifndef WINPR_BUILD_CONFIG_H +#define WINPR_BUILD_CONFIG_H + +#define WINPR_DATA_PATH "${WINPR_DATA_PATH}" +#define WINPR_KEYMAP_PATH "${WINPR_KEYMAP_PATH}" +#define WINPR_PLUGIN_PATH "${WINPR_PLUGIN_PATH}" + +#define WINPR_INSTALL_PREFIX "${WINPR_INSTALL_PREFIX}" + +#define WINPR_LIBRARY_PATH "${WINPR_LIBRARY_PATH}" + +#define WINPR_ADDIN_PATH "${WINPR_ADDIN_PATH}" + +#define WINPR_SHARED_LIBRARY_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}" +#define WINPR_SHARED_LIBRARY_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}" + +#define WINPR_VENDOR_STRING "${VENDOR}" +#define WINPR_PRODUCT_STRING "${PRODUCT}" + +#define WINPR_PROXY_PLUGINDIR "${WINPR_PROXY_PLUGINDIR}" + +#endif /* WINPR_BUILD_CONFIG_H */ diff --git a/winpr/libwinpr/CMakeLists.txt b/winpr/libwinpr/CMakeLists.txt index 3737a84f3..af2d4782a 100644 --- a/winpr/libwinpr/CMakeLists.txt +++ b/winpr/libwinpr/CMakeLists.txt @@ -125,7 +125,7 @@ if (WIN32) set (RC_VERSION_MAJOR ${WINPR_VERSION_MAJOR}) set (RC_VERSION_MINOR ${WINPR_VERSION_MINOR}) set (RC_VERSION_BUILD ${WINPR_VERSION_REVISION}) - set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${WINPR_API_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) configure_file( ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in @@ -144,7 +144,7 @@ if (WITH_LIBRARY_VERSIONING) endif() add_definitions(${WINPR_DEFINITIONS}) -target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${WINPR_LIBS_PRIVATE} ${PUBLIC_KEYWORD} ${WINPR_LIBS_PUBLIC}) +target_link_libraries(${MODULE_NAME} PRIVATE ${WINPR_LIBS_PRIVATE} PUBLIC ${WINPR_LIBS_PUBLIC}) install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT WinPRTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/winpr/libwinpr/sspi/NTLM/ntlm.c b/winpr/libwinpr/sspi/NTLM/ntlm.c index 44dc6dbda..15626fbcc 100644 --- a/winpr/libwinpr/sspi/NTLM/ntlm.c +++ b/winpr/libwinpr/sspi/NTLM/ntlm.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "ntlm.h" #include "ntlm_export.h" @@ -40,7 +40,7 @@ #include "../../log.h" #define TAG WINPR_TAG("sspi.NTLM") -#define WINPR_KEY "Software\\" FREERDP_VENDOR_STRING "\\" FREERDP_PRODUCT_STRING "\\WinPR\\NTLM" +#define WINPR_KEY "Software\\" WINPR_VENDOR_STRING "\\" WINPR_PRODUCT_STRING "\\WinPR\\NTLM" static char* NTLM_PACKAGE_NAME = "NTLM"; diff --git a/winpr/tools/CMakeLists.txt b/winpr/tools/CMakeLists.txt index cf96686ac..40031c4f3 100644 --- a/winpr/tools/CMakeLists.txt +++ b/winpr/tools/CMakeLists.txt @@ -92,7 +92,7 @@ if (WIN32) set (RC_VERSION_MAJOR ${WINPR_VERSION_MAJOR}) set (RC_VERSION_MINOR ${WINPR_VERSION_MINOR}) set (RC_VERSION_BUILD ${WINPR_VERSION_REVISION}) - set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) + set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${WINPR_TOOLS_API_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) configure_file( ${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in @@ -110,7 +110,7 @@ if (WITH_LIBRARY_VERSIONING) endif() add_definitions(${WINPR_DEFINITIONS}) -target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${WINPR_TOOLS_LIBS}) +target_link_libraries(${MODULE_NAME} PRIVATE ${WINPR_TOOLS_LIBS}) install(TARGETS ${MODULE_NAME} COMPONENT libraries EXPORT WinPRTargets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/winpr/tools/hash-cli/winpr-hash.1.in b/winpr/tools/hash-cli/winpr-hash.1.in index e1c964a1d..4b4816aea 100644 --- a/winpr/tools/hash-cli/winpr-hash.1.in +++ b/winpr/tools/hash-cli/winpr-hash.1.in @@ -1,4 +1,4 @@ -.TH winpr-hash 1 2017-01-11 "@FREERDP_VERSION_FULL@" "FreeRDP" +.TH winpr-hash 1 2017-01-11 "@WINPR_VERSION_FULL@" "FreeRDP" .SH NAME winpr-hash \- NTLM hashing tool .SH SYNOPSIS diff --git a/winpr/tools/makecert-cli/winpr-makecert.1.in b/winpr/tools/makecert-cli/winpr-makecert.1.in index 9478b5212..682cae6db 100644 --- a/winpr/tools/makecert-cli/winpr-makecert.1.in +++ b/winpr/tools/makecert-cli/winpr-makecert.1.in @@ -2,7 +2,7 @@ \\$2 \(laURL: \\$1 \(ra\\$3 .. .if \n[.g] .mso www.tmac -.TH winpr\-makecert 1 2017-01-11 "@FREERDP_VERSION_FULL@" "FreeRDP" +.TH winpr\-makecert 1 2017-01-11 "@WINPR_VERSION_FULL@" "FreeRDP" .SH NAME winpr\-makecert \- A tool to create X.509 certificates. .SH SYNOPSIS