mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
With this commit the "exported" components (usable with pkg-config and
cmake find module package)
* winpr - winpr library and headers
* freerdp - core library and headers
* freerdp-client - client specific library
* freerdp-server - server specific library
* rdtk - rdtk headers and library
To allow the installation of multiple different version (different major
number) the include files were moved into the respective sub folder:
freerdp -> freerdp{MAJOR}/freerdp (currently freerdp2/freerdp/)
winpr -> winpr{MAJOR}/winpr (currently winrp1/winpr/)
rdtk -> rdpk{MAJOR}/rdtk (currently rdtk0/rdtk/
The generated pkg-config and cmake find modules now also include the major
version number. Currently the following pkg-config are generated and
installed.
* winpr1
* freerdp2
* freerdp-server2
* freerdp-client2
* rdtk0
As cmake is able to handle multiple versions out of the box the
following can be used to find a specific module:
find_package(WinPR)
find_package(FreeRDP)
find_package(FreeRDP-Server)
find_package(FreeRDP-Client)
find_package(RdTk)
As cmake doesn't automatically resolve dependencies for packages it is
necessary to manually include the requirements. For example if
FreeRDP-Client is required WinPR and FreeRDP need to be included
(find_package) as well.
This commit also fixes the installation when STATIC_CHANNELS are built.
WITH STATIC_CHANNELS all channels are linked into libfreerdp-client, for
this all channels are generated as linker archive and linked together in
the final step. Before the intermediate linker archives were, although
not required and useful, installed. Same applies for server side
channels.
186 lines
5.4 KiB
CMake
186 lines
5.4 KiB
CMake
# WinPR: Windows Portable Runtime
|
|
# winpr cmake build script
|
|
#
|
|
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
#
|
|
# 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.
|
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
project(WinPR C)
|
|
|
|
set(CMAKE_COLOR_MAKEFILE ON)
|
|
|
|
if(FREERDP_VERSION)
|
|
set(FREERDP_BUILD 1)
|
|
endif()
|
|
|
|
# Include cmake modules
|
|
include(CheckIncludeFiles)
|
|
include(CheckLibraryExists)
|
|
include(CheckSymbolExists)
|
|
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(AutoVersioning)
|
|
include(ConfigOptions)
|
|
include(ComplexLibrary)
|
|
include(FeatureSummary)
|
|
include(CheckCCompilerFlag)
|
|
include(GNUInstallDirsWrapper)
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
# Soname versioning
|
|
set(WINPR_VERSION_MAJOR "1")
|
|
set(WINPR_VERSION_MINOR "1")
|
|
set(WINPR_VERSION_REVISION "0")
|
|
set(WINPR_VERSION "${WINPR_VERSION_MAJOR}.${WINPR_VERSION_MINOR}.${WINPR_VERSION_REVISION}")
|
|
set(WINPR_VERSION_FULL "${WINPR_VERSION}")
|
|
|
|
if(FREERDP_BUILD)
|
|
set(WINPR_VERSION_FULL ${WINPR_VERSION_FULL} PARENT_SCOPE)
|
|
set(WINPR_VERSION_FULL ${WINPR_VERSION} PARENT_SCOPE)
|
|
else()
|
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|
|
|
if(NOT IOS AND NOT ANDROID)
|
|
find_package(Threads REQUIRED)
|
|
endif()
|
|
|
|
# Include files
|
|
if(NOT IOS)
|
|
check_include_files(fcntl.h HAVE_FCNTL_H)
|
|
check_include_files(unistd.h HAVE_UNISTD_H)
|
|
check_include_files(execinfo.h HAVE_EXECINFO_H)
|
|
check_include_files(stdint.h HAVE_STDINT_H)
|
|
check_include_files(inttypes.h HAVE_INTTYPES_H)
|
|
check_include_files(sys/modem.h HAVE_SYS_MODEM_H)
|
|
check_include_files(sys/filio.h HAVE_SYS_FILIO_H)
|
|
check_include_files(sys/sockio.h HAVE_SYS_SOCKIO_H)
|
|
check_include_files(sys/strtio.h HAVE_SYS_STRTIO_H)
|
|
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
|
|
else()
|
|
set(HAVE_FCNTL_H 1)
|
|
set(HAVE_UNISTD_H 1)
|
|
set(HAVE_STDINT_H 1)
|
|
set(HAVE_INTTYPES_H 1)
|
|
set(HAVE_SYS_FILIO_H 1)
|
|
endif()
|
|
|
|
if(NOT IOS)
|
|
check_struct_has_member("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
|
|
else()
|
|
set(HAVE_TM_GMTOFF 1)
|
|
endif()
|
|
|
|
if(NOT WIN32)
|
|
check_library_exists(pthread pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK)
|
|
endif()
|
|
|
|
set(OPENSSL_FEATURE_TYPE "OPTIONAL")
|
|
set(OPENSSL_FEATURE_PURPOSE "cryptography")
|
|
set(OPENSSL_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions")
|
|
|
|
set(MBEDTLS_FEATURE_TYPE "OPTIONAL")
|
|
set(MBEDTLS_FEATURE_PURPOSE "cryptography")
|
|
set(MBEDTLS_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions")
|
|
|
|
find_feature(OpenSSL ${OPENSSL_FEATURE_TYPE} ${OPENSSL_FEATURE_PURPOSE} ${OPENSSL_FEATURE_DESCRIPTION})
|
|
find_feature(MbedTLS ${MBEDTLS_FEATURE_TYPE} ${MBEDTLS_FEATURE_PURPOSE} ${MBEDTLS_FEATURE_DESCRIPTION})
|
|
|
|
if(OPENSSL_FOUND)
|
|
add_definitions("-DWITH_OPENSSL")
|
|
endif()
|
|
|
|
if(MBEDTLS_FOUND)
|
|
add_definitions("-DWITH_MBEDTLS")
|
|
endif()
|
|
|
|
# Include directories
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
# Configure files
|
|
add_definitions("-DHAVE_CONFIG_H")
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
|
|
enable_testing()
|
|
|
|
if(MSVC)
|
|
set(TESTING_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
|
|
else()
|
|
set(TESTING_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Testing")
|
|
endif()
|
|
endif()
|
|
|
|
# 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)
|
|
endif()
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_EXPORTS")
|
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
|
|
|
add_subdirectory(include)
|
|
|
|
add_subdirectory(libwinpr)
|
|
|
|
if(NOT ANDROID AND NOT IOS)
|
|
add_subdirectory(tools)
|
|
endif()
|
|
|
|
if(BUILD_TESTING)
|
|
add_subdirectory(test)
|
|
endif()
|
|
|
|
# Exporting
|
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER "2.8.10")
|
|
|
|
export(PACKAGE winpr)
|
|
|
|
set(WINPR_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/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)
|
|
|
|
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(EXPORT WinPRTargets DESTINATION ${WINPR_CMAKE_INSTALL_DIR})
|
|
|
|
endif()
|
|
|
|
set(WINPR_PKG_CONFIG_FILENAME winpr${WINPR_VERSION_MAJOR} PARENT_SCOPE)
|
|
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)
|