2015-02-10 20:05:40 +03:00
|
|
|
include(CMakeDependentOption)
|
2012-08-13 02:05:25 +04:00
|
|
|
|
2014-09-09 00:24:43 +04:00
|
|
|
if((CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 4))
|
2012-10-13 01:55:12 +04:00
|
|
|
set(TARGET_ARCH "x86")
|
|
|
|
elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64") AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
|
|
|
|
set(TARGET_ARCH "x64")
|
2013-03-12 01:05:49 +04:00
|
|
|
elseif((CMAKE_SYSTEM_PROCESSOR MATCHES "i386") AND (CMAKE_SIZEOF_VOID_P EQUAL 8) AND (APPLE))
|
|
|
|
# Mac is weird like that.
|
|
|
|
set(TARGET_ARCH "x64")
|
2015-02-04 00:14:40 +03:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm*")
|
2012-10-23 03:01:19 +04:00
|
|
|
set(TARGET_ARCH "ARM")
|
2015-02-05 19:46:56 +03:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
|
|
|
|
set(TARGET_ARCH "sparc")
|
2012-10-13 01:55:12 +04:00
|
|
|
endif()
|
|
|
|
|
2012-03-22 16:33:01 +04:00
|
|
|
option(WITH_MANPAGES "Generate manpages." ON)
|
|
|
|
option(WITH_PROFILER "Compile profiler." OFF)
|
2013-09-18 15:12:52 +04:00
|
|
|
option(WITH_GPROF "Compile with GProf profiler." OFF)
|
2012-10-13 01:55:12 +04:00
|
|
|
|
|
|
|
if((TARGET_ARCH MATCHES "x86|x64") AND (NOT DEFINED WITH_SSE2))
|
|
|
|
option(WITH_SSE2 "Enable SSE2 optimization." ON)
|
|
|
|
else()
|
|
|
|
option(WITH_SSE2 "Enable SSE2 optimization." OFF)
|
|
|
|
endif()
|
|
|
|
|
2013-02-20 04:08:27 +04:00
|
|
|
if(TARGET_ARCH MATCHES "ARM")
|
|
|
|
if (NOT DEFINED WITH_NEON)
|
|
|
|
option(WITH_NEON "Enable NEON optimization." ON)
|
|
|
|
else()
|
|
|
|
option(WITH_NEON "Enable NEON optimization." OFF)
|
|
|
|
endif()
|
2013-02-28 14:13:43 +04:00
|
|
|
else()
|
|
|
|
if(NOT APPLE)
|
|
|
|
option(WITH_IPP "Use Intel Performance Primitives." OFF)
|
|
|
|
endif()
|
2012-10-23 03:01:19 +04:00
|
|
|
endif()
|
2013-05-31 21:51:50 +04:00
|
|
|
|
2012-07-25 05:26:24 +04:00
|
|
|
option(WITH_JPEG "Use JPEG decoding." OFF)
|
2012-03-22 16:33:01 +04:00
|
|
|
|
2013-05-31 21:51:50 +04:00
|
|
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
set(CMAKE_COMPILER_IS_CLANG 1)
|
2012-08-13 02:05:25 +04:00
|
|
|
endif()
|
|
|
|
|
2014-05-12 20:01:29 +04:00
|
|
|
if(NOT WIN32)
|
2016-10-10 20:17:21 +03:00
|
|
|
CMAKE_DEPENDENT_OPTION(WITH_VALGRIND_MEMCHECK "Compile with valgrind helpers." OFF
|
|
|
|
"NOT WITH_SANITIZE_ADDRESS; NOT WITH_SANITIZE_MEMORY; NOT WITH_SANITIZE_THREAD" OFF)
|
|
|
|
CMAKE_DEPENDENT_OPTION(WITH_SANITIZE_ADDRESS "Compile with gcc/clang address sanitizer." OFF
|
|
|
|
"NOT WITH_VALGRIND_MEMCHECK; NOT WITH_SANITIZE_MEMORY; NOT WITH_SANITIZE_THREAD" OFF)
|
|
|
|
CMAKE_DEPENDENT_OPTION(WITH_SANITIZE_MEMORY "Compile with gcc/clang memory sanitizer." OFF
|
|
|
|
"NOT WITH_VALGRIND_MEMCHECK; NOT WITH_SANITIZE_ADDRESS; NOT WITH_SANITIZE_THREAD" OFF)
|
|
|
|
CMAKE_DEPENDENT_OPTION(WITH_SANITIZE_THREAD "Compile with gcc/clang thread sanitizer." OFF
|
|
|
|
"NOT WITH_VALGRIND_MEMCHECK; NOT WITH_SANITIZE_ADDRESS; NOT WITH_SANITIZE_MEMORY" OFF)
|
2015-08-11 08:51:59 +03:00
|
|
|
else()
|
2016-03-29 23:03:15 +03:00
|
|
|
if(NOT UWP)
|
2021-12-14 14:34:21 +03:00
|
|
|
option(WITH_MEDIA_FOUNDATION "Enable H264 media foundation decoder." OFF)
|
2017-07-17 10:32:34 +03:00
|
|
|
endif()
|
2014-05-12 20:01:29 +04:00
|
|
|
endif()
|
|
|
|
|
2016-03-29 23:03:15 +03:00
|
|
|
if(WIN32 AND NOT UWP)
|
2012-12-27 15:19:52 +04:00
|
|
|
option(WITH_WINMM "Use Windows Multimedia" ON)
|
2012-09-20 01:51:06 +04:00
|
|
|
option(WITH_WIN8 "Use Windows 8 libraries" OFF)
|
2012-08-13 04:43:24 +04:00
|
|
|
endif()
|
|
|
|
|
2012-10-13 17:50:02 +04:00
|
|
|
option(BUILD_TESTING "Build unit tests" OFF)
|
2016-04-19 13:46:54 +03:00
|
|
|
CMAKE_DEPENDENT_OPTION(TESTS_WTSAPI_EXTRA "Build extra WTSAPI tests (interactive)" OFF "BUILD_TESTING" OFF)
|
2016-05-02 17:59:25 +03:00
|
|
|
CMAKE_DEPENDENT_OPTION(BUILD_COMM_TESTS "Build comm related tests (require comm port)" OFF "BUILD_TESTING" OFF)
|
2015-02-10 20:05:40 +03:00
|
|
|
|
2012-10-14 04:55:28 +04:00
|
|
|
option(WITH_SAMPLE "Build sample code" OFF)
|
2012-10-02 19:56:10 +04:00
|
|
|
|
2015-11-04 11:53:13 +03:00
|
|
|
option(WITH_CLIENT_COMMON "Build client common library" ON)
|
2020-02-25 18:17:47 +03:00
|
|
|
CMAKE_DEPENDENT_OPTION(WITH_CLIENT "Build client binaries" ON "WITH_CLIENT_COMMON" OFF)
|
2015-11-04 15:15:37 +03:00
|
|
|
|
2012-08-13 02:05:25 +04:00
|
|
|
option(WITH_SERVER "Build server binaries" OFF)
|
2012-10-05 07:19:05 +04:00
|
|
|
|
2016-06-15 14:36:27 +03:00
|
|
|
option(BUILTIN_CHANNELS "Combine all channels into their respective base library" ON)
|
2012-10-23 03:01:19 +04:00
|
|
|
|
2012-08-13 02:05:25 +04:00
|
|
|
option(WITH_CHANNELS "Build virtual channel plugins" ON)
|
2012-09-23 04:16:38 +04:00
|
|
|
|
2021-06-10 10:54:35 +03:00
|
|
|
option(FREERDP_UNIFIED_BUILD "Build WinPR, uwac, RdTk and FreeRDP in one go" ON)
|
2019-08-14 16:10:00 +03:00
|
|
|
|
2020-02-25 18:17:47 +03:00
|
|
|
CMAKE_DEPENDENT_OPTION(WITH_CLIENT_CHANNELS "Build virtual channel plugins" ON
|
2015-11-10 16:18:51 +03:00
|
|
|
"WITH_CLIENT_COMMON;WITH_CHANNELS" OFF)
|
2012-09-23 04:16:38 +04:00
|
|
|
|
2020-02-25 18:17:47 +03:00
|
|
|
CMAKE_DEPENDENT_OPTION(WITH_MACAUDIO "Enable OSX sound backend" ON "APPLE;NOT IOS" OFF)
|
2016-02-02 22:58:05 +03:00
|
|
|
|
2012-09-23 04:16:38 +04:00
|
|
|
if(WITH_SERVER AND WITH_CHANNELS)
|
|
|
|
option(WITH_SERVER_CHANNELS "Build virtual channel plugins" ON)
|
|
|
|
endif()
|
|
|
|
|
2012-08-13 02:05:25 +04:00
|
|
|
option(WITH_THIRD_PARTY "Build third-party components" OFF)
|
|
|
|
|
2016-05-09 11:25:31 +03:00
|
|
|
option(WITH_CLIENT_INTERFACE "Build clients as a library with an interface" OFF)
|
2013-04-30 03:53:56 +04:00
|
|
|
option(WITH_SERVER_INTERFACE "Build servers as a library with an interface" ON)
|
2012-09-16 06:19:26 +04:00
|
|
|
|
2012-09-08 23:27:00 +04:00
|
|
|
option(WITH_DEBUG_ALL "Print all debug messages." OFF)
|
|
|
|
|
|
|
|
if(WITH_DEBUG_ALL)
|
2020-11-26 16:41:59 +03:00
|
|
|
message(WARNING "WITH_DEBUG_ALL=ON, the build will be slow and might leak sensitive information, do not use with release builds!")
|
2012-09-08 23:27:00 +04:00
|
|
|
set(DEFAULT_DEBUG_OPTION "ON")
|
|
|
|
else()
|
|
|
|
set(DEFAULT_DEBUG_OPTION "OFF")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(WITH_DEBUG_CERTIFICATE "Print certificate related debug messages." ${DEFAULT_DEBUG_OPTION})
|
2020-11-26 16:41:59 +03:00
|
|
|
if(WITH_DEBUG_CERTIFICATE)
|
|
|
|
message(WARNING "WITH_DEBUG_CERTIFICATE=ON, the build might leak sensitive information, do not use with release builds!")
|
|
|
|
endif()
|
2013-02-13 01:25:16 +04:00
|
|
|
option(WITH_DEBUG_CAPABILITIES "Print capability negotiation debug messages." ${DEFAULT_DEBUG_OPTION})
|
2012-09-08 23:27:00 +04:00
|
|
|
option(WITH_DEBUG_CHANNELS "Print channel manager debug messages." ${DEFAULT_DEBUG_OPTION})
|
|
|
|
option(WITH_DEBUG_CLIPRDR "Print clipboard redirection debug messages" ${DEFAULT_DEBUG_OPTION})
|
2019-06-04 10:28:03 +03:00
|
|
|
option(WITH_DEBUG_RDPGFX "Print RDPGFX debug messages" ${DEFAULT_DEBUG_OPTION})
|
2012-09-08 23:27:00 +04:00
|
|
|
option(WITH_DEBUG_DVC "Print dynamic virtual channel debug messages." ${DEFAULT_DEBUG_OPTION})
|
2020-02-25 17:21:16 +03:00
|
|
|
CMAKE_DEPENDENT_OPTION(WITH_DEBUG_TSMF "Print TSMF virtual channel debug messages." ${DEFAULT_DEBUG_OPTION} "CHANNEL_TSMF" OFF)
|
2012-09-08 23:27:00 +04:00
|
|
|
option(WITH_DEBUG_KBD "Print keyboard related debug messages." ${DEFAULT_DEBUG_OPTION})
|
2020-11-26 16:41:59 +03:00
|
|
|
if(WITH_DEBUG_KBD)
|
|
|
|
message(WARNING "WITH_DEBUG_KBD=ON, the build might leak sensitive information, do not use with release builds!")
|
|
|
|
endif()
|
2012-09-08 23:27:00 +04:00
|
|
|
option(WITH_DEBUG_LICENSE "Print license debug messages." ${DEFAULT_DEBUG_OPTION})
|
2020-11-26 16:41:59 +03:00
|
|
|
if(WITH_DEBUG_LICENSE)
|
|
|
|
message(WARNING "WITH_DEBUG_LICENSE=ON, the build might leak sensitive information, do not use with release builds!")
|
|
|
|
endif()
|
2012-09-08 23:27:00 +04:00
|
|
|
option(WITH_DEBUG_NEGO "Print negotiation related debug messages." ${DEFAULT_DEBUG_OPTION})
|
2020-11-26 16:41:59 +03:00
|
|
|
if(WITH_DEBUG_NEGO)
|
|
|
|
message(WARNING "WITH_DEBUG_NEGO=ON, the build might leak sensitive information, do not use with release builds!")
|
|
|
|
endif()
|
2012-09-08 23:27:00 +04:00
|
|
|
option(WITH_DEBUG_NLA "Print authentication related debug messages." ${DEFAULT_DEBUG_OPTION})
|
2020-11-26 16:41:59 +03:00
|
|
|
if(WITH_DEBUG_NLA)
|
|
|
|
message(WARNING "WITH_DEBUG_NLA=ON, the build might leak sensitive information, do not use with release builds!")
|
|
|
|
endif()
|
2012-09-08 23:27:00 +04:00
|
|
|
option(WITH_DEBUG_TSG "Print Terminal Server Gateway debug messages" ${DEFAULT_DEBUG_OPTION})
|
|
|
|
option(WITH_DEBUG_RAIL "Print RemoteApp debug messages" ${DEFAULT_DEBUG_OPTION})
|
|
|
|
option(WITH_DEBUG_RDP "Print RDP debug messages" ${DEFAULT_DEBUG_OPTION})
|
2016-12-14 00:47:08 +03:00
|
|
|
option(WITH_DEBUG_RDPEI "Print input virtual channel debug messages" ${DEFAULT_DEBUG_OPTION})
|
2012-09-08 23:27:00 +04:00
|
|
|
option(WITH_DEBUG_REDIR "Redirection debug messages" ${DEFAULT_DEBUG_OPTION})
|
2016-12-01 00:48:33 +03:00
|
|
|
option(WITH_DEBUG_RDPDR "Rdpdr debug messages" ${DEFAULT_DEBUG_OPTION})
|
2012-09-08 23:27:00 +04:00
|
|
|
option(WITH_DEBUG_RFX "Print RemoteFX debug messages." ${DEFAULT_DEBUG_OPTION})
|
|
|
|
option(WITH_DEBUG_SCARD "Print smartcard debug messages" ${DEFAULT_DEBUG_OPTION})
|
2013-09-23 14:38:44 +04:00
|
|
|
option(WITH_DEBUG_SND "Print rdpsnd debug messages" ${DEFAULT_DEBUG_OPTION})
|
2012-09-08 23:27:00 +04:00
|
|
|
option(WITH_DEBUG_SVC "Print static virtual channel debug messages." ${DEFAULT_DEBUG_OPTION})
|
|
|
|
option(WITH_DEBUG_TRANSPORT "Print transport debug messages." ${DEFAULT_DEBUG_OPTION})
|
|
|
|
option(WITH_DEBUG_TIMEZONE "Print timezone debug messages." ${DEFAULT_DEBUG_OPTION})
|
|
|
|
option(WITH_DEBUG_WND "Print window order debug messages" ${DEFAULT_DEBUG_OPTION})
|
|
|
|
option(WITH_DEBUG_X11_CLIPRDR "Print X11 clipboard redirection debug messages" ${DEFAULT_DEBUG_OPTION})
|
|
|
|
option(WITH_DEBUG_X11_LOCAL_MOVESIZE "Print X11 Client local movesize debug messages" ${DEFAULT_DEBUG_OPTION})
|
|
|
|
option(WITH_DEBUG_X11 "Print X11 Client debug messages" ${DEFAULT_DEBUG_OPTION})
|
|
|
|
option(WITH_DEBUG_XV "Print XVideo debug messages" ${DEFAULT_DEBUG_OPTION})
|
2015-02-03 17:28:05 +03:00
|
|
|
option(WITH_DEBUG_RINGBUFFER "Enable Ringbuffer debug messages" ${DEFAULT_DEBUG_OPTION})
|
2015-12-15 19:19:58 +03:00
|
|
|
|
|
|
|
option(WITH_DEBUG_SYMBOLS "Pack debug symbols to installer" OFF)
|
2017-01-25 11:05:27 +03:00
|
|
|
option(WITH_CCACHE "Use ccache support if available" ON)
|
2019-05-23 15:14:31 +03:00
|
|
|
option(WITH_CLANG_FORMAT "Detect clang-format. run 'cmake --build . --target clangformat' to format." ON)
|
2018-11-29 15:00:22 +03:00
|
|
|
option(WITH_GSSAPI "Compile support for kerberos authentication. (EXPERIMENTAL)" OFF)
|
2012-08-13 02:05:25 +04:00
|
|
|
|
2018-03-14 18:10:12 +03:00
|
|
|
option(WITH_DSP_EXPERIMENTAL "Enable experimental sound encoder/decoder formats" OFF)
|
2018-02-20 14:15:30 +03:00
|
|
|
if (WITH_FFMPEG)
|
|
|
|
option(WITH_DSP_FFMPEG "Use FFMPEG for audio encoding/decoding" OFF)
|
2020-01-16 11:53:39 +03:00
|
|
|
option(WITH_VAAPI "Use FFMPEG VAAPI" OFF)
|
2018-02-20 14:15:30 +03:00
|
|
|
endif(WITH_FFMPEG)
|
|
|
|
|
2017-11-08 16:22:38 +03:00
|
|
|
option(USE_VERSION_FROM_GIT_TAG "Extract FreeRDP version from git tag." OFF)
|
|
|
|
|
2019-05-06 14:18:31 +03:00
|
|
|
option(WITH_CAIRO "Use CAIRO image library for screen resizing" OFF)
|
|
|
|
option(WITH_SWSCALE "Use SWScale image library for screen resizing" OFF)
|
|
|
|
|
|
|
|
if (ANDROID)
|
|
|
|
include(ConfigOptionsAndroid)
|
2013-01-29 15:59:58 +04:00
|
|
|
endif(ANDROID)
|
2013-02-14 17:59:12 +04:00
|
|
|
|
2019-05-06 14:18:31 +03:00
|
|
|
if (IOS)
|
|
|
|
include(ConfigOptionsiOS)
|
2013-02-14 17:59:12 +04:00
|
|
|
endif(IOS)
|
2020-12-22 15:45:40 +03:00
|
|
|
|
|
|
|
option(BUILD_FUZZERS "Use BUILD_FUZZERS to build fuzzing tests" OFF)
|
|
|
|
|
|
|
|
if (BUILD_FUZZERS)
|
|
|
|
if (NOT OSS_FUZZ)
|
2022-01-10 18:02:21 +03:00
|
|
|
add_compile_options(-fsanitize=fuzzer-no-link)
|
2020-12-22 15:45:40 +03:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (OSS_FUZZ AND NOT DEFINED ENV{LIB_FUZZING_ENGINE})
|
|
|
|
message(SEND_ERROR
|
|
|
|
"OSS-Fuzz builds require the environment variable "
|
|
|
|
"LIB_FUZZING_ENGINE to be set. If you are seeing this "
|
|
|
|
"warning, it points to a deeper problem in the ossfuzz "
|
|
|
|
"build setup.")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"\n"
|
|
|
|
"Fuzzing is unsupported with GCC compiler. Use Clang:\n"
|
|
|
|
" $ CC=clang CXX=clang++ cmake . <...> -DBUILD_FUZZERS=ON && make -j\n"
|
|
|
|
"\n")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
set(BUILD_TESTING ON)
|
|
|
|
|
|
|
|
# A special target with fuzzer and sanitizer flags.
|
|
|
|
add_library(fuzzer_config INTERFACE)
|
|
|
|
|
|
|
|
target_compile_options(
|
|
|
|
fuzzer_config
|
|
|
|
INTERFACE
|
|
|
|
$<$<NOT:$<BOOL:${OSS_FUZZ}>>:
|
|
|
|
-fsanitize=fuzzer
|
|
|
|
>
|
|
|
|
$<$<BOOL:${OSS_FUZZ}>:
|
|
|
|
${CXX}
|
|
|
|
${CXXFLAGS}
|
|
|
|
>
|
|
|
|
)
|
|
|
|
target_link_libraries(
|
|
|
|
fuzzer_config
|
|
|
|
INTERFACE
|
|
|
|
$<$<NOT:$<BOOL:${OSS_FUZZ}>>:
|
|
|
|
-fsanitize=fuzzer
|
|
|
|
>
|
|
|
|
$<$<BOOL:${OSS_FUZZ}>:
|
|
|
|
$ENV{LIB_FUZZING_ENGINE}
|
|
|
|
>
|
|
|
|
)
|
|
|
|
endif()
|