FreeRDP/CMakeLists.txt

991 lines
32 KiB
CMake
Raw Normal View History

2012-10-09 07:02:04 +04:00
# FreeRDP: A Remote Desktop Protocol Implementation
2011-07-02 21:58:55 +04:00
# FreeRDP cmake build script
#
# Copyright 2011 O.S. Systems Software Ltda.
# Copyright 2011 Otavio Salvador <otavio@ossystems.com.br>
# Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2012 HP Development Company, LLC
2011-07-02 21:58:55 +04:00
#
# 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.
2022-05-25 14:44:30 +03:00
cmake_minimum_required(VERSION 3.9)
2012-10-04 17:42:23 +04:00
project(FreeRDP C)
2012-10-04 17:42:23 +04:00
2022-05-25 16:14:36 +03:00
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON)
2022-05-25 14:44:30 +03:00
include(CheckIPOSupported)
check_ipo_supported(RESULT supported OUTPUT error)
if (supported)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
2022-05-25 14:44:30 +03:00
endif()
if(NOT DEFINED VENDOR)
set(VENDOR "FreeRDP" CACHE STRING "FreeRDP package vendor")
endif()
if(NOT DEFINED PRODUCT)
set(PRODUCT "FreeRDP" CACHE STRING "FreeRDP package name")
endif()
2014-05-09 20:25:05 +04:00
if(NOT DEFINED FREERDP_VENDOR)
set(FREERDP_VENDOR 1)
endif()
2011-07-01 04:31:07 +04:00
set(CMAKE_COLOR_MAKEFILE ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Include our extra modules
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/)
2016-03-29 23:03:15 +03:00
if((CMAKE_SYSTEM_NAME MATCHES "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES "10.0"))
set(UWP 1)
add_definitions("-D_UWP")
set(CMAKE_WINDOWS_VERSION "WIN10")
endif()
# Check for cmake compatibility (enable/disable features)
include(CheckCmakeCompat)
# Include cmake modules
if(WITH_CLANG_FORMAT)
include(ClangFormat)
endif()
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckStructHasMember)
2011-08-15 14:21:58 +04:00
include(FindPkgConfig)
include(TestBigEndian)
include(FindFeature)
include(ShowCMakeVars)
2011-07-04 13:01:06 +04:00
include(ConfigOptions)
include(ComplexLibrary)
include(FeatureSummary)
include(CheckCCompilerFlag)
include(GNUInstallDirsWrapper)
include(CMakePackageConfigHelpers)
include(InstallFreeRDPMan)
2017-11-08 16:22:38 +03:00
include(GetGitRevisionDescription)
include(SetFreeRDPCMakeInstallDir)
# Soname versioning
set(BUILD_NUMBER 0)
if ($ENV{BUILD_NUMBER})
set(BUILD_NUMBER $ENV{BUILD_NUMBER})
endif()
set(WITH_LIBRARY_VERSIONING "ON")
2017-11-08 16:22:38 +03:00
2020-04-10 08:40:04 +03:00
set(RAW_VERSION_STRING "3.0.0-dev")
if(EXISTS "${PROJECT_SOURCE_DIR}/.source_tag")
file(READ ${PROJECT_SOURCE_DIR}/.source_tag RAW_VERSION_STRING)
2017-11-08 16:22:38 +03:00
elseif(USE_VERSION_FROM_GIT_TAG)
git_get_exact_tag(_GIT_TAG --tags --always)
if (NOT ${_GIT_TAG} STREQUAL "n/a")
set(RAW_VERSION_STRING ${_GIT_TAG})
2017-11-08 16:22:38 +03:00
endif()
endif()
string(STRIP ${RAW_VERSION_STRING} RAW_VERSION_STRING)
2017-11-08 16:22:38 +03:00
set(VERSION_REGEX "^(.*)([0-9]+)\\.([0-9]+)\\.([0-9]+)-?(.*)")
string(REGEX REPLACE "${VERSION_REGEX}" "\\2" FREERDP_VERSION_MAJOR "${RAW_VERSION_STRING}")
string(REGEX REPLACE "${VERSION_REGEX}" "\\3" FREERDP_VERSION_MINOR "${RAW_VERSION_STRING}")
string(REGEX REPLACE "${VERSION_REGEX}" "\\4" FREERDP_VERSION_REVISION "${RAW_VERSION_STRING}")
string(REGEX REPLACE "${VERSION_REGEX}" "\\5" FREERDP_VERSION_SUFFIX "${RAW_VERSION_STRING}")
2017-11-08 16:22:38 +03:00
set(FREERDP_API_VERSION "${FREERDP_VERSION_MAJOR}")
set(FREERDP_VERSION "${FREERDP_VERSION_MAJOR}.${FREERDP_VERSION_MINOR}.${FREERDP_VERSION_REVISION}")
if (FREERDP_VERSION_SUFFIX)
set(FREERDP_VERSION_FULL "${FREERDP_VERSION}-${FREERDP_VERSION_SUFFIX}")
else()
set(FREERDP_VERSION_FULL "${FREERDP_VERSION}")
endif()
2017-11-08 16:22:38 +03:00
message("FREERDP_VERSION=${FREERDP_VERSION_FULL}")
2022-03-03 13:16:50 +03:00
if(EXISTS "${PROJECT_SOURCE_DIR}/.source_version" )
file(READ ${PROJECT_SOURCE_DIR}/.source_version GIT_REVISION)
string(STRIP ${GIT_REVISION} GIT_REVISION)
elseif(USE_VERSION_FROM_GIT_TAG)
git_get_exact_tag(GIT_REVISION --tags --always)
if (${GIT_REVISION} STREQUAL "n/a")
git_rev_parse (GIT_REVISION --short)
endif()
endif()
if (NOT GIT_REVISION)
set(GIT_REVISION ${FREERDP_VERSION})
2022-03-03 13:16:50 +03:00
endif()
message(STATUS "Git Revision ${GIT_REVISION}")
cleanup cmake exports and pkg-config files 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.
2016-01-08 16:07:35 +03:00
set(FREERDP_INCLUDE_DIR "include/freerdp${FREERDP_VERSION_MAJOR}/")
2021-11-05 15:09:42 +03:00
option(WITH_SMARTCARD_EMULATE "Emulate smartcards instead of redirecting readers" OFF)
if (WITH_SMARTCARD_EMULATE)
2022-03-03 13:16:50 +03:00
add_definitions(-DWITH_SMARTCARD_EMULATE)
find_package(ZLIB REQUIRED)
2021-11-05 15:09:42 +03:00
endif()
option(WITH_FREERDP_DEPRECATED "Build FreeRDP deprecated symbols" OFF)
if (WITH_FREERDP_DEPRECATED)
add_definitions(-DWITH_FREERDP_DEPRECATED)
endif()
2016-02-01 17:21:07 +03:00
# Make paths absolute
if (CMAKE_INSTALL_PREFIX)
get_filename_component(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
endif()
if (FREERDP_EXTERNAL_PATH)
get_filename_component (FREERDP_EXTERNAL_PATH "${FREERDP_EXTERNAL_PATH}" ABSOLUTE)
endif()
# Allow to search the host machine for git/ccache
2016-06-03 14:02:30 +03:00
if(CMAKE_CROSSCOMPILING)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
2016-06-03 14:02:30 +03:00
endif(CMAKE_CROSSCOMPILING)
2016-02-01 17:21:07 +03:00
find_program(CCACHE ccache)
if(CCACHE AND WITH_CCACHE)
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)
2016-06-03 14:02:30 +03:00
if(CMAKE_CROSSCOMPILING)
2016-02-01 17:21:07 +03:00
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
2016-06-03 14:02:30 +03:00
endif(CMAKE_CROSSCOMPILING)
# /Allow to search the host machine for git/ccache
2012-10-01 06:58:59 +04:00
# Turn on solution folders (2.8.4+)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
2011-07-01 04:31:07 +04:00
# Default to release build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
set(LIB_DEFAULT ON)
if (IOS)
set(LIB_DEFAULT OFF)
2011-09-01 18:18:58 +04:00
endif()
option(BUILD_SHARED_LIBS "Build shared libraries" ${LIB_DEFAULT})
option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF)
2011-09-01 18:18:58 +04:00
if(BUILD_TESTING)
set(EXPORT_ALL_SYMBOLS TRUE)
set(CTEST_OUTPUT_ON_FAILURE TRUE)
elseif(NOT DEFINED EXPORT_ALL_SYMBOLS)
set(EXPORT_ALL_SYMBOLS FALSE)
2012-10-19 06:05:06 +04:00
endif()
if (EXPORT_ALL_SYMBOLS)
# set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_definitions(-DFREERDP_TEST_EXPORTS -DBUILD_TESTING)
endif(EXPORT_ALL_SYMBOLS)
# BSD
if(${CMAKE_SYSTEM_NAME} MATCHES "BSD")
set(BSD TRUE)
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
set(FREEBSD TRUE)
endif()
2017-10-23 11:31:55 +03:00
if(${CMAKE_SYSTEM_NAME} MATCHES "kFreeBSD")
set(KFREEBSD TRUE)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
set(OPENBSD TRUE)
endif()
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
set(BSD TRUE)
set(FREEBSD TRUE)
endif()
if(FREEBSD)
find_path(EPOLLSHIM_INCLUDE_DIR NAMES sys/epoll.h sys/timerfd.h HINTS /usr/local/include/libepoll-shim)
find_library(EPOLLSHIM_LIBS NAMES epoll-shim libepoll-shim HINTS /usr/local/lib)
endif()
# Configure MSVC Runtime
if(MSVC)
include(MSVCRuntime)
if(NOT DEFINED MSVC_RUNTIME)
set(MSVC_RUNTIME "dynamic")
endif()
if(MSVC_RUNTIME STREQUAL "static")
if(BUILD_SHARED_LIBS)
message(FATAL_ERROR "Static CRT is only supported in a fully static build")
endif()
message(STATUS "Use the MSVC static runtime option carefully!")
message(STATUS "OpenSSL uses /MD by default, and is very picky")
message(STATUS "Random freeing errors are a common sign of runtime issues")
endif()
configure_msvc_runtime()
2013-04-11 05:15:38 +04:00
if(NOT DEFINED CMAKE_SUPPRESS_REGENERATION)
set(CMAKE_SUPPRESS_REGENERATION ON)
endif()
endif()
# Enable 64bit file support on linux and FreeBSD.
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" OR FREEBSD)
add_definitions("-D_FILE_OFFSET_BITS=64")
endif()
# Use Standard conforming getpwnam_r() on Solaris.
if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
add_definitions("-D_POSIX_PTHREAD_SEMANTICS")
endif()
2011-08-11 11:03:08 +04:00
# Compiler-specific flags
if(CMAKE_COMPILER_IS_GNUCC)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686")
CHECK_SYMBOL_EXISTS(__x86_64__ "" IS_X86_64)
if(IS_X86_64)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")
endif()
endif()
2013-09-19 20:08:20 +04:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
2012-10-19 06:05:06 +04:00
if(NOT EXPORT_ALL_SYMBOLS)
message(STATUS "GCC default symbol visibility: hidden")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
endif()
CHECK_C_COMPILER_FLAG (-Wimplicit-function-declaration Wimplicit-function-declaration)
if(Wimplicit-function-declaration)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-function-declaration")
endif()
if (NOT OPENBSD)
CHECK_C_COMPILER_FLAG (-Wredundant-decls Wredundant-decls)
if(Wredundant-decls)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls")
endif()
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
2016-08-10 11:29:02 +03:00
add_definitions(-DNDEBUG)
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
endif()
endif()
# When building with Unix Makefiles and doing any release builds
# try to set __FILE__ to relative paths via a make specific macro
if (CMAKE_GENERATOR MATCHES "Unix Makefile*")
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_BUILD_TYPE)
CHECK_C_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefined)
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 ${PROJCET_BINARY_DIR}/,,$(subst ${PROJECT_SOURCE_DIR}/,,$(abspath $<)))\"'")
endif()
endif()
2011-08-11 11:03:08 +04:00
endif()
2015-06-17 14:23:21 +03:00
if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-c11-extensions -Wno-gnu")
2013-05-31 21:51:50 +04:00
endif()
set(THREAD_PREFER_PTHREAD_FLAG TRUE)
if(NOT IOS)
find_package(Threads REQUIRED)
endif()
# Enable address sanitizer, where supported and when required
if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCC)
CHECK_C_COMPILER_FLAG ("-fno-omit-frame-pointer" fno-omit-frame-pointer)
2018-04-12 12:49:43 +03:00
if (fno-omit-frame-pointer)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer")
endif()
set(CMAKE_REQUIRED_LINK_OPTIONS_SAVED ${CMAKE_REQUIRED_LINK_OPTIONS})
file(WRITE ${PROJECT_BINARY_DIR}/foo.txt "")
if(WITH_SANITIZE_ADDRESS)
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=address")
CHECK_C_COMPILER_FLAG ("-fsanitize=address" fsanitize-address)
CHECK_C_COMPILER_FLAG ("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist)
2018-04-12 12:49:43 +03:00
CHECK_C_COMPILER_FLAG ("-fsanitize-address-use-after-scope" fsanitize-address-use-after-scope)
2016-10-10 20:17:21 +03:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
2018-04-12 12:49:43 +03:00
if(fsanitize-blacklist)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-address-sanitizer.txt")
endif(fsanitize-blacklist)
2018-04-12 12:49:43 +03:00
if(fsanitize-address-use-after-scope)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-address-use-after-scope")
endif(fsanitize-address-use-after-scope)
2016-10-10 20:17:21 +03:00
elseif(WITH_SANITIZE_MEMORY)
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=memory")
CHECK_C_COMPILER_FLAG ("-fsanitize=memory" fsanitize-memory)
CHECK_C_COMPILER_FLAG ("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist)
2018-04-12 12:49:43 +03:00
CHECK_C_COMPILER_FLAG ("-fsanitize-memory-use-after-dtor" fsanitize-memory-use-after-dtor)
CHECK_C_COMPILER_FLAG ("-fsanitize-memory-track-origins" fsanitize-memory-track-origins)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=memory")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=memory")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=memory")
2018-04-12 12:49:43 +03:00
if(fsanitize-blacklist)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-memory-sanitizer.txt")
endif(fsanitize-blacklist)
2018-04-12 12:49:43 +03:00
if (fsanitize-memory-use-after-dtor)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-memory-use-after-dtor")
endif(fsanitize-memory-use-after-dtor)
2018-04-12 12:49:43 +03:00
if (fsanitize-memory-track-origins)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-memory-track-origins")
endif(fsanitize-memory-track-origins)
2016-10-10 20:17:21 +03:00
elseif(WITH_SANITIZE_THREAD)
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=thread")
CHECK_C_COMPILER_FLAG ("-fsanitize=thread" fsanitize-thread)
CHECK_C_COMPILER_FLAG ("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread")
if(fsanitize-blacklist)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-thread-sanitizer.txt")
endif(fsanitize-blacklist)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=thread")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
endif()
file(REMOVE ${PROJECT_BINARY_DIR}/foo.txt)
set(CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS_SAVED})
2018-04-12 12:49:43 +03:00
if (WITH_NO_UNDEFINED)
CHECK_C_COMPILER_FLAG (-Wl,--no-undefined no-undefined)
2018-04-12 12:49:43 +03:00
if(no-undefined)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined" )
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
endif()
endif()
endif()
if(MSVC)
2015-02-23 18:48:07 +03:00
# Remove previous warning definitions,
# NMake is otherwise complaining.
foreach (flags_var_to_scrub
CMAKE_C_FLAGS
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_MINSIZEREL)
string (REGEX REPLACE "(^| )[/-]W[ ]*[1-9]" " "
"${flags_var_to_scrub}" "${${flags_var_to_scrub}}")
endforeach()
2012-09-03 18:47:45 +04:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd")
2014-02-10 09:34:17 +04:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
2016-02-01 17:21:07 +03:00
if(CMAKE_BUILD_TYPE STREQUAL "Release")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi")
endif()
endif()
if(ANDROID)
# workaround for https://github.com/android-ndk/ndk/issues/243
string(REPLACE "-g " "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
endif()
2013-04-09 07:08:16 +04:00
if(WIN32)
2016-08-10 11:29:02 +03:00
add_definitions(-DUNICODE -D_UNICODE)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-DWIN32_LEAN_AND_MEAN)
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
set(CMAKE_DL_LIBS "")
set(CMAKE_USE_RELATIVE_PATH ON)
2019-01-09 11:30:31 +03:00
if (${CMAKE_GENERATOR} MATCHES "NMake Makefile*" OR ${CMAKE_GENERATOR} MATCHES "Ninja*" OR ${CMAKE_GENERATOR} MATCHES "Unix Makefiles")
set(CMAKE_PDB_BINARY_DIR ${PROJECT_BINARY_DIR})
elseif (${CMAKE_GENERATOR} MATCHES "Visual Studio*")
set(CMAKE_PDB_BINARY_DIR "${PROJECT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}")
else()
2016-10-10 20:17:21 +03:00
message(FATAL_ERROR "Unknown generator ${CMAKE_GENERATOR}")
endif()
2015-10-05 23:23:44 +03:00
string(TIMESTAMP RC_VERSION_YEAR "%Y")
if(NOT DEFINED CMAKE_WINDOWS_VERSION)
2020-04-09 09:17:46 +03:00
set(CMAKE_WINDOWS_VERSION "WIN7")
endif()
if(CMAKE_WINDOWS_VERSION STREQUAL "WINXP")
2016-08-10 11:29:02 +03:00
add_definitions(-DWINVER=0x0501 -D_WIN32_WINNT=0x0501)
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN7")
2016-08-10 11:29:02 +03:00
add_definitions(-DWINVER=0x0601 -D_WIN32_WINNT=0x0601)
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN8")
2016-08-10 11:29:02 +03:00
add_definitions(-DWINVER=0x0602 -D_WIN32_WINNT=0x0602)
2016-03-29 23:03:15 +03:00
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN10")
2016-08-10 11:29:02 +03:00
add_definitions(-DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00)
endif()
2015-02-23 18:48:07 +03:00
# Set product and vendor for dll and exe version information.
set(RC_VERSION_VENDOR ${VENDOR})
set(RC_VERSION_PRODUCT ${PRODUCT})
set(RC_VERSION_PATCH ${BUILD_NUMBER})
2020-04-09 09:17:46 +03:00
set(RC_VERSION_DESCRIPTION "${FREERDP_VERSION_FULL} ${GIT_REVISION} ${CMAKE_WINDOWS_VERSION} ${CMAKE_SYSTEM_PROCESSOR}")
2014-09-26 13:16:04 +04:00
if (FREERDP_EXTERNAL_SSL_PATH)
set(OPENSSL_ROOT_DIR ${FREERDP_EXTERNAL_SSL_PATH})
endif()
2013-04-09 07:08:16 +04:00
endif()
add_definitions(-DFREERDP_EXPORTS)
2014-02-03 07:37:54 +04:00
2011-11-16 08:21:53 +04:00
# Mac OS X
if(APPLE)
2013-09-24 03:41:18 +04:00
if(IOS)
if (NOT FREERDP_IOS_EXTERNAL_SSL_PATH)
message(STATUS "FREERDP_IOS_EXTERNAL_SSL_PATH not set! Required if openssl is not found in the iOS SDK (which usually isn't")
endif()
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${FREERDP_IOS_EXTERNAL_SSL_PATH})
set_property(GLOBAL PROPERTY XCODE_ATTRIBUTE_SKIP_INSTALL YES)
endif(IOS)
# Temporarily disabled, causes the cmake script to be reexecuted, causing the compilation to fail.
# Workaround: specify the parameter in the command-line
2016-02-01 17:21:07 +03:00
# if(WITH_CLANG)
# set(CMAKE_C_COMPILER "clang")
# endif()
2013-09-24 03:41:18 +04:00
if (WITH_VERBOSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -v")
endif()
endif(APPLE)
2011-11-16 08:21:53 +04:00
# OpenBSD
if(OPENBSD)
set(WITH_MANPAGES "ON")
set(WITH_ALSA "OFF")
2016-02-01 17:21:07 +03:00
set(WITH_PULSE "OFF")
2021-03-07 14:51:36 +03:00
set(WITH_OSS "OFF")
set(WITH_SNDIO "ON")
set(WITH_WAYLAND "OFF")
2015-03-10 01:21:28 +03:00
endif()
# Android
if(ANDROID)
2016-02-01 17:21:07 +03:00
set(WITH_LIBRARY_VERSIONING "OFF")
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${ANDROID_LIBRARY_USE_LIB64_PATHS} )
2016-06-03 14:02:30 +03:00
2016-02-01 17:21:07 +03:00
if (${ANDROID_ABI} STREQUAL "armeabi")
set (WITH_NEON OFF)
endif()
2021-05-30 22:15:44 +03:00
if(ANDROID_ABI STREQUAL arm64-v8a)
# https://github.com/android/ndk/issues/910
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=softfp")
endif()
2013-09-23 14:39:41 +04:00
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
add_definitions(-DNDK_DEBUG=1)
# NOTE: Manually add -gdwarf-3, as newer toolchains default to -gdwarf-4,
# which is not supported by the gdbserver binary shipped with
# the android NDK (tested with r9b)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG} -gdwarf-3")
2013-09-23 14:39:41 +04:00
endif()
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -llog")
# CMAKE_PREFIX_PATH detection is broken in most Android toolchain files
# Append it to CMAKE_FIND_ROOT_PATH and avoid potential duplicates
list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH})
list(REMOVE_DUPLICATES CMAKE_FIND_ROOT_PATH)
2016-02-01 17:21:07 +03:00
if (NOT FREERDP_EXTERNAL_PATH)
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/")
set (FREERDP_EXTERNAL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/")
2013-03-24 02:13:10 +04:00
else()
2016-02-01 17:21:07 +03:00
message(STATUS "FREERDP_EXTERNAL_PATH not set!")
endif()
endif()
2020-04-09 09:17:46 +03:00
list (APPEND CMAKE_INCLUDE_PATH ${FREERDP_EXTERNAL_PATH}/${ANDROID_ABI}/include)
2016-02-01 17:21:07 +03:00
list (APPEND CMAKE_LIBRARY_PATH ${FREERDP_EXTERNAL_PATH}/${ANDROID_ABI}/ )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )
if (WITH_GPROF)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/scripts/gprof_generate.sh.cmake
${PROJECT_BINARY_DIR}/scripts/gprof_generate.sh @ONLY)
endif(WITH_GPROF)
endif()
if(WITH_VALGRIND_MEMCHECK)
2016-02-01 17:21:07 +03:00
check_include_files(valgrind/memcheck.h HAVE_VALGRIND_MEMCHECK_H)
else()
2016-02-01 17:21:07 +03:00
unset(HAVE_VALGRIND_MEMCHECK_H CACHE)
endif()
if(UNIX OR CYGWIN)
set(X11_FEATURE_TYPE "RECOMMENDED")
set(WAYLAND_FEATURE_TYPE "RECOMMENDED")
else()
set(X11_FEATURE_TYPE "DISABLED")
set(WAYLAND_FEATURE_TYPE "DISABLED")
endif()
if(WITH_PCSC_WINPR)
find_package(PCSCWinPR)
endif()
set(X11_FEATURE_PURPOSE "X11")
set(X11_FEATURE_DESCRIPTION "X11 client and server")
set(WAYLAND_FEATURE_PURPOSE "Wayland")
set(WAYLAND_FEATURE_DESCRIPTION "Wayland client")
set(ZLIB_FEATURE_TYPE "REQUIRED")
set(ZLIB_FEATURE_PURPOSE "compression")
set(ZLIB_FEATURE_DESCRIPTION "data compression")
set(OPENSSL_FEATURE_TYPE "REQUIRED")
set(OPENSSL_FEATURE_PURPOSE "cryptography")
set(OPENSSL_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions")
2015-09-16 03:52:46 +03:00
set(MBEDTLS_FEATURE_TYPE "OPTIONAL")
set(MBEDTLS_FEATURE_PURPOSE "cryptography")
set(MBEDTLS_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions")
2013-09-23 14:39:41 +04:00
set(OPENSLES_FEATURE_TYPE "OPTIONAL")
set(OPENSLES_FEATURE_PURPOSE "multimedia")
set(OPENSLES_FEATURE_DESCRIPTION "OpenSLES audio / video")
2015-03-09 09:23:29 +03:00
set(OSS_FEATURE_TYPE "RECOMMENDED")
set(OSS_FEATURE_PURPOSE "sound")
set(OSS_FEATURE_DESCRIPTION "audio input, audio output and multimedia redirection")
set(ALSA_FEATURE_TYPE "RECOMMENDED")
set(ALSA_FEATURE_PURPOSE "sound")
set(ALSA_FEATURE_DESCRIPTION "audio input, audio output and multimedia redirection")
2021-03-07 14:51:36 +03:00
set(SNDIO_FEATURE_TYPE "OPTIONAL")
set(SNDIO_FEATURE_PURPOSE "sound")
set(SNDIO_FEATURE_DESCRIPTION "OpenBSD audio input/output")
set(PULSE_FEATURE_TYPE "RECOMMENDED")
set(PULSE_FEATURE_PURPOSE "sound")
set(PULSE_FEATURE_DESCRIPTION "audio input, audio output and multimedia redirection")
set(CUPS_FEATURE_TYPE "RECOMMENDED")
set(CUPS_FEATURE_PURPOSE "printing")
set(CUPS_FEATURE_DESCRIPTION "printer device redirection")
set(PCSC_FEATURE_TYPE "RECOMMENDED")
set(PCSC_FEATURE_PURPOSE "smart card")
set(PCSC_FEATURE_DESCRIPTION "smart card device redirection")
set(FFMPEG_FEATURE_TYPE "RECOMMENDED")
set(FFMPEG_FEATURE_PURPOSE "multimedia")
set(FFMPEG_FEATURE_DESCRIPTION "multimedia redirection, audio and video playback")
set(VAAPI_FEATURE_TYPE "OPTIONAL")
set(VAAPI_FEATURE_PURPOSE "multimedia")
set(VAAPI_FEATURE_DESCRIPTION "VA-API hardware acceleration for video playback")
2013-01-19 02:32:58 +04:00
set(IPP_FEATURE_TYPE "OPTIONAL")
set(IPP_FEATURE_PURPOSE "performance")
set(IPP_FEATURE_DESCRIPTION "Intel Integrated Performance Primitives library")
set(JPEG_FEATURE_TYPE "OPTIONAL")
set(JPEG_FEATURE_PURPOSE "codec")
set(JPEG_FEATURE_DESCRIPTION "use JPEG library")
set(OPENH264_FEATURE_TYPE "OPTIONAL")
set(OPENH264_FEATURE_PURPOSE "codec")
set(OPENH264_FEATURE_DESCRIPTION "use OpenH264 library")
set(OPENCL_FEATURE_TYPE "OPTIONAL")
set(OPENCL_FEATURE_PURPOSE "codec")
set(OPENCL_FEATURE_DESCRIPTION "use OpenCL library")
set(GSM_FEATURE_TYPE "OPTIONAL")
set(GSM_FEATURE_PURPOSE "codec")
set(GSM_FEATURE_DESCRIPTION "GSM audio codec library")
set(LAME_FEATURE_TYPE "OPTIONAL")
set(LAME_FEATURE_PURPOSE "codec")
set(LAME_FEATURE_DESCRIPTION "lame MP3 audio codec library")
set(FAAD2_FEATURE_TYPE "OPTIONAL")
set(FAAD2_FEATURE_PURPOSE "codec")
set(FAAD2_FEATURE_DESCRIPTION "FAAD2 AAC audio codec library")
set(FAAC_FEATURE_TYPE "OPTIONAL")
set(FAAC_FEATURE_PURPOSE "codec")
set(FAAC_FEATURE_DESCRIPTION "FAAC AAC audio codec library")
set(SOXR_FEATURE_TYPE "OPTIONAL")
set(SOXR_FEATURE_PURPOSE "codec")
set(SOXR_FEATURE_DESCRIPTION "SOX audio resample library")
2017-05-11 19:51:45 +03:00
set(GSSAPI_FEATURE_TYPE "OPTIONAL")
set(GSSAPI_FEATURE_PURPOSE "auth")
set(GSSAPI_FEATURE_DESCRIPTION "add kerberos support")
if(WIN32)
set(X11_FEATURE_TYPE "DISABLED")
set(WAYLAND_FEATURE_TYPE "DISABLED")
set(ZLIB_FEATURE_TYPE "OPTIONAL")
2015-03-09 09:23:29 +03:00
set(OSS_FEATURE_TYPE "DISABLED")
set(ALSA_FEATURE_TYPE "DISABLED")
2021-03-07 14:51:36 +03:00
set(SNDIO_FEATURE_TYPE "DISABLED")
set(PULSE_FEATURE_TYPE "DISABLED")
set(CUPS_FEATURE_TYPE "DISABLED")
set(PCSC_FEATURE_TYPE "DISABLED")
set(FFMPEG_FEATURE_TYPE "OPTIONAL")
set(VAAPI_FEATURE_TYPE "DISABLED")
2013-09-23 14:39:41 +04:00
set(OPENSLES_FEATURE_TYPE "DISABLED")
endif()
if(APPLE)
set(FFMPEG_FEATURE_TYPE "OPTIONAL")
set(VAAPI_FEATURE_TYPE "DISABLED")
set(X11_FEATURE_TYPE "OPTIONAL")
set(WAYLAND_FEATURE_TYPE "DISABLED")
2015-03-09 09:23:29 +03:00
set(OSS_FEATURE_TYPE "DISABLED")
2015-01-27 03:16:24 +03:00
set(ALSA_FEATURE_TYPE "DISABLED")
2021-03-07 14:51:36 +03:00
set(SNDIO_FEATURE_TYPE "DISABLED")
if(IOS)
set(X11_FEATURE_TYPE "DISABLED")
set(PULSE_FEATURE_TYPE "DISABLED")
set(CUPS_FEATURE_TYPE "DISABLED")
set(PCSC_FEATURE_TYPE "DISABLED")
endif()
2013-09-23 14:39:41 +04:00
set(OPENSLES_FEATURE_TYPE "DISABLED")
endif()
2016-02-01 17:21:07 +03:00
if(UNIX AND NOT ANDROID)
set(WLOG_SYSTEMD_JOURNAL_FEATURE_TYPE "RECOMMENDED")
set(WLOG_SYSTEMD_JOURNAL_FEATURE_PURPOSE "systemd journal appender")
set(WLOG_SYSTEMD_JOURNAL_FEATURE_DESCRIPTION "allows to export wLog to systemd journal")
#include(Findlibsystemd)
find_feature(libsystemd ${WLOG_SYSTEMD_JOURNAL_FEATURE_TYPE} ${WLOG_SYSTEMD_JOURNAL_FEATURE_PURPOSE} ${WLOG_SYSTEMD_JOURNAL_FEATURE_DESCRIPTION})
if(LIBSYSTEMD_FOUND)
set(HAVE_JOURNALD_H TRUE)
else()
unset(HAVE_JOURNALD_H)
endif()
endif(UNIX AND NOT ANDROID)
if(ANDROID)
set(X11_FEATURE_TYPE "DISABLED")
set(WAYLAND_FEATURE_TYPE "DISABLED")
2015-03-09 09:23:29 +03:00
set(OSS_FEATURE_TYPE "DISABLED")
set(ALSA_FEATURE_TYPE "DISABLED")
2021-03-07 14:51:36 +03:00
set(SNDIO_FEATURE_TYPE "DISABLED")
set(PULSE_FEATURE_TYPE "DISABLED")
set(CUPS_FEATURE_TYPE "DISABLED")
set(PCSC_FEATURE_TYPE "DISABLED")
set(VAAPI_FEATURE_TYPE "DISABLED")
2013-09-23 14:39:41 +04:00
set(OPENSLES_FEATURE_TYPE "REQUIRED")
endif()
find_feature(X11 ${X11_FEATURE_TYPE} ${X11_FEATURE_PURPOSE} ${X11_FEATURE_DESCRIPTION})
find_feature(Wayland ${WAYLAND_FEATURE_TYPE} ${WAYLAND_FEATURE_PURPOSE} ${WAYLAND_FEATURE_DESCRIPTION})
find_feature(ZLIB ${ZLIB_FEATURE_TYPE} ${ZLIB_FEATURE_PURPOSE} ${ZLIB_FEATURE_DESCRIPTION})
find_feature(OpenSSL ${OPENSSL_FEATURE_TYPE} ${OPENSSL_FEATURE_PURPOSE} ${OPENSSL_FEATURE_DESCRIPTION})
2015-09-16 03:52:46 +03:00
find_feature(MbedTLS ${MBEDTLS_FEATURE_TYPE} ${MBEDTLS_FEATURE_PURPOSE} ${MBEDTLS_FEATURE_DESCRIPTION})
2013-09-23 14:39:41 +04:00
find_feature(OpenSLES ${OPENSLES_FEATURE_TYPE} ${OPENSLES_FEATURE_PURPOSE} ${OPENSLES_FEATURE_DESCRIPTION})
2015-03-09 09:23:29 +03:00
find_feature(OSS ${OSS_FEATURE_TYPE} ${OSS_FEATURE_PURPOSE} ${OSS_FEATURE_DESCRIPTION})
find_feature(ALSA ${ALSA_FEATURE_TYPE} ${ALSA_FEATURE_PURPOSE} ${ALSA_FEATURE_DESCRIPTION})
find_feature(Pulse ${PULSE_FEATURE_TYPE} ${PULSE_FEATURE_PURPOSE} ${PULSE_FEATURE_DESCRIPTION})
find_feature(Cups ${CUPS_FEATURE_TYPE} ${CUPS_FEATURE_PURPOSE} ${CUPS_FEATURE_DESCRIPTION})
find_feature(PCSC ${PCSC_FEATURE_TYPE} ${PCSC_FEATURE_PURPOSE} ${PCSC_FEATURE_DESCRIPTION})
if (WITH_DSP_FFMPEG OR WITH_VIDEO_FFMPEG OR WITH_FFMPEG)
set(FFMPEG_FEATURE_TYPE "REQUIRED" )
endif()
find_feature(FFmpeg ${FFMPEG_FEATURE_TYPE} ${FFMPEG_FEATURE_PURPOSE} ${FFMPEG_FEATURE_DESCRIPTION})
find_feature(JPEG ${JPEG_FEATURE_TYPE} ${JPEG_FEATURE_PURPOSE} ${JPEG_FEATURE_DESCRIPTION})
find_feature(OpenH264 ${OPENH264_FEATURE_TYPE} ${OPENH264_FEATURE_PURPOSE} ${OPENH264_FEATURE_DESCRIPTION})
find_feature(OpenCL ${OPENCL_FEATURE_TYPE} ${OPENCL_FEATURE_PURPOSE} ${OPENCL_FEATURE_DESCRIPTION})
find_feature(GSM ${GSM_FEATURE_TYPE} ${GSM_FEATURE_PURPOSE} ${GSM_FEATURE_DESCRIPTION})
find_feature(LAME ${LAME_FEATURE_TYPE} ${LAME_FEATURE_PURPOSE} ${LAME_FEATURE_DESCRIPTION})
find_feature(FAAD2 ${FAAD2_FEATURE_TYPE} ${FAAD2_FEATURE_PURPOSE} ${FAAD2_FEATURE_DESCRIPTION})
find_feature(FAAC ${FAAC_FEATURE_TYPE} ${FAAC_FEATURE_PURPOSE} ${FAAC_FEATURE_DESCRIPTION})
find_feature(soxr ${SOXR_FEATURE_TYPE} ${SOXR_FEATURE_PURPOSE} ${SOXR_FEATURE_DESCRIPTION})
2017-05-11 19:51:45 +03:00
find_feature(GSSAPI ${GSSAPI_FEATURE_TYPE} ${GSSAPI_FEATURE_PURPOSE} ${GSSAPI_FEATURE_DESCRIPTION})
if (WITH_OPENH264 AND NOT WITH_OPENH264_LOADING)
option(WITH_OPENH264_LOADING "Use LoadLibrary to load openh264 at runtime" OFF)
endif (WITH_OPENH264 AND NOT WITH_OPENH264_LOADING)
# Version check, if we have detected FFMPEG but the version is too old
# deactivate it as sound backend.
if (WITH_DSP_FFMPEG)
# Deactivate FFmpeg backend for sound, if the version is too old.
# See libfreerdp/codec/dsp_ffmpeg.h
2018-09-05 15:19:57 +03:00
file(STRINGS "${AVCODEC_INCLUDE_DIR}/libavcodec/version.h" AV_VERSION_FILE REGEX "LIBAVCODEC_VERSION_M[A-Z]+[\t ]*[0-9]+")
if (EXISTS "${AVCODEC_INCLUDE_DIR}/libavcodec/version_major.h")
file(STRINGS "${AVCODEC_INCLUDE_DIR}/libavcodec/version_major.h" AV_VERSION_FILE2 REGEX "LIBAVCODEC_VERSION_M[A-Z]+[\t ]*[0-9]+")
list(APPEND AV_VERSION_FILE ${AV_VERSION_FILE2})
endif()
2018-09-05 15:19:57 +03:00
FOREACH(item ${AV_VERSION_FILE})
STRING(REGEX MATCH "LIBAVCODEC_VERSION_M[A-Z]+[\t ]*[0-9]+" litem ${item})
IF(litem)
string(REGEX REPLACE "[ \t]+" ";" VSPLIT_LINE ${litem})
list(LENGTH VSPLIT_LINE VSPLIT_LINE_LEN)
if (NOT "${VSPLIT_LINE_LEN}" EQUAL "2")
message(ERROR "invalid entry in libavcodec version header ${item}")
endif(NOT "${VSPLIT_LINE_LEN}" EQUAL "2")
list(GET VSPLIT_LINE 0 VNAME)
list(GET VSPLIT_LINE 1 VVALUE)
set(${VNAME} ${VVALUE})
ENDIF(litem)
2018-09-05 15:19:57 +03:00
ENDFOREACH(item ${AV_VERSION_FILE})
set(AVCODEC_VERSION "${LIBAVCODEC_VERSION_MAJOR}.${LIBAVCODEC_VERSION_MINOR}.${LIBAVCODEC_VERSION_MICRO}")
if (AVCODEC_VERSION VERSION_LESS "57.48.101")
message(WARNING "FFmpeg version detected (${AVCODEC_VERSION}) is too old. (Require at least 57.48.101 for sound). Deactivating")
set(WITH_DSP_FFMPEG OFF)
endif()
endif (WITH_DSP_FFMPEG)
2018-05-30 13:13:24 +03:00
if (WITH_OPENH264 AND NOT OPENH264_FOUND)
message(FATAL_ERROR "OpenH264 support requested but not detected")
endif()
2018-05-30 13:13:24 +03:00
set(WITH_OPENH264 ${OPENH264_FOUND})
2013-02-28 14:13:43 +04:00
if(TARGET_ARCH MATCHES "x86|x64")
if (NOT APPLE)
# Intel Performance Primitives
find_feature(IPP ${IPP_FEATURE_TYPE} ${IPP_FEATURE_PURPOSE} ${IPP_FEATURE_DESCRIPTION})
endif()
endif()
2013-01-19 02:32:58 +04:00
2015-10-05 23:23:44 +03:00
if(OPENSSL_FOUND)
add_definitions("-DWITH_OPENSSL")
2016-11-21 19:28:54 +03:00
message(STATUS "Using OpenSSL Version: ${OPENSSL_VERSION}")
2018-12-12 17:40:50 +03:00
include_directories(${OPENSSL_INCLUDE_DIR})
2015-10-05 23:23:44 +03:00
endif()
if(MBEDTLS_FOUND)
add_definitions("-DWITH_MBEDTLS")
endif()
if (WITH_OPENH264 OR WITH_MEDIA_FOUNDATION OR WITH_VIDEO_FFMPEG OR WITH_MEDIACODEC)
set(WITH_GFX_H264 ON)
else()
set(WITH_GFX_H264 OFF)
endif()
# Android expects all libraries to be loadable
# without paths.
if (ANDROID OR WIN32 OR MAC_BUNDLE)
set(FREERDP_DATA_PATH "share")
if (NOT FREERDP_INSTALL_PREFIX)
2020-04-09 09:17:46 +03:00
set(FREERDP_INSTALL_PREFIX ".")
endif()
set(FREERDP_LIBRARY_PATH ".")
set(FREERDP_PLUGIN_PATH ".")
else()
set(FREERDP_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/freerdp${FREERDP_VERSION_MAJOR}")
2020-04-09 09:17:46 +03:00
if (NOT FREERDP_INSTALL_PREFIX)
set(FREERDP_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()
set(FREERDP_LIBRARY_PATH "${CMAKE_INSTALL_LIBDIR}")
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/freerdp${FREERDP_VERSION_MAJOR}")
endif()
set(FREERDP_ADDIN_PATH "${FREERDP_PLUGIN_PATH}")
# Path to put extensions
set(FREERDP_EXTENSION_REL_PATH "${CMAKE_INSTALL_LIBDIR}/freerdp${FREERDP_VERSION_MAJOR}/extensions")
set(FREERDP_EXTENSION_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp${FREERDP_VERSION_MAJOR}/extensions")
# Proxy plugins path
if(NOT DEFINED PROXY_PLUGINDIR)
message("using default plugins location")
set(FREERDP_PROXY_PLUGINDIR "${FREERDP_PLUGIN_PATH}/proxy/")
else()
set(FREERDP_PROXY_PLUGINDIR "${PROXY_PLUGINDIR}")
endif()
# RPATH configuration
2012-10-16 01:13:54 +04:00
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
2018-02-16 12:05:28 +03:00
if (APPLE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
set(CMAKE_INSTALL_RPATH "@loader_path/../Frameworks")
else (APPLE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if (NOT FREEBSD)
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:\$ORIGIN/..")
option(WITH_ADD_PLUGIN_TO_RPATH "Add extension and plugin path to RPATH" OFF)
if (WITH_ADD_PLUGIN_TO_RPATH)
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${FREERDP_EXTENSION_REL_PATH}:\$ORIGIN/../${FREERDP_PLUGIN_PATH}:${CMAKE_INSTALL_RPATH}")
endif()
endif()
2018-02-16 12:05:28 +03:00
endif(APPLE)
2017-04-06 09:05:39 +03:00
if (BUILD_SHARED_LIBS)
set(CMAKE_MACOSX_RPATH ON)
endif()
# Android profiling
if(ANDROID)
if(WITH_GPROF)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
set(PROFILER_LIBRARIES
"${FREERDP_EXTERNAL_PROFILER_PATH}/obj/local/${ANDROID_ABI}/libandroid-ndk-profiler.a")
include_directories("${FREERDP_EXTERNAL_PROFILER_PATH}")
endif()
endif()
2012-10-01 04:15:42 +04:00
# Unit Tests
include(CTest)
2012-10-01 04:15:42 +04:00
2015-02-23 18:48:07 +03:00
if(BUILD_TESTING)
enable_testing()
2015-02-23 18:48:07 +03:00
if(MSVC)
set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
else()
set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Testing")
endif()
2012-10-01 04:15:42 +04:00
endif()
2012-09-21 04:45:56 +04:00
# WinPR
# We want to control the winpr assert for the whole project
option(WITH_VERBOSE_WINPR_ASSERT "Compile with verbose WINPR_ASSERT." ON)
if (WITH_VERBOSE_WINPR_ASSERT)
add_definitions(-DWITH_VERBOSE_WINPR_ASSERT)
endif()
if (FREERDP_UNIFIED_BUILD)
add_subdirectory(winpr)
if (WITH_WAYLAND)
add_subdirectory(uwac)
endif()
if (WITH_SERVER)
2021-12-01 11:58:24 +03:00
option(WITH_RDTK "build rdtk toolkit" ON)
if (WITH_RDTK)
add_subdirectory(rdtk)
endif()
endif()
2012-09-21 04:45:56 +04:00
include_directories(${PROJECT_SOURCE_DIR}/winpr/include)
include_directories(${PROJECT_BINARY_DIR}/winpr/include)
else()
find_package(WinPR 3 REQUIRED)
include_directories(${WinPR_INCLUDE_DIR})
2017-02-15 22:50:24 +03:00
endif()
2021-06-28 15:29:58 +03:00
# Include directories
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
# Sub-directories
if(WITH_THIRD_PARTY)
add_subdirectory(third-party)
if (NOT "${THIRD_PARTY_INCLUDES}" STREQUAL "")
include_directories(${THIRD_PARTY_INCLUDES})
endif()
endif()
2012-05-22 00:01:24 +04:00
add_subdirectory(libfreerdp)
if(BSD)
if(IS_DIRECTORY /usr/local/include)
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
endif()
if(OPENBSD)
if(IS_DIRECTORY /usr/X11R6/include)
include_directories(/usr/X11R6/include)
endif()
endif()
endif()
if(WITH_CHANNELS)
add_subdirectory(channels)
endif()
2015-11-04 11:53:13 +03:00
if(WITH_CLIENT_COMMON OR WITH_CLIENT)
add_subdirectory(client)
endif()
if(WITH_SERVER)
add_subdirectory(server)
endif()
# Packaging
set(CMAKE_CPACK_INCLUDE_FILE "CMakeCPack.cmake")
2013-01-31 03:54:08 +04:00
if(NOT (VENDOR MATCHES "FreeRDP"))
if(DEFINED CLIENT_VENDOR_PATH)
if(EXISTS "${PROJECT_SOURCE_DIR}/${CLIENT_VENDOR_PATH}/CMakeCPack.cmake")
set(CMAKE_CPACK_INCLUDE_FILE "${CLIENT_VENDOR_PATH}/CMakeCPack.cmake")
endif()
2012-11-12 22:17:44 +04:00
endif()
endif()
2013-09-10 22:46:48 +04:00
#message("VENDOR: ${VENDOR} CLIENT_VENDOR_PATH: ${CLIENT_VENDOR_PATH} CMAKE_CPACK_INCLUDE_FILE: ${CMAKE_CPACK_INCLUDE_FILE}")
set(FREERDP_BUILD_CONFIG_LIST "")
GET_CMAKE_PROPERTY(res VARIABLES)
FOREACH(var ${res})
IF (var MATCHES "^WITH_*|^BUILD_TESTING|^HAVE_*")
LIST(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}")
ENDIF()
ENDFOREACH()
string(REPLACE ";" " " FREERDP_BUILD_CONFIG "${FREERDP_BUILD_CONFIG_LIST}")
2022-04-20 15:40:51 +03:00
add_subdirectory(include)
include(${CMAKE_CPACK_INCLUDE_FILE})
message(STATUS "Intrinsic path configuration:")
#ShowCMakeVars("^CMAKE_INSTALL_PREFIX")
#ShowCMakeVars("^CMAKE_INSTALL_LIBDIR")
ShowCMakeVars("^FREERDP_INSTALL_PREFIX|^FREERDP_LIBRARY_PATH|^FREERDP_PLUGIN_PATH")
ShowCMakeVars("^FREERDP_ADDIN_PATH|^FREERDP_EXTENSION_PATH|^FREERDP_PROXY_PLUGINDIR")
2022-04-20 15:40:51 +03:00