2012-10-09 11:02:04 +08:00
|
|
|
# FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-03 01:58:55 +08: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>
|
2012-06-14 03:45:58 +08:00
|
|
|
# Copyright 2012 HP Development Company, LLC
|
2011-07-03 01:58:55 +08: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.
|
|
|
|
|
2023-02-25 16:12:22 +08:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
2012-10-04 21:42:23 +08:00
|
|
|
|
2024-02-13 22:48:33 +08:00
|
|
|
if(POLICY CMP0091)
|
|
|
|
cmake_policy(SET CMP0091 NEW)
|
|
|
|
endif()
|
2023-12-21 16:27:19 +08:00
|
|
|
project(FreeRDP
|
|
|
|
LANGUAGES C
|
|
|
|
)
|
2012-10-04 21:42:23 +08:00
|
|
|
|
2022-05-25 21:14:36 +08:00
|
|
|
set(CMAKE_C_STANDARD 11)
|
2022-02-24 19:19:10 +08:00
|
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_C_EXTENSIONS ON)
|
|
|
|
|
2023-06-01 00:55:26 +08:00
|
|
|
add_custom_target(fuzzers
|
2023-10-11 16:48:11 +08:00
|
|
|
COMMENT "Build fuzzers"
|
|
|
|
)
|
2023-06-01 00:55:26 +08:00
|
|
|
|
2013-09-10 10:25:47 +08:00
|
|
|
if(NOT DEFINED VENDOR)
|
|
|
|
set(VENDOR "FreeRDP" CACHE STRING "FreeRDP package vendor")
|
|
|
|
endif()
|
|
|
|
|
2015-06-02 15:07:17 +08:00
|
|
|
if(NOT DEFINED PRODUCT)
|
|
|
|
set(PRODUCT "FreeRDP" CACHE STRING "FreeRDP package name")
|
|
|
|
endif()
|
|
|
|
|
2014-05-10 00:25:05 +08:00
|
|
|
if(NOT DEFINED FREERDP_VENDOR)
|
|
|
|
set(FREERDP_VENDOR 1)
|
|
|
|
endif()
|
|
|
|
|
2023-05-31 20:54:38 +08:00
|
|
|
if (NOT WIN32 AND NOT ANDROID)
|
|
|
|
if (APPLE)
|
|
|
|
set(OPT_DEFAULT_VAL OFF)
|
|
|
|
else()
|
|
|
|
set(OPT_DEFAULT_VAL ON)
|
|
|
|
endif()
|
|
|
|
option(WITH_X11 "build X11 client/server" ${OPT_DEFAULT_VAL})
|
|
|
|
endif()
|
|
|
|
|
2024-11-14 20:33:14 +08:00
|
|
|
# Enable coverity related pragma definitions
|
|
|
|
if (COVERITY_BUILD)
|
|
|
|
add_compile_definitions(COVERITY_BUILD)
|
|
|
|
endif()
|
|
|
|
|
2012-11-23 22:12:52 +08:00
|
|
|
# Include our extra modules
|
2023-10-11 04:10:44 +08:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/)
|
2012-11-23 22:12:52 +08:00
|
|
|
|
|
|
|
# Check for cmake compatibility (enable/disable features)
|
|
|
|
include(CheckCmakeCompat)
|
|
|
|
|
2011-07-04 11:40:26 +08:00
|
|
|
# Include cmake modules
|
2018-01-10 17:54:24 +08:00
|
|
|
if(WITH_CLANG_FORMAT)
|
|
|
|
include(ClangFormat)
|
|
|
|
endif()
|
|
|
|
|
2023-10-11 20:05:18 +08:00
|
|
|
include(CompilerFlags)
|
2011-07-04 11:40:26 +08:00
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(CheckLibraryExists)
|
2015-01-29 12:50:12 +08:00
|
|
|
include(CheckSymbolExists)
|
2012-02-16 05:28:47 +08:00
|
|
|
include(CheckStructHasMember)
|
2011-07-04 11:40:26 +08:00
|
|
|
include(TestBigEndian)
|
2024-06-25 15:08:54 +08:00
|
|
|
include(CompilerDetect)
|
2011-07-04 11:40:26 +08:00
|
|
|
|
2012-11-03 07:27:01 +08:00
|
|
|
include(FindFeature)
|
2021-10-03 00:00:31 +08:00
|
|
|
include(ShowCMakeVars)
|
2011-07-04 17:01:06 +08:00
|
|
|
include(ConfigOptions)
|
2012-11-03 07:27:01 +08:00
|
|
|
include(FeatureSummary)
|
2011-09-20 11:02:07 +08:00
|
|
|
include(CheckCCompilerFlag)
|
2013-10-29 10:09:31 +08:00
|
|
|
include(CMakePackageConfigHelpers)
|
2017-01-16 18:34:32 +08:00
|
|
|
include(InstallFreeRDPMan)
|
2017-11-08 21:22:38 +08:00
|
|
|
include(GetGitRevisionDescription)
|
2018-05-02 23:32:26 +08:00
|
|
|
include(SetFreeRDPCMakeInstallDir)
|
2024-09-09 17:33:10 +08:00
|
|
|
include(Doxygen)
|
2011-07-03 03:44:40 +08:00
|
|
|
|
2012-01-15 02:33:04 +08:00
|
|
|
# Soname versioning
|
2014-10-09 22:16:47 +08:00
|
|
|
set(BUILD_NUMBER 0)
|
|
|
|
if ($ENV{BUILD_NUMBER})
|
2016-10-11 17:13:54 +08:00
|
|
|
set(BUILD_NUMBER $ENV{BUILD_NUMBER})
|
2014-10-09 22:16:47 +08:00
|
|
|
endif()
|
2017-11-08 21:22:38 +08:00
|
|
|
|
2023-05-02 15:18:30 +08:00
|
|
|
set(VERSION_REGEX "^(.*)([0-9]+)\\.([0-9]+)\\.([0-9]+)-?(.*)")
|
2024-10-14 21:00:00 +08:00
|
|
|
set(RAW_VERSION_STRING "3.9.1-dev0")
|
2021-06-21 17:39:34 +08:00
|
|
|
if(EXISTS "${PROJECT_SOURCE_DIR}/.source_tag")
|
|
|
|
file(READ ${PROJECT_SOURCE_DIR}/.source_tag RAW_VERSION_STRING)
|
2017-11-08 21:22:38 +08:00
|
|
|
elseif(USE_VERSION_FROM_GIT_TAG)
|
|
|
|
git_get_exact_tag(_GIT_TAG --tags --always)
|
|
|
|
if (NOT ${_GIT_TAG} STREQUAL "n/a")
|
2023-05-02 15:18:30 +08:00
|
|
|
string(REGEX MATCH ${VERSION_REGEX} FOUND_TAG "${_GIT_TAG}")
|
|
|
|
if (FOUND_TAG)
|
|
|
|
set(RAW_VERSION_STRING ${_GIT_TAG})
|
|
|
|
endif()
|
2017-11-08 21:22:38 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
2019-07-25 21:07:40 +08:00
|
|
|
string(STRIP ${RAW_VERSION_STRING} RAW_VERSION_STRING)
|
2017-11-08 21:22:38 +08:00
|
|
|
|
2022-09-14 17:16:01 +08:00
|
|
|
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 21:22:38 +08:00
|
|
|
|
2016-01-14 00:37:19 +08:00
|
|
|
set(FREERDP_API_VERSION "${FREERDP_VERSION_MAJOR}")
|
|
|
|
set(FREERDP_VERSION "${FREERDP_VERSION_MAJOR}.${FREERDP_VERSION_MINOR}.${FREERDP_VERSION_REVISION}")
|
2012-11-14 19:32:33 +08:00
|
|
|
if (FREERDP_VERSION_SUFFIX)
|
2012-11-19 00:07:33 +08:00
|
|
|
set(FREERDP_VERSION_FULL "${FREERDP_VERSION}-${FREERDP_VERSION_SUFFIX}")
|
2012-11-14 19:32:33 +08:00
|
|
|
else()
|
2012-11-19 00:07:33 +08:00
|
|
|
set(FREERDP_VERSION_FULL "${FREERDP_VERSION}")
|
2012-11-14 19:32:33 +08:00
|
|
|
endif()
|
2017-11-08 21:22:38 +08:00
|
|
|
message("FREERDP_VERSION=${FREERDP_VERSION_FULL}")
|
|
|
|
|
2022-03-03 18:16:50 +08: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)
|
2022-03-07 19:21:04 +08:00
|
|
|
set(GIT_REVISION ${FREERDP_VERSION})
|
2022-03-03 18:16:50 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
message(STATUS "Git Revision ${GIT_REVISION}")
|
|
|
|
|
2023-12-22 00:24:43 +08:00
|
|
|
# Make the detected version available as default version for all subprojects
|
|
|
|
set(FREERDP_DEFAULT_PROJECT_VERSION ${FREERDP_VERSION} CACHE STRING INTERNAL)
|
|
|
|
|
2023-04-22 17:07:59 +08:00
|
|
|
set(FREERDP_MAJOR_DIR "freerdp${FREERDP_VERSION_MAJOR}")
|
|
|
|
set(FREERDP_INCLUDE_DIR "include/${FREERDP_MAJOR_DIR}/")
|
2013-01-29 19:59:58 +08:00
|
|
|
|
2023-08-12 05:03:36 +08:00
|
|
|
option(WITH_SMARTCARD_EMULATE "Emulate smartcards instead of redirecting readers" ON)
|
2021-11-05 20:09:42 +08:00
|
|
|
if (WITH_SMARTCARD_EMULATE)
|
2022-03-03 18:16:50 +08:00
|
|
|
add_definitions(-DWITH_SMARTCARD_EMULATE)
|
|
|
|
find_package(ZLIB REQUIRED)
|
2021-11-05 20:09:42 +08:00
|
|
|
endif()
|
|
|
|
|
2021-06-22 20:39:10 +08:00
|
|
|
option(WITH_FREERDP_DEPRECATED "Build FreeRDP deprecated symbols" OFF)
|
|
|
|
if (WITH_FREERDP_DEPRECATED)
|
|
|
|
add_definitions(-DWITH_FREERDP_DEPRECATED)
|
|
|
|
endif()
|
|
|
|
|
2022-10-20 18:57:02 +08:00
|
|
|
option(WITH_FREERDP_DEPRECATED_COMMANDLINE "Build FreeRDP deprecated command line options" OFF)
|
|
|
|
if (WITH_FREERDP_DEPRECATED_COMMANDLINE)
|
2023-10-11 16:48:11 +08:00
|
|
|
add_definitions(-DWITH_FREERDP_DEPRECATED_COMMANDLINE)
|
2022-10-20 18:57:02 +08:00
|
|
|
endif()
|
|
|
|
|
2016-02-01 22:21:07 +08: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()
|
2013-01-29 19:59:58 +08:00
|
|
|
|
2017-10-06 19:52:10 +08:00
|
|
|
# Allow to search the host machine for git/ccache
|
2016-06-03 19:02:30 +08:00
|
|
|
if(CMAKE_CROSSCOMPILING)
|
2013-11-19 02:58:01 +08:00
|
|
|
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
|
2016-06-03 19:02:30 +08:00
|
|
|
endif(CMAKE_CROSSCOMPILING)
|
2016-02-01 22:21:07 +08:00
|
|
|
|
2017-01-25 16:05:27 +08:00
|
|
|
find_program(CCACHE ccache)
|
|
|
|
if(CCACHE AND WITH_CCACHE)
|
2021-06-10 15:54:35 +08:00
|
|
|
if(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER)
|
|
|
|
SET(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
|
|
|
|
endif(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER)
|
2017-01-25 16:05:27 +08:00
|
|
|
endif(CCACHE AND WITH_CCACHE)
|
|
|
|
|
2016-06-03 19:02:30 +08:00
|
|
|
if(CMAKE_CROSSCOMPILING)
|
2016-02-01 22:21:07 +08:00
|
|
|
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
2016-06-03 19:02:30 +08:00
|
|
|
endif(CMAKE_CROSSCOMPILING)
|
2017-10-06 19:52:10 +08:00
|
|
|
# /Allow to search the host machine for git/ccache
|
2013-01-29 19:59:58 +08:00
|
|
|
|
2012-10-01 10:58:59 +08:00
|
|
|
# Turn on solution folders (2.8.4+)
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
2024-10-23 20:20:26 +08:00
|
|
|
option(CTEST_OUTPUT_ON_FAILURE ON "show verbose output on CTest failures")
|
|
|
|
if(BUILD_TESTING_INTERNAL)
|
|
|
|
set(EXPORT_ALL_SYMBOLS ON CACHE BOOL "testing default" FORCE)
|
|
|
|
add_definitions(-DBUILD_TESTING_INTERNAL)
|
|
|
|
elseif(BUILD_TESTING)
|
|
|
|
set(EXPORT_ALL_SYMBOLS OFF CACHE BOOL "testing default" FORCE)
|
|
|
|
else()
|
|
|
|
option(EXPORT_ALL_SYMBOLS "Export all symbols form library" OFF)
|
2012-10-19 10:05:06 +08:00
|
|
|
endif()
|
|
|
|
|
2016-08-02 17:46:11 +08:00
|
|
|
if (EXPORT_ALL_SYMBOLS)
|
2022-09-26 17:22:02 +08:00
|
|
|
# set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|
|
|
add_definitions(-DEXPORT_ALL_SYMBOLS)
|
2016-08-02 17:46:11 +08:00
|
|
|
endif(EXPORT_ALL_SYMBOLS)
|
|
|
|
|
2011-08-11 15:03:08 +08:00
|
|
|
# Compiler-specific flags
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
2013-01-25 21:27:47 +08:00
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686")
|
2015-01-29 12:50:12 +08:00
|
|
|
CHECK_SYMBOL_EXISTS(__x86_64__ "" IS_X86_64)
|
|
|
|
if(IS_X86_64)
|
2013-04-30 04:37:11 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
|
|
|
else()
|
2013-01-25 21:27:47 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")
|
|
|
|
endif()
|
2012-12-18 22:11:04 +08:00
|
|
|
endif()
|
2013-09-20 00:08:20 +08:00
|
|
|
|
2011-09-20 11:02:07 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
2014-03-13 01:55:38 +08:00
|
|
|
|
2012-10-19 10:05:06 +08:00
|
|
|
if(NOT EXPORT_ALL_SYMBOLS)
|
|
|
|
message(STATUS "GCC default symbol visibility: hidden")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
|
|
|
|
endif()
|
2015-03-04 02:25:42 +08:00
|
|
|
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()
|
2015-04-22 21:19:04 +08:00
|
|
|
|
|
|
|
if (NOT OPENBSD)
|
|
|
|
CHECK_C_COMPILER_FLAG (-Wredundant-decls Wredundant-decls)
|
|
|
|
if(Wredundant-decls)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls")
|
|
|
|
endif()
|
2015-03-04 02:25:42 +08:00
|
|
|
endif()
|
2011-08-25 10:53:06 +08:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
2016-08-10 16:29:02 +08:00
|
|
|
add_definitions(-DNDEBUG)
|
2016-10-12 17:24:29 +08:00
|
|
|
else()
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
|
|
|
|
endif()
|
|
|
|
endif()
|
2014-04-30 18:11:28 +08:00
|
|
|
|
2020-07-06 19:51:08 +08:00
|
|
|
set(THREAD_PREFER_PTHREAD_FLAG TRUE)
|
|
|
|
|
|
|
|
if(NOT IOS)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2015-12-21 15:00:14 +08:00
|
|
|
# Enable address sanitizer, where supported and when required
|
2024-06-25 15:08:54 +08:00
|
|
|
if(CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCC)
|
2020-07-06 19:51:08 +08:00
|
|
|
set(CMAKE_REQUIRED_LINK_OPTIONS_SAVED ${CMAKE_REQUIRED_LINK_OPTIONS})
|
2021-06-21 17:39:34 +08:00
|
|
|
file(WRITE ${PROJECT_BINARY_DIR}/foo.txt "")
|
2015-12-21 15:00:14 +08:00
|
|
|
if(WITH_SANITIZE_ADDRESS)
|
2020-07-06 19:51:08 +08:00
|
|
|
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=address")
|
|
|
|
CHECK_C_COMPILER_FLAG ("-fsanitize=address" fsanitize-address)
|
2021-06-21 17:39:34 +08:00
|
|
|
CHECK_C_COMPILER_FLAG ("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist)
|
2018-04-12 17:49:43 +08:00
|
|
|
CHECK_C_COMPILER_FLAG ("-fsanitize-address-use-after-scope" fsanitize-address-use-after-scope)
|
2016-10-11 01:17:21 +08:00
|
|
|
|
2020-07-03 17:06:30 +08: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 17:49:43 +08:00
|
|
|
|
2020-07-03 17:06:30 +08:00
|
|
|
if(fsanitize-blacklist)
|
2021-06-21 17:39:34 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-address-sanitizer.txt")
|
2020-07-03 17:06:30 +08:00
|
|
|
endif(fsanitize-blacklist)
|
2018-04-12 17:49:43 +08:00
|
|
|
|
2020-07-03 17:06:30 +08: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-11 01:17:21 +08:00
|
|
|
elseif(WITH_SANITIZE_MEMORY)
|
2020-07-06 19:51:08 +08:00
|
|
|
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=memory")
|
|
|
|
CHECK_C_COMPILER_FLAG ("-fsanitize=memory" fsanitize-memory)
|
2021-06-21 17:39:34 +08:00
|
|
|
CHECK_C_COMPILER_FLAG ("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist)
|
2018-04-12 17:49:43 +08: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)
|
2015-12-21 15:00:14 +08:00
|
|
|
|
2020-07-03 17:06:30 +08:00
|
|
|
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 17:49:43 +08:00
|
|
|
|
2020-07-03 17:06:30 +08:00
|
|
|
if(fsanitize-blacklist)
|
2021-06-21 17:39:34 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-memory-sanitizer.txt")
|
2020-07-03 17:06:30 +08:00
|
|
|
endif(fsanitize-blacklist)
|
2018-04-12 17:49:43 +08:00
|
|
|
|
2020-07-03 17:06:30 +08: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 17:49:43 +08:00
|
|
|
|
2020-07-03 17:06:30 +08:00
|
|
|
if (fsanitize-memory-track-origins)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-memory-track-origins")
|
|
|
|
endif(fsanitize-memory-track-origins)
|
2016-10-11 01:17:21 +08:00
|
|
|
elseif(WITH_SANITIZE_THREAD)
|
2020-07-06 19:51:08 +08:00
|
|
|
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-fsanitize=thread")
|
|
|
|
CHECK_C_COMPILER_FLAG ("-fsanitize=thread" fsanitize-thread)
|
2021-06-21 17:39:34 +08:00
|
|
|
CHECK_C_COMPILER_FLAG ("-fsanitize-blacklist=${PROJECT_BINARY_DIR}/foo.txt" fsanitize-blacklist)
|
2020-07-06 19:51:08 +08:00
|
|
|
|
2020-07-03 17:06:30 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread")
|
|
|
|
if(fsanitize-blacklist)
|
2021-06-21 17:39:34 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist-thread-sanitizer.txt")
|
2020-07-03 17:06:30 +08:00
|
|
|
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")
|
2015-12-21 15:00:14 +08:00
|
|
|
endif()
|
2016-10-10 15:29:09 +08:00
|
|
|
|
2021-06-21 17:39:34 +08:00
|
|
|
file(REMOVE ${PROJECT_BINARY_DIR}/foo.txt)
|
2020-07-06 19:51:08 +08:00
|
|
|
set(CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS_SAVED})
|
2018-04-12 17:49:43 +08:00
|
|
|
|
2016-04-19 20:33:26 +08:00
|
|
|
if (WITH_NO_UNDEFINED)
|
|
|
|
CHECK_C_COMPILER_FLAG (-Wl,--no-undefined no-undefined)
|
2018-04-12 17:49:43 +08:00
|
|
|
|
2016-04-19 20:33:26 +08:00
|
|
|
if(no-undefined)
|
2020-07-03 17:06:30 +08:00
|
|
|
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined" )
|
2016-04-19 20:33:26 +08:00
|
|
|
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
|
|
|
|
endif()
|
|
|
|
endif()
|
2015-12-21 15:00:14 +08:00
|
|
|
endif()
|
|
|
|
|
2011-08-17 02:41:12 +08:00
|
|
|
if(MSVC)
|
2012-09-03 22:47:45 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd")
|
2014-02-10 13:34:17 +08:00
|
|
|
|
|
|
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
|
|
|
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
2013-07-25 03:36:15 +08:00
|
|
|
|
2016-02-01 22:21:07 +08:00
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
|
|
else()
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi")
|
|
|
|
endif()
|
2013-07-25 03:36:15 +08:00
|
|
|
|
2023-07-28 04:34:45 +08:00
|
|
|
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
2011-08-17 02:41:12 +08:00
|
|
|
endif()
|
|
|
|
|
2021-05-27 23:51:21 +08:00
|
|
|
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 11:08:16 +08:00
|
|
|
if(WIN32)
|
2016-08-10 16:29:02 +08: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)
|
2014-07-18 03:11:04 +08:00
|
|
|
|
2022-02-17 23:17:01 +08:00
|
|
|
set(CMAKE_DL_LIBS "")
|
2015-08-19 15:02:20 +08:00
|
|
|
set(CMAKE_USE_RELATIVE_PATH ON)
|
2015-10-06 04:23:44 +08:00
|
|
|
string(TIMESTAMP RC_VERSION_YEAR "%Y")
|
2014-10-03 21:17:40 +08:00
|
|
|
|
2014-07-18 03:11:04 +08:00
|
|
|
if(NOT DEFINED CMAKE_WINDOWS_VERSION)
|
2020-04-09 14:17:46 +08:00
|
|
|
set(CMAKE_WINDOWS_VERSION "WIN7")
|
2014-07-18 03:11:04 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_WINDOWS_VERSION STREQUAL "WINXP")
|
2016-08-10 16:29:02 +08:00
|
|
|
add_definitions(-DWINVER=0x0501 -D_WIN32_WINNT=0x0501)
|
2014-07-18 03:11:04 +08:00
|
|
|
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN7")
|
2016-08-10 16:29:02 +08:00
|
|
|
add_definitions(-DWINVER=0x0601 -D_WIN32_WINNT=0x0601)
|
2014-07-18 03:11:04 +08:00
|
|
|
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN8")
|
2016-08-10 16:29:02 +08:00
|
|
|
add_definitions(-DWINVER=0x0602 -D_WIN32_WINNT=0x0602)
|
2016-03-30 04:03:15 +08:00
|
|
|
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN10")
|
2016-08-10 16:29:02 +08:00
|
|
|
add_definitions(-DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00)
|
2014-07-18 03:11:04 +08:00
|
|
|
endif()
|
2015-02-23 23:48:07 +08:00
|
|
|
|
2018-11-28 23:09:38 +08: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 14:17:46 +08:00
|
|
|
set(RC_VERSION_DESCRIPTION "${FREERDP_VERSION_FULL} ${GIT_REVISION} ${CMAKE_WINDOWS_VERSION} ${CMAKE_SYSTEM_PROCESSOR}")
|
2018-11-28 23:09:38 +08:00
|
|
|
|
2014-09-26 17:16:04 +08:00
|
|
|
if (FREERDP_EXTERNAL_SSL_PATH)
|
|
|
|
set(OPENSSL_ROOT_DIR ${FREERDP_EXTERNAL_SSL_PATH})
|
|
|
|
endif()
|
2013-04-09 11:08:16 +08:00
|
|
|
endif()
|
|
|
|
|
2021-06-10 15:54:35 +08:00
|
|
|
add_definitions(-DFREERDP_EXPORTS)
|
2014-02-03 11:37:54 +08:00
|
|
|
|
2011-11-16 12:21:53 +08:00
|
|
|
# Mac OS X
|
|
|
|
if(APPLE)
|
2013-09-24 07:41:18 +08: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)
|
2013-08-09 04:10:23 +08:00
|
|
|
|
2013-09-11 22:36:38 +08:00
|
|
|
# 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 22:21:07 +08:00
|
|
|
# if(WITH_CLANG)
|
|
|
|
# set(CMAKE_C_COMPILER "clang")
|
|
|
|
# endif()
|
2013-06-12 02:56:43 +08:00
|
|
|
|
2013-09-24 07:41:18 +08:00
|
|
|
if (WITH_VERBOSE)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -v")
|
|
|
|
endif()
|
|
|
|
endif(APPLE)
|
2011-11-16 12:21:53 +08:00
|
|
|
|
2013-01-29 19:59:58 +08:00
|
|
|
# Android
|
|
|
|
if(ANDROID)
|
2016-10-11 17:13:54 +08:00
|
|
|
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${ANDROID_LIBRARY_USE_LIB64_PATHS} )
|
2016-06-03 19:02:30 +08:00
|
|
|
|
2016-02-01 22:21:07 +08:00
|
|
|
if (${ANDROID_ABI} STREQUAL "armeabi")
|
|
|
|
set (WITH_NEON OFF)
|
|
|
|
endif()
|
2014-04-29 15:42:18 +08:00
|
|
|
|
2021-05-31 03:15:44 +08:00
|
|
|
if(ANDROID_ABI STREQUAL arm64-v8a)
|
2024-08-29 15:25:00 +08:00
|
|
|
include (CheckCCompilerFlag)
|
|
|
|
check_c_compiler_flag("-mfloat-abi=softfp" ABI_SOFTFP_SUPPORTED)
|
|
|
|
|
|
|
|
if (ABI_SOFTFP_SUPPORTED)
|
|
|
|
# https://github.com/android/ndk/issues/910
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=softfp")
|
|
|
|
endif()
|
2021-05-31 03:15:44 +08:00
|
|
|
endif()
|
|
|
|
|
2013-09-23 18:39:41 +08:00
|
|
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
|
|
|
add_definitions(-DNDK_DEBUG=1)
|
2013-11-08 23:32:50 +08:00
|
|
|
|
|
|
|
# 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 18:39:41 +08:00
|
|
|
endif()
|
2013-09-23 23:48:02 +08:00
|
|
|
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -llog")
|
2013-11-21 16:45:35 +08:00
|
|
|
|
2021-05-27 23:51:21 +08:00
|
|
|
# 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 22:21:07 +08: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 06:13:10 +08:00
|
|
|
else()
|
2016-02-01 22:21:07 +08:00
|
|
|
message(STATUS "FREERDP_EXTERNAL_PATH not set!")
|
2013-09-18 18:50:10 +08:00
|
|
|
endif()
|
2013-01-29 19:59:58 +08:00
|
|
|
endif()
|
2013-11-21 16:45:35 +08:00
|
|
|
|
2020-04-09 14:17:46 +08:00
|
|
|
list (APPEND CMAKE_INCLUDE_PATH ${FREERDP_EXTERNAL_PATH}/${ANDROID_ABI}/include)
|
2016-02-01 22:21:07 +08: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 )
|
|
|
|
|
2013-11-18 19:50:32 +08:00
|
|
|
if (WITH_GPROF)
|
2021-06-21 17:39:34 +08:00
|
|
|
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/scripts/gprof_generate.sh.cmake
|
|
|
|
${PROJECT_BINARY_DIR}/scripts/gprof_generate.sh @ONLY)
|
2013-11-18 19:50:32 +08:00
|
|
|
endif(WITH_GPROF)
|
2013-01-29 19:59:58 +08:00
|
|
|
endif()
|
|
|
|
|
2014-05-13 00:01:29 +08:00
|
|
|
if(WITH_VALGRIND_MEMCHECK)
|
2023-10-11 16:48:11 +08:00
|
|
|
check_include_files(valgrind/memcheck.h FREERDP_HAVE_VALGRIND_MEMCHECK_H)
|
2014-05-13 00:01:29 +08:00
|
|
|
else()
|
2023-10-11 16:48:11 +08:00
|
|
|
unset(FREERDP_HAVE_VALGRIND_MEMCHECK_H CACHE)
|
2014-05-13 00:01:29 +08:00
|
|
|
endif()
|
|
|
|
|
2024-01-05 21:23:13 +08:00
|
|
|
if(UNIX OR CYGWIN)
|
2014-10-13 17:43:16 +08:00
|
|
|
set(WAYLAND_FEATURE_TYPE "RECOMMENDED")
|
2012-11-03 07:27:01 +08:00
|
|
|
else()
|
2014-10-13 17:43:16 +08:00
|
|
|
set(WAYLAND_FEATURE_TYPE "DISABLED")
|
2012-10-14 08:31:01 +08:00
|
|
|
endif()
|
|
|
|
|
2014-04-28 05:38:45 +08:00
|
|
|
if(WITH_PCSC_WINPR)
|
|
|
|
find_package(PCSCWinPR)
|
|
|
|
endif()
|
2014-04-08 13:26:28 +08:00
|
|
|
|
2014-10-13 17:43:16 +08:00
|
|
|
set(WAYLAND_FEATURE_PURPOSE "Wayland")
|
|
|
|
set(WAYLAND_FEATURE_DESCRIPTION "Wayland client")
|
|
|
|
|
2012-11-03 07:27:01 +08:00
|
|
|
set(OPENSSL_FEATURE_TYPE "REQUIRED")
|
|
|
|
set(OPENSSL_FEATURE_PURPOSE "cryptography")
|
|
|
|
set(OPENSSL_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions")
|
|
|
|
|
2015-09-16 08:52:46 +08:00
|
|
|
set(MBEDTLS_FEATURE_TYPE "OPTIONAL")
|
|
|
|
set(MBEDTLS_FEATURE_PURPOSE "cryptography")
|
|
|
|
set(MBEDTLS_FEATURE_DESCRIPTION "encryption, certificate validation, hashing functions")
|
|
|
|
|
2020-02-25 23:38:31 +08:00
|
|
|
set(PCSC_FEATURE_TYPE "RECOMMENDED")
|
2012-11-03 07:27:01 +08:00
|
|
|
set(PCSC_FEATURE_PURPOSE "smart card")
|
|
|
|
set(PCSC_FEATURE_DESCRIPTION "smart card device redirection")
|
|
|
|
|
2014-07-02 11:28:09 +08:00
|
|
|
set(OPENH264_FEATURE_TYPE "OPTIONAL")
|
|
|
|
set(OPENH264_FEATURE_PURPOSE "codec")
|
|
|
|
set(OPENH264_FEATURE_DESCRIPTION "use OpenH264 library")
|
|
|
|
|
2018-01-29 23:20:59 +08:00
|
|
|
set(OPENCL_FEATURE_TYPE "OPTIONAL")
|
|
|
|
set(OPENCL_FEATURE_PURPOSE "codec")
|
|
|
|
set(OPENCL_FEATURE_DESCRIPTION "use OpenCL library")
|
|
|
|
|
2013-11-23 01:11:39 +08:00
|
|
|
set(GSM_FEATURE_TYPE "OPTIONAL")
|
|
|
|
set(GSM_FEATURE_PURPOSE "codec")
|
|
|
|
set(GSM_FEATURE_DESCRIPTION "GSM audio codec library")
|
|
|
|
|
2018-02-20 19:15:30 +08:00
|
|
|
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")
|
|
|
|
|
2018-11-13 16:13:52 +08:00
|
|
|
set(SOXR_FEATURE_TYPE "OPTIONAL")
|
|
|
|
set(SOXR_FEATURE_PURPOSE "codec")
|
|
|
|
set(SOXR_FEATURE_DESCRIPTION "SOX audio resample library")
|
|
|
|
|
2012-11-03 07:27:01 +08:00
|
|
|
if(WIN32)
|
2014-10-13 17:43:16 +08:00
|
|
|
set(WAYLAND_FEATURE_TYPE "DISABLED")
|
2012-11-03 07:27:01 +08:00
|
|
|
set(PCSC_FEATURE_TYPE "DISABLED")
|
2011-08-16 05:05:48 +08:00
|
|
|
endif()
|
2011-07-31 09:22:09 +08:00
|
|
|
|
2012-11-03 07:27:01 +08:00
|
|
|
if(APPLE)
|
2014-10-13 17:43:16 +08:00
|
|
|
set(WAYLAND_FEATURE_TYPE "DISABLED")
|
2013-02-14 21:59:12 +08:00
|
|
|
if(IOS)
|
|
|
|
set(PCSC_FEATURE_TYPE "DISABLED")
|
|
|
|
endif()
|
2012-11-03 07:27:01 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ANDROID)
|
2014-10-13 17:43:16 +08:00
|
|
|
set(WAYLAND_FEATURE_TYPE "DISABLED")
|
2012-11-03 07:27:01 +08:00
|
|
|
set(PCSC_FEATURE_TYPE "DISABLED")
|
|
|
|
endif()
|
|
|
|
|
2014-10-13 17:43:16 +08:00
|
|
|
find_feature(Wayland ${WAYLAND_FEATURE_TYPE} ${WAYLAND_FEATURE_PURPOSE} ${WAYLAND_FEATURE_DESCRIPTION})
|
2012-11-03 07:27:01 +08:00
|
|
|
|
2023-12-21 06:30:24 +08:00
|
|
|
option(WITH_LIBRESSL "build with LibreSSL" OFF)
|
|
|
|
if (WITH_LIBRESSL)
|
|
|
|
find_package(LibreSSL REQUIRED)
|
2024-10-23 20:20:26 +08:00
|
|
|
include_directories(SYSTEM ${LibreSSL_INCLUDE_DIRS})
|
2023-12-21 06:30:24 +08:00
|
|
|
set(OPENSSL_INCLUDE_DIR ${LIBRESSL_INCLUDE_DIR})
|
|
|
|
set(OPENSSL_LIBRARIES ${LIBRESSL_LIBRARIES})
|
|
|
|
set(OPENSSL_CRYPTO_LIBRARIES ${LIBRESSL_LIBRARIES})
|
|
|
|
set(WITH_OPENSSL ON)
|
|
|
|
set(OPENSSL_FOUND ON)
|
|
|
|
add_definitions("-DWITH_LIBRESSL")
|
|
|
|
add_definitions("-DWITH_OPENSSL")
|
|
|
|
else()
|
|
|
|
find_feature(OpenSSL ${OPENSSL_FEATURE_TYPE} ${OPENSSL_FEATURE_PURPOSE} ${OPENSSL_FEATURE_DESCRIPTION})
|
|
|
|
find_feature(MbedTLS ${MBEDTLS_FEATURE_TYPE} ${MBEDTLS_FEATURE_PURPOSE} ${MBEDTLS_FEATURE_DESCRIPTION})
|
|
|
|
endif()
|
2012-11-03 07:27:01 +08:00
|
|
|
|
|
|
|
find_feature(PCSC ${PCSC_FEATURE_TYPE} ${PCSC_FEATURE_PURPOSE} ${PCSC_FEATURE_DESCRIPTION})
|
|
|
|
|
2022-07-05 23:30:35 +08:00
|
|
|
if (WITH_DSP_FFMPEG OR WITH_VIDEO_FFMPEG OR WITH_FFMPEG)
|
2024-09-09 18:20:06 +08:00
|
|
|
find_package(FFmpeg REQUIRED COMPONENTS AVUTIL AVCODEC)
|
2022-07-05 23:30:35 +08:00
|
|
|
endif()
|
|
|
|
|
2014-07-02 11:28:09 +08:00
|
|
|
find_feature(OpenH264 ${OPENH264_FEATURE_TYPE} ${OPENH264_FEATURE_PURPOSE} ${OPENH264_FEATURE_DESCRIPTION})
|
2018-01-29 23:20:59 +08:00
|
|
|
find_feature(OpenCL ${OPENCL_FEATURE_TYPE} ${OPENCL_FEATURE_PURPOSE} ${OPENCL_FEATURE_DESCRIPTION})
|
2013-11-23 01:11:39 +08:00
|
|
|
find_feature(GSM ${GSM_FEATURE_TYPE} ${GSM_FEATURE_PURPOSE} ${GSM_FEATURE_DESCRIPTION})
|
2018-02-20 19:15:30 +08:00
|
|
|
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})
|
2018-11-13 16:13:52 +08:00
|
|
|
find_feature(soxr ${SOXR_FEATURE_TYPE} ${SOXR_FEATURE_PURPOSE} ${SOXR_FEATURE_DESCRIPTION})
|
2017-05-12 00:51:45 +08:00
|
|
|
|
2019-01-11 18:40:31 +08:00
|
|
|
if (WITH_OPENH264 AND NOT WITH_OPENH264_LOADING)
|
2019-10-07 15:31:20 +08:00
|
|
|
option(WITH_OPENH264_LOADING "Use LoadLibrary to load openh264 at runtime" OFF)
|
2019-01-11 18:40:31 +08:00
|
|
|
endif (WITH_OPENH264 AND NOT WITH_OPENH264_LOADING)
|
|
|
|
|
2018-08-09 15:58:56 +08:00
|
|
|
# Version check, if we have detected FFMPEG but the version is too old
|
|
|
|
# deactivate it as sound backend.
|
|
|
|
if (WITH_DSP_FFMPEG)
|
2018-09-05 20:19:57 +08:00
|
|
|
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")
|
2018-08-09 15:58:56 +08:00
|
|
|
set(WITH_DSP_FFMPEG OFF)
|
|
|
|
endif()
|
|
|
|
endif (WITH_DSP_FFMPEG)
|
|
|
|
|
2018-05-30 18:13:24 +08:00
|
|
|
if (WITH_OPENH264 AND NOT OPENH264_FOUND)
|
2018-05-28 21:30:50 +08:00
|
|
|
message(FATAL_ERROR "OpenH264 support requested but not detected")
|
|
|
|
endif()
|
2018-05-30 18:13:24 +08:00
|
|
|
set(WITH_OPENH264 ${OPENH264_FOUND})
|
2018-05-28 21:30:50 +08:00
|
|
|
|
2015-10-06 04:23:44 +08:00
|
|
|
if(OPENSSL_FOUND)
|
|
|
|
add_definitions("-DWITH_OPENSSL")
|
2016-11-22 00:28:54 +08:00
|
|
|
message(STATUS "Using OpenSSL Version: ${OPENSSL_VERSION}")
|
2024-10-23 20:20:26 +08:00
|
|
|
include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})
|
2023-12-16 04:59:36 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(MBEDTLS_FOUND)
|
2015-10-06 04:23:44 +08:00
|
|
|
add_definitions("-DWITH_MBEDTLS")
|
|
|
|
endif()
|
|
|
|
|
2022-07-05 23:30:35 +08:00
|
|
|
if (WITH_OPENH264 OR WITH_MEDIA_FOUNDATION OR WITH_VIDEO_FFMPEG OR WITH_MEDIACODEC)
|
2017-07-18 22:17:37 +08:00
|
|
|
set(WITH_GFX_H264 ON)
|
|
|
|
else()
|
|
|
|
set(WITH_GFX_H264 OFF)
|
|
|
|
endif()
|
|
|
|
|
2016-11-10 17:18:55 +08:00
|
|
|
# Android expects all libraries to be loadable
|
|
|
|
# without paths.
|
2019-09-10 18:21:40 +08:00
|
|
|
if (ANDROID OR WIN32 OR MAC_BUNDLE)
|
2024-01-25 18:39:49 +08:00
|
|
|
set(PLUGIN_ABS_PATHS_DEFAULT OFF)
|
|
|
|
else()
|
|
|
|
set(PLUGIN_ABS_PATHS_DEFAULT ON)
|
|
|
|
endif()
|
|
|
|
option(WITH_ABSOLUTE_PLUGIN_LOAD_PATHS "Load plugins with absolute paths" ${PLUGIN_ABS_PATHS_DEFAULT})
|
|
|
|
|
|
|
|
if (NOT WITH_ABSOLUTE_PLUGIN_LOAD_PATHS)
|
2019-08-21 18:21:12 +08:00
|
|
|
set(FREERDP_DATA_PATH "share")
|
2020-03-18 20:59:43 +08:00
|
|
|
if (NOT FREERDP_INSTALL_PREFIX)
|
2020-04-09 14:17:46 +08:00
|
|
|
set(FREERDP_INSTALL_PREFIX ".")
|
2020-03-18 20:59:43 +08:00
|
|
|
endif()
|
2019-08-21 18:21:12 +08:00
|
|
|
set(FREERDP_LIBRARY_PATH ".")
|
|
|
|
set(FREERDP_PLUGIN_PATH ".")
|
2019-06-26 15:56:16 +08:00
|
|
|
else()
|
2023-04-22 17:07:59 +08:00
|
|
|
set(FREERDP_DATA_PATH "${CMAKE_INSTALL_PREFIX}/share/${FREERDP_MAJOR_DIR}")
|
2020-04-09 14:17:46 +08:00
|
|
|
if (NOT FREERDP_INSTALL_PREFIX)
|
|
|
|
set(FREERDP_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
|
|
|
endif()
|
2016-11-10 17:18:55 +08:00
|
|
|
set(FREERDP_LIBRARY_PATH "${CMAKE_INSTALL_LIBDIR}")
|
2024-01-25 18:39:49 +08:00
|
|
|
if (WIN32)
|
|
|
|
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_BINDIR}/${FREERDP_MAJOR_DIR}")
|
|
|
|
else()
|
|
|
|
set(FREERDP_PLUGIN_PATH "${CMAKE_INSTALL_LIBDIR}/${FREERDP_MAJOR_DIR}")
|
|
|
|
endif()
|
2019-06-26 15:56:16 +08:00
|
|
|
endif()
|
2019-08-21 18:21:12 +08:00
|
|
|
set(FREERDP_ADDIN_PATH "${FREERDP_PLUGIN_PATH}")
|
2011-07-08 14:28:52 +08:00
|
|
|
|
2012-07-03 15:51:00 +08:00
|
|
|
# Path to put extensions
|
2023-04-22 17:07:59 +08:00
|
|
|
set(FREERDP_EXTENSION_POSTFIX "${FREERDP_MAJOR_DIR}/extensions")
|
|
|
|
set(FREERDP_EXTENSION_REL_PATH "${CMAKE_INSTALL_LIBDIR}/${FREERDP_EXTENSION_POSTFIX}")
|
|
|
|
set(FREERDP_EXTENSION_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/${FREERDP_EXTENSION_POSTFIX}")
|
2012-07-03 15:51:00 +08:00
|
|
|
|
2019-12-31 17:16:12 +08:00
|
|
|
# Proxy plugins path
|
|
|
|
if(NOT DEFINED PROXY_PLUGINDIR)
|
|
|
|
message("using default plugins location")
|
2021-08-24 18:50:13 +08:00
|
|
|
set(FREERDP_PROXY_PLUGINDIR "${FREERDP_PLUGIN_PATH}/proxy/")
|
2019-12-31 17:16:12 +08:00
|
|
|
else()
|
|
|
|
set(FREERDP_PROXY_PLUGINDIR "${PROXY_PLUGINDIR}")
|
|
|
|
endif()
|
|
|
|
|
2013-09-18 18:50:10 +08:00
|
|
|
# Android profiling
|
|
|
|
if(ANDROID)
|
2013-09-18 19:12:52 +08:00
|
|
|
if(WITH_GPROF)
|
2013-09-18 18:50:10 +08:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
|
|
|
|
set(PROFILER_LIBRARIES
|
2013-11-21 16:45:35 +08:00
|
|
|
"${FREERDP_EXTERNAL_PROFILER_PATH}/obj/local/${ANDROID_ABI}/libandroid-ndk-profiler.a")
|
2024-10-23 20:20:26 +08:00
|
|
|
include_directories(SYSTEM "${FREERDP_EXTERNAL_PROFILER_PATH}")
|
2013-09-18 18:50:10 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2012-10-01 08:15:42 +08:00
|
|
|
# Unit Tests
|
|
|
|
|
2012-10-30 03:02:35 +08:00
|
|
|
include(CTest)
|
2012-10-01 08:15:42 +08:00
|
|
|
|
2024-10-23 20:20:26 +08:00
|
|
|
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
|
2016-10-11 17:13:54 +08:00
|
|
|
enable_testing()
|
2015-02-23 23:48:07 +08:00
|
|
|
|
2012-10-19 09:11:12 +08:00
|
|
|
if(MSVC)
|
2021-06-21 17:39:34 +08:00
|
|
|
set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
2012-10-19 09:11:12 +08:00
|
|
|
else()
|
2021-06-21 17:39:34 +08:00
|
|
|
set(TESTING_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Testing")
|
2012-10-19 09:11:12 +08:00
|
|
|
endif()
|
2012-10-01 08:15:42 +08:00
|
|
|
endif()
|
|
|
|
|
2024-03-12 02:45:11 +08:00
|
|
|
include(CommonConfigOptions)
|
|
|
|
|
2021-06-10 15:54:35 +08:00
|
|
|
if (FREERDP_UNIFIED_BUILD)
|
|
|
|
add_subdirectory(winpr)
|
|
|
|
if (WITH_WAYLAND)
|
|
|
|
add_subdirectory(uwac)
|
|
|
|
endif()
|
|
|
|
if (WITH_SERVER)
|
2021-12-01 16:58:24 +08:00
|
|
|
option(WITH_RDTK "build rdtk toolkit" ON)
|
|
|
|
if (WITH_RDTK)
|
|
|
|
add_subdirectory(rdtk)
|
|
|
|
endif()
|
2021-06-10 15:54:35 +08:00
|
|
|
endif()
|
2012-09-21 08:45:56 +08:00
|
|
|
|
2021-06-21 17:39:34 +08:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/winpr/include)
|
|
|
|
include_directories(${PROJECT_BINARY_DIR}/winpr/include)
|
2016-03-25 23:28:17 +08:00
|
|
|
else()
|
2021-06-10 15:54:35 +08:00
|
|
|
find_package(WinPR 3 REQUIRED)
|
2024-10-23 20:20:26 +08:00
|
|
|
include_directories(SYSTEM ${WinPR_INCLUDE_DIR})
|
2017-02-16 03:50:24 +08:00
|
|
|
endif()
|
|
|
|
|
2024-05-14 23:41:06 +08:00
|
|
|
option(WITH_AAD "Compile with support for Azure AD authentication" ${WITH_WINPR_JSON})
|
|
|
|
|
2021-06-28 20:29:58 +08:00
|
|
|
# Include directories
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
|
|
|
2011-07-04 11:40:26 +08:00
|
|
|
# Sub-directories
|
2012-08-14 11:19:51 +08:00
|
|
|
|
2013-04-04 18:28:52 +08:00
|
|
|
if(WITH_THIRD_PARTY)
|
|
|
|
add_subdirectory(third-party)
|
|
|
|
if (NOT "${THIRD_PARTY_INCLUDES}" STREQUAL "")
|
2024-10-23 20:20:26 +08:00
|
|
|
include_directories(SYSTEM ${THIRD_PARTY_INCLUDES})
|
2013-04-04 18:28:52 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2012-05-22 04:01:24 +08:00
|
|
|
|
2012-08-14 11:19:51 +08:00
|
|
|
add_subdirectory(libfreerdp)
|
2011-08-17 11:54:42 +08:00
|
|
|
|
2015-03-28 08:08:36 +08:00
|
|
|
if(WITH_CHANNELS)
|
|
|
|
add_subdirectory(channels)
|
|
|
|
endif()
|
|
|
|
|
2015-11-04 16:53:13 +08:00
|
|
|
if(WITH_CLIENT_COMMON OR WITH_CLIENT)
|
|
|
|
add_subdirectory(client)
|
2012-01-23 01:14:06 +08:00
|
|
|
endif()
|
|
|
|
|
2012-01-23 01:26:30 +08:00
|
|
|
if(WITH_SERVER)
|
2012-01-23 01:14:06 +08:00
|
|
|
add_subdirectory(server)
|
2013-10-30 02:47:40 +08:00
|
|
|
endif()
|
2013-10-29 10:09:31 +08:00
|
|
|
|
2012-10-17 09:57:43 +08:00
|
|
|
# Packaging
|
|
|
|
|
2013-09-10 10:25:47 +08:00
|
|
|
set(CMAKE_CPACK_INCLUDE_FILE "CMakeCPack.cmake")
|
2013-01-31 07:54:08 +08:00
|
|
|
|
2013-09-10 10:25:47 +08:00
|
|
|
if(NOT (VENDOR MATCHES "FreeRDP"))
|
|
|
|
if(DEFINED CLIENT_VENDOR_PATH)
|
2021-06-21 17:39:34 +08:00
|
|
|
if(EXISTS "${PROJECT_SOURCE_DIR}/${CLIENT_VENDOR_PATH}/CMakeCPack.cmake")
|
2013-09-10 10:25:47 +08:00
|
|
|
set(CMAKE_CPACK_INCLUDE_FILE "${CLIENT_VENDOR_PATH}/CMakeCPack.cmake")
|
2013-09-04 08:37:04 +08:00
|
|
|
endif()
|
2012-11-13 02:17:44 +08:00
|
|
|
endif()
|
2013-01-29 19:59:58 +08:00
|
|
|
endif()
|
|
|
|
|
2013-09-11 02:46:48 +08:00
|
|
|
#message("VENDOR: ${VENDOR} CLIENT_VENDOR_PATH: ${CLIENT_VENDOR_PATH} CMAKE_CPACK_INCLUDE_FILE: ${CMAKE_CPACK_INCLUDE_FILE}")
|
|
|
|
|
2016-01-11 23:18:40 +08:00
|
|
|
set(FREERDP_BUILD_CONFIG_LIST "")
|
|
|
|
GET_CMAKE_PROPERTY(res VARIABLES)
|
|
|
|
FOREACH(var ${res})
|
2024-10-23 20:20:26 +08:00
|
|
|
IF (var MATCHES "^WITH_*|^BUILD_TESTING*|^WINPR_HAVE_*")
|
2023-10-11 16:48:11 +08:00
|
|
|
LIST(APPEND FREERDP_BUILD_CONFIG_LIST "${var}=${${var}}")
|
|
|
|
ENDIF()
|
2016-01-11 23:18:40 +08:00
|
|
|
ENDFOREACH()
|
|
|
|
string(REPLACE ";" " " FREERDP_BUILD_CONFIG "${FREERDP_BUILD_CONFIG_LIST}")
|
2021-10-03 00:00:31 +08:00
|
|
|
|
2022-04-20 20:40:51 +08:00
|
|
|
add_subdirectory(include)
|
|
|
|
|
|
|
|
include(${CMAKE_CPACK_INCLUDE_FILE})
|
|
|
|
|
2021-10-03 00:00:31 +08:00
|
|
|
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 20:40:51 +08:00
|
|
|
|