2020-05-13 05:08:05 +03:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
|
|
|
# Licensed under the MIT License.
|
|
|
|
|
2021-07-23 19:50:03 +03:00
|
|
|
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
|
|
|
|
cmake_minimum_required(VERSION 3.20)
|
|
|
|
else()
|
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
endif()
|
2020-11-10 01:32:57 +03:00
|
|
|
|
2020-05-29 20:54:52 +03:00
|
|
|
# Disable in-source builds to prevent source tree corruption.
|
2020-10-28 17:41:37 +03:00
|
|
|
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
2020-05-29 20:54:52 +03:00
|
|
|
message(FATAL_ERROR "
|
|
|
|
FATAL: In-source builds are not allowed.
|
|
|
|
You should create a separate directory for build files.
|
|
|
|
")
|
|
|
|
endif()
|
|
|
|
|
2020-07-18 01:20:22 +03:00
|
|
|
message(STATUS "CMAKE Version: ${CMAKE_VERSION}")
|
|
|
|
|
2020-06-05 18:11:55 +03:00
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
2020-05-13 05:08:05 +03:00
|
|
|
message(STATUS "Source Dir: ${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
message(STATUS "Host System name: ${CMAKE_HOST_SYSTEM_NAME}")
|
|
|
|
if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
|
2023-01-11 15:39:02 +03:00
|
|
|
if (NOT DEFINED CMAKE_SYSTEM_VERSION)
|
2024-02-07 00:30:37 +03:00
|
|
|
set(CMAKE_SYSTEM_VERSION 10.0.22621.0 CACHE STRING INTERNAL FORCE)
|
2023-01-11 15:39:02 +03:00
|
|
|
endif()
|
2020-05-13 05:08:05 +03:00
|
|
|
endif()
|
|
|
|
|
2021-03-30 03:21:54 +03:00
|
|
|
if(POLICY CMP0091)
|
|
|
|
cmake_policy(SET CMP0091 NEW)
|
|
|
|
message(STATUS "Setting policy 0091")
|
2020-05-13 05:08:05 +03:00
|
|
|
else()
|
2021-03-30 03:21:54 +03:00
|
|
|
message(WARNING "CMake version too old to support Policy 0091; CRT static linking won't work")
|
2020-05-13 05:08:05 +03:00
|
|
|
endif()
|
|
|
|
|
2020-11-25 00:53:19 +03:00
|
|
|
if (POLICY CMP0111)
|
|
|
|
cmake_policy(SET CMP0111 NEW)
|
|
|
|
endif()
|
|
|
|
|
2020-05-13 05:08:05 +03:00
|
|
|
project(msquic)
|
|
|
|
|
2020-08-28 22:45:10 +03:00
|
|
|
# Set a default build type if none was specified
|
|
|
|
set(default_build_type "Release")
|
|
|
|
|
|
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
|
|
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
|
|
|
|
STRING "Choose the type of build." FORCE)
|
|
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
|
|
|
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
|
|
|
endif()
|
|
|
|
|
2020-05-13 05:08:05 +03:00
|
|
|
message(STATUS "System name: ${CMAKE_SYSTEM_NAME}")
|
|
|
|
message(STATUS "System version: ${CMAKE_SYSTEM_VERSION}")
|
|
|
|
message(STATUS "Platform version: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
2020-08-28 22:45:10 +03:00
|
|
|
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
2020-05-13 05:08:05 +03:00
|
|
|
|
2022-02-05 00:41:55 +03:00
|
|
|
set(QUIC_MAJOR_VERSION 2)
|
2024-08-05 15:31:12 +03:00
|
|
|
set(QUIC_FULL_VERSION 2.5.0)
|
2022-02-05 00:41:55 +03:00
|
|
|
|
2020-07-29 00:06:34 +03:00
|
|
|
if (WIN32)
|
2021-01-13 03:52:23 +03:00
|
|
|
set(CX_PLATFORM "windows")
|
2020-07-29 00:06:34 +03:00
|
|
|
elseif (APPLE)
|
2021-01-13 03:52:23 +03:00
|
|
|
set(CX_PLATFORM "darwin")
|
2020-07-29 00:06:34 +03:00
|
|
|
elseif (UNIX)
|
2021-01-13 03:52:23 +03:00
|
|
|
set(CX_PLATFORM "linux")
|
2020-07-29 00:06:34 +03:00
|
|
|
endif()
|
2021-01-13 03:52:23 +03:00
|
|
|
message(STATUS "QUIC Platform: ${CX_PLATFORM}")
|
2020-07-29 00:06:34 +03:00
|
|
|
|
2020-06-08 23:21:48 +03:00
|
|
|
set(FILENAME_DEP_REPLACE "get_filename_component(SELF_DIR \"$\{CMAKE_CURRENT_LIST_FILE\}\" PATH)")
|
|
|
|
set(SELF_DIR "$\{SELF_DIR\}")
|
|
|
|
|
2020-05-13 05:08:05 +03:00
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
# Set the default TLS method for each platform.
|
2020-07-29 00:06:34 +03:00
|
|
|
if (WIN32)
|
2020-05-13 05:08:05 +03:00
|
|
|
set(QUIC_TLS "schannel" CACHE STRING "TLS Library to use")
|
|
|
|
else()
|
|
|
|
set(QUIC_TLS "openssl" CACHE STRING "TLS Library to use")
|
|
|
|
endif()
|
|
|
|
|
2022-02-19 00:46:02 +03:00
|
|
|
option(QUIC_BUILD_TOOLS "Builds the tools code" OFF)
|
|
|
|
option(QUIC_BUILD_TEST "Builds the test code" OFF)
|
|
|
|
option(QUIC_BUILD_PERF "Builds the perf code" OFF)
|
2021-06-28 00:03:07 +03:00
|
|
|
option(QUIC_BUILD_SHARED "Builds msquic as a dynamic library" ON)
|
2020-09-01 18:31:44 +03:00
|
|
|
option(QUIC_ENABLE_LOGGING "Enables logging" OFF)
|
2020-08-14 18:20:12 +03:00
|
|
|
option(QUIC_ENABLE_SANITIZERS "Enables sanitizers" OFF)
|
2024-09-09 16:53:19 +03:00
|
|
|
option(QUIC_ENABLE_POOL_ALLOC "Enables pool allocations" ON)
|
2020-05-13 05:08:05 +03:00
|
|
|
option(QUIC_STATIC_LINK_CRT "Statically links the C runtime" ON)
|
2022-08-10 23:31:46 +03:00
|
|
|
option(QUIC_STATIC_LINK_PARTIAL_CRT "Statically links the compiler-specific portion of the C runtime" ON)
|
2020-06-04 18:25:31 +03:00
|
|
|
option(QUIC_UWP_BUILD "Build for UWP" OFF)
|
2021-08-28 03:02:19 +03:00
|
|
|
option(QUIC_GAMECORE_BUILD "Build for GameCore" OFF)
|
2024-10-25 14:44:09 +03:00
|
|
|
option(QUIC_EXTERNAL_TOOLCHAIN "Enable if system libs and include paths are configured by CMake toolchain" OFF)
|
2020-05-26 22:28:32 +03:00
|
|
|
option(QUIC_PGO "Enables profile guided optimizations" OFF)
|
2024-05-14 19:48:28 +03:00
|
|
|
option(QUIC_LINUX_XDP_ENABLED "Enables XDP support" OFF)
|
2020-07-18 01:20:22 +03:00
|
|
|
option(QUIC_SOURCE_LINK "Enables source linking on MSVC" ON)
|
2022-03-10 15:59:00 +03:00
|
|
|
option(QUIC_EMBED_GIT_HASH "Embed git commit hash in the binary" ON)
|
2020-07-23 20:43:22 +03:00
|
|
|
option(QUIC_PDBALTPATH "Enable PDBALTPATH setting on MSVC" ON)
|
2020-08-10 22:37:30 +03:00
|
|
|
option(QUIC_CODE_CHECK "Run static code checkers" OFF)
|
2020-08-28 22:45:10 +03:00
|
|
|
option(QUIC_OPTIMIZE_LOCAL "Optimize code for local machine architecture" OFF)
|
2021-08-04 21:58:46 +03:00
|
|
|
option(QUIC_CI "CI Specific build" OFF)
|
|
|
|
option(QUIC_SKIP_CI_CHECKS "Disable CI specific build checks" OFF)
|
2021-02-12 01:18:03 +03:00
|
|
|
option(QUIC_TELEMETRY_ASSERTS "Enable telemetry asserts in release builds" OFF)
|
2021-03-12 22:02:40 +03:00
|
|
|
option(QUIC_USE_SYSTEM_LIBCRYPTO "Use system libcrypto if openssl TLS" OFF)
|
2022-01-19 20:11:25 +03:00
|
|
|
option(QUIC_HIGH_RES_TIMERS "Configure the system to use high resolution timers" OFF)
|
2022-10-04 22:52:55 +03:00
|
|
|
option(QUIC_OFFICIAL_RELEASE "Configured the build for an official release" OFF)
|
2021-07-01 00:12:48 +03:00
|
|
|
set(QUIC_FOLDER_PREFIX "" CACHE STRING "Optional prefix for source group folders when using an IDE generator")
|
2021-07-02 19:18:03 +03:00
|
|
|
set(QUIC_LIBRARY_NAME "msquic" CACHE STRING "Override the output library name")
|
2022-10-25 01:19:41 +03:00
|
|
|
set(QUIC_LOGGING_TYPE "" CACHE STRING "Explicitly choose logging backend (\"etw\", \"lttng\" or \"stdout\")")
|
|
|
|
string(TOLOWER "${QUIC_LOGGING_TYPE}" QUIC_LOGGING_TYPE)
|
|
|
|
if(NOT "${QUIC_LOGGING_TYPE}" MATCHES "^(etw|lttng|stdout|)$")
|
|
|
|
message(FATAL_ERROR "QUIC_LOGGING_TYPE must be \"etw\", \"lttng\" or \"stdout\", not \"${QUIC_LOGGING_TYPE}\"")
|
|
|
|
endif()
|
2021-06-28 00:03:07 +03:00
|
|
|
|
2023-01-11 15:39:02 +03:00
|
|
|
if (QUIC_GAMECORE_BUILD)
|
2023-01-12 03:56:35 +03:00
|
|
|
if(${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} VERSION_LESS "10.0.20348.0")
|
2023-01-14 04:38:19 +03:00
|
|
|
message(FATAL_ERROR "gamecore builds require Windows 10 SDK version 20348 or later.")
|
2023-01-11 15:39:02 +03:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-04-20 19:48:30 +03:00
|
|
|
if (QUIC_UWP_BUILD OR QUIC_GAMECORE_BUILD)
|
|
|
|
message(STATUS "UWP And GameCore builds disable all executables, and force shared CRT")
|
|
|
|
set(QUIC_BUILD_TOOLS OFF)
|
|
|
|
set(QUIC_BUILD_TEST OFF)
|
|
|
|
set(QUIC_BUILD_PERF OFF)
|
|
|
|
set(QUIC_STATIC_LINK_CRT OFF)
|
2022-08-10 23:31:46 +03:00
|
|
|
set(QUIC_STATIC_LINK_PARTIAL_CRT OFF)
|
2022-04-20 19:48:30 +03:00
|
|
|
endif()
|
|
|
|
|
2022-08-10 15:17:53 +03:00
|
|
|
if (QUIC_STATIC_LINK_PARTIAL_CRT)
|
|
|
|
set(QUIC_STATIC_LINK_CRT ON)
|
|
|
|
endif()
|
|
|
|
|
2021-09-23 21:39:38 +03:00
|
|
|
if (NOT QUIC_BUILD_SHARED)
|
|
|
|
cmake_minimum_required(VERSION 3.20)
|
|
|
|
endif()
|
|
|
|
|
2021-06-28 00:03:07 +03:00
|
|
|
set(BUILD_SHARED_LIBS ${QUIC_BUILD_SHARED})
|
2020-05-13 05:08:05 +03:00
|
|
|
|
2020-07-23 20:43:22 +03:00
|
|
|
if (QUIC_PDBALTPATH AND MSVC)
|
|
|
|
# Disabled in all cases because generation is broken.
|
|
|
|
# file(READ ${CMAKE_CURRENT_LIST_DIR}/cmake/PdbAltPath.txt PDBALTPATH)
|
|
|
|
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PDBALTPATH}")
|
|
|
|
# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PDBALTPATH}")
|
|
|
|
# message(STATUS ${CMAKE_EXE_LINKER_FLAGS})
|
|
|
|
endif()
|
|
|
|
|
2022-03-10 15:59:00 +03:00
|
|
|
include(${PROJECT_SOURCE_DIR}/cmake/GitCommands.cmake)
|
|
|
|
get_git_current_hash(${PROJECT_SOURCE_DIR} GIT_CURRENT_HASH)
|
|
|
|
|
|
|
|
if(NOT GIT_CURRENT_HASH)
|
|
|
|
message("Failed to get git hash. Binary will not contain git hash")
|
|
|
|
set(QUIC_SOURCE_LINK OFF)
|
|
|
|
set(QUIC_EMBED_GIT_HASH OFF)
|
|
|
|
endif()
|
|
|
|
|
2020-07-23 20:43:22 +03:00
|
|
|
if (QUIC_SOURCE_LINK AND MSVC)
|
|
|
|
if ("${CMAKE_C_COMPILER_VERSION}" VERSION_GREATER_EQUAL "19.20")
|
|
|
|
include(${PROJECT_SOURCE_DIR}/cmake/SourceLink.cmake)
|
|
|
|
file(TO_NATIVE_PATH "${PROJECT_BINARY_DIR}/source_link.json" SOURCE_LINK_JSON)
|
2021-01-19 20:24:49 +03:00
|
|
|
file(TO_NATIVE_PATH "${PROJECT_SOURCE_DIR}/cmake/source_link.json.in" SOURCE_LINK_JSON_INPUT)
|
|
|
|
source_link(${PROJECT_SOURCE_DIR} ${SOURCE_LINK_JSON} ${SOURCE_LINK_JSON_INPUT})
|
2020-07-30 18:51:54 +03:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO")
|
2021-08-11 19:37:34 +03:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /FORCE:PGOREPRO /SOURCELINK:\"${SOURCE_LINK_JSON}\"")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /FORCE:PGOREPRO /SOURCELINK:\"${SOURCE_LINK_JSON}\"")
|
2020-07-23 20:43:22 +03:00
|
|
|
else()
|
2021-11-19 00:38:49 +03:00
|
|
|
message(WARNING "Disabling SourceLink due to old version of MSVC. Please update to VS2019 or greater!")
|
2020-07-18 01:20:22 +03:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-05-26 20:18:33 +03:00
|
|
|
set(QUIC_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
set(QUIC_OUTPUT_DIR ${QUIC_BUILD_DIR}/bin/$<IF:$<CONFIG:Debug>,Debug,Release> CACHE STRING "Output directory for build artifacts")
|
2020-05-13 05:08:05 +03:00
|
|
|
|
2022-02-26 00:01:16 +03:00
|
|
|
string(GENEX_STRIP ${QUIC_OUTPUT_DIR} QUIC_OUTPUT_DIR_STRIPPED)
|
|
|
|
|
|
|
|
string(COMPARE EQUAL ${QUIC_OUTPUT_DIR} ${QUIC_OUTPUT_DIR_STRIPPED} QUIC_HAS_GENERATOR_OUTPUT_DIR)
|
|
|
|
|
|
|
|
if (QUIC_HAS_GENERATOR_OUTPUT_DIR)
|
|
|
|
set(QUIC_PGO_DIR ${QUIC_OUTPUT_DIR})
|
|
|
|
else ()
|
|
|
|
set(QUIC_PGO_DIR ${QUIC_BUILD_DIR}/PGO)
|
|
|
|
endif ()
|
|
|
|
|
2020-09-22 23:49:23 +03:00
|
|
|
set(QUIC_VER_BUILD_ID "0" CACHE STRING "The version build ID")
|
|
|
|
set(QUIC_VER_SUFFIX "-private" CACHE STRING "The version suffix")
|
|
|
|
|
|
|
|
message(STATUS "Version Build ID: ${QUIC_VER_BUILD_ID}")
|
|
|
|
message(STATUS "Version Suffix: ${QUIC_VER_SUFFIX}")
|
|
|
|
|
2020-05-26 20:18:33 +03:00
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${QUIC_BUILD_DIR}/obj/$<IF:$<CONFIG:Debug>,Debug,Release>)
|
2020-05-13 05:08:05 +03:00
|
|
|
|
2020-05-26 20:18:33 +03:00
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QUIC_OUTPUT_DIR})
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QUIC_OUTPUT_DIR})
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${QUIC_OUTPUT_DIR})
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${QUIC_OUTPUT_DIR})
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${QUIC_OUTPUT_DIR})
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${QUIC_OUTPUT_DIR})
|
2020-05-13 05:08:05 +03:00
|
|
|
|
2020-07-29 00:06:34 +03:00
|
|
|
set(QUIC_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/inc)
|
2020-07-01 22:56:42 +03:00
|
|
|
|
2020-07-29 00:06:34 +03:00
|
|
|
if (WIN32)
|
2022-03-09 02:43:28 +03:00
|
|
|
set(QUIC_WARNING_FLAGS /WX /W4 /sdl /wd4206 CACHE INTERNAL "")
|
2020-07-29 00:06:34 +03:00
|
|
|
set(QUIC_COMMON_FLAGS "")
|
2021-08-03 02:04:55 +03:00
|
|
|
|
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
|
|
|
|
if(NOT QUIC_ENABLE_SANITIZERS)
|
|
|
|
check_c_compiler_flag(/Qspectre HAS_SPECTRE)
|
|
|
|
endif()
|
|
|
|
if(HAS_SPECTRE)
|
|
|
|
list(APPEND QUIC_COMMON_FLAGS /Qspectre)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
check_c_compiler_flag(/guard:cf HAS_GUARDCF)
|
|
|
|
if(HAS_GUARDCF)
|
|
|
|
list(APPEND QUIC_COMMON_FLAGS /guard:cf)
|
|
|
|
endif()
|
|
|
|
|
2021-08-04 21:58:46 +03:00
|
|
|
# Require /Qspectre and /guard:cf in CI builds
|
|
|
|
if(QUIC_CI AND NOT QUIC_SKIP_CI_CHECKS)
|
|
|
|
if(NOT HAS_GUARDCF)
|
|
|
|
message(FATAL_ERROR "/guard:cf must exist for CI builds")
|
|
|
|
endif()
|
|
|
|
if(NOT HAS_SPECTRE AND NOT QUIC_ENABLE_SANITIZERS AND NOT QUIC_UWP_BUILD)
|
|
|
|
message(FATAL_ERROR "/Qspectre must exist for CI builds")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-07-29 00:06:34 +03:00
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
|
list(APPEND QUIC_COMMON_FLAGS /MP)
|
|
|
|
endif()
|
|
|
|
set(QUIC_COMMON_DEFINES WIN32_LEAN_AND_MEAN SECURITY_WIN32)
|
2022-10-25 01:19:41 +03:00
|
|
|
|
|
|
|
if(QUIC_ENABLE_LOGGING AND QUIC_LOGGING_TYPE STREQUAL "")
|
|
|
|
set(QUIC_LOGGING_TYPE "etw")
|
|
|
|
message(STATUS "Choosing etw as default logging type for platform")
|
|
|
|
endif()
|
2020-07-29 00:06:34 +03:00
|
|
|
else()
|
2021-08-04 21:58:46 +03:00
|
|
|
|
2021-09-11 00:25:51 +03:00
|
|
|
include(CheckSymbolExists)
|
|
|
|
include(CheckFunctionExists)
|
2021-09-20 20:38:17 +03:00
|
|
|
include(CheckIncludeFile)
|
2021-09-11 00:25:51 +03:00
|
|
|
check_symbol_exists(_SC_PHYS_PAGES unistd.h HAS__SC_PHYS_PAGES)
|
|
|
|
check_function_exists(sysconf HAS_SYSCONF)
|
|
|
|
|
2021-08-04 21:58:46 +03:00
|
|
|
if (CX_PLATFORM STREQUAL "linux")
|
|
|
|
include(CheckCCompilerFlag)
|
2021-09-11 00:25:51 +03:00
|
|
|
|
2021-09-20 20:38:17 +03:00
|
|
|
check_symbol_exists(UDP_SEGMENT netinet/udp.h HAS_UDP_SEGMENT)
|
2021-08-04 21:58:46 +03:00
|
|
|
if (NOT HAS_UDP_SEGMENT)
|
|
|
|
message(STATUS "UDP_SEGMENT is missing. Send performance will be reduced")
|
|
|
|
endif()
|
|
|
|
|
2021-09-20 20:38:17 +03:00
|
|
|
check_symbol_exists(SO_ATTACH_REUSEPORT_CBPF sys/socket.h HAS_SO_ATTACH_REUSEPORT_CBPF)
|
2021-08-04 21:58:46 +03:00
|
|
|
if(NOT HAS_SO_ATTACH_REUSEPORT_CBPF)
|
|
|
|
message(STATUS "SO_ATTACH_REUSEPORT_CBPF is missing. Server receive performance will be reduced")
|
|
|
|
endif()
|
|
|
|
|
2021-09-20 20:38:17 +03:00
|
|
|
check_function_exists(sendmmsg HAS_SENDMMSG)
|
2021-08-11 20:37:19 +03:00
|
|
|
if(NOT HAS_SENDMMSG)
|
|
|
|
message(STATUS "sendmmsg is missing. Send performance will be reduced")
|
|
|
|
endif()
|
|
|
|
|
2021-08-04 21:58:46 +03:00
|
|
|
# Error if flags are missing in CI
|
|
|
|
if(QUIC_CI AND NOT QUIC_SKIP_CI_CHECKS)
|
|
|
|
if (NOT HAS_UDP_SEGMENT)
|
|
|
|
message(FATAL_ERROR "UDP_SEGMENT must exist for CI builds")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT HAS_SO_ATTACH_REUSEPORT_CBPF)
|
|
|
|
message(FATAL_ERROR "SO_ATTACH_REUSEPORT_CBPF must exist for CI builds")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2022-10-25 01:19:41 +03:00
|
|
|
if(QUIC_ENABLE_LOGGING AND QUIC_LOGGING_TYPE STREQUAL "")
|
|
|
|
set(QUIC_LOGGING_TYPE "lttng")
|
|
|
|
message(STATUS "Choosing lttng as default logging type for platform")
|
2021-09-20 20:38:17 +03:00
|
|
|
endif()
|
|
|
|
|
2022-10-25 01:19:41 +03:00
|
|
|
elseif(CX_PLATFORM STREQUAL "darwin")
|
|
|
|
check_function_exists(sysctl HAS_SYSCTL)
|
2021-08-04 21:58:46 +03:00
|
|
|
if(QUIC_ENABLE_LOGGING)
|
2022-10-25 01:19:41 +03:00
|
|
|
if(QUIC_LOGGING_TYPE STREQUAL "stdout")
|
|
|
|
message(STATUS "Choosing stdout as logging type for platform")
|
|
|
|
elseif(QUIC_LOGGING_TYPE STREQUAL "")
|
|
|
|
message(WARNING "Must explicitly set QUIC_LOGGING_TYPE to \"stdout\" to enable due to performance overhead; disabling logging")
|
2021-08-04 21:58:46 +03:00
|
|
|
set(QUIC_ENABLE_LOGGING OFF)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-07-29 00:06:34 +03:00
|
|
|
set(QUIC_COMMON_FLAGS "")
|
2020-12-07 20:55:58 +03:00
|
|
|
set(QUIC_COMMON_DEFINES _GNU_SOURCE)
|
2021-08-11 20:37:19 +03:00
|
|
|
if (HAS_SENDMMSG)
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES HAS_SENDMMSG)
|
|
|
|
endif()
|
2021-09-11 00:25:51 +03:00
|
|
|
if (HAS__SC_PHYS_PAGES)
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES HAS__SC_PHYS_PAGES)
|
|
|
|
endif()
|
|
|
|
if (HAS_SYSCONF)
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES HAS_SYSCONF)
|
|
|
|
endif()
|
|
|
|
if (HAS_SYSCTL)
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES HAS_SYSCTL)
|
|
|
|
endif()
|
2020-08-08 00:07:51 +03:00
|
|
|
set(QUIC_WARNING_FLAGS -Werror -Wall -Wextra -Wformat=2 -Wno-type-limits
|
2020-08-13 18:43:36 +03:00
|
|
|
-Wno-unknown-pragmas -Wno-multichar -Wno-missing-field-initializers
|
2020-08-08 00:07:51 +03:00
|
|
|
CACHE INTERNAL "")
|
2020-10-29 19:13:16 +03:00
|
|
|
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
|
|
|
|
list(APPEND QUIC_WARNING_FLAGS -Wno-strict-aliasing)
|
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
2020-08-08 00:07:51 +03:00
|
|
|
list(APPEND QUIC_WARNING_FLAGS -Wno-missing-braces -Wno-microsoft-anon-tag)
|
2024-07-09 01:01:16 +03:00
|
|
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 18)
|
|
|
|
list(APPEND QUIC_WARNING_FLAGS -Wno-invalid-unevaluated-string)
|
|
|
|
endif()
|
2020-08-08 00:07:51 +03:00
|
|
|
endif()
|
2020-07-29 00:06:34 +03:00
|
|
|
endif()
|
2020-05-13 05:08:05 +03:00
|
|
|
|
2020-09-22 23:49:23 +03:00
|
|
|
list(APPEND QUIC_COMMON_DEFINES VER_BUILD_ID=${QUIC_VER_BUILD_ID})
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES VER_SUFFIX=${QUIC_VER_SUFFIX})
|
|
|
|
|
2022-03-10 15:59:00 +03:00
|
|
|
if (QUIC_EMBED_GIT_HASH)
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES VER_GIT_HASH=${GIT_CURRENT_HASH})
|
|
|
|
endif()
|
|
|
|
|
2021-02-12 01:18:03 +03:00
|
|
|
if(QUIC_TELEMETRY_ASSERTS)
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_TELEMETRY_ASSERTS=1)
|
|
|
|
endif()
|
|
|
|
|
2022-01-19 20:11:25 +03:00
|
|
|
if(QUIC_HIGH_RES_TIMERS)
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_HIGH_RES_TIMERS=1)
|
|
|
|
endif()
|
|
|
|
|
2024-09-09 16:53:19 +03:00
|
|
|
if (QUIC_ENABLE_SANITIZERS OR NOT QUIC_ENABLE_POOL_ALLOC)
|
2022-12-13 19:59:09 +03:00
|
|
|
list(APPEND QUIC_COMMON_DEFINES DISABLE_CXPLAT_POOL=1)
|
|
|
|
endif()
|
|
|
|
|
2022-10-04 22:52:55 +03:00
|
|
|
if(QUIC_OFFICIAL_RELEASE)
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_OFFICIAL_RELEASE=1)
|
|
|
|
message(STATUS "Configured for official release build")
|
|
|
|
endif()
|
|
|
|
|
2021-03-27 03:13:27 +03:00
|
|
|
if(QUIC_TLS STREQUAL "schannel")
|
2021-06-24 23:42:16 +03:00
|
|
|
message(STATUS "Enabling Schannel configuration tests")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_TEST_SCHANNEL_FLAGS=1)
|
2022-10-01 00:00:02 +03:00
|
|
|
|
2021-03-27 03:13:27 +03:00
|
|
|
message(STATUS "Disabling PFX tests")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_DISABLE_PFX_TESTS)
|
|
|
|
message(STATUS "Disabling 0-RTT support")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_DISABLE_0RTT_TESTS)
|
2021-04-06 01:11:08 +03:00
|
|
|
message(STATUS "Disabling ChaCha20 support")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_DISABLE_CHACHA20_TESTS)
|
2022-05-19 02:12:23 +03:00
|
|
|
message(STATUS "Enabling anonymous client auth tests")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_ENABLE_ANON_CLIENT_AUTH_TESTS)
|
2021-03-27 03:13:27 +03:00
|
|
|
endif()
|
|
|
|
|
2023-02-02 21:43:49 +03:00
|
|
|
if(QUIC_TLS STREQUAL "openssl" OR QUIC_TLS STREQUAL "openssl3")
|
2021-06-24 23:42:16 +03:00
|
|
|
message(STATUS "Enabling OpenSsl configuration tests")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_TEST_OPENSSL_FLAGS=1)
|
2022-11-16 15:54:28 +03:00
|
|
|
if (NOT WIN32)
|
2023-02-02 21:43:49 +03:00
|
|
|
message(STATUS "Enabling CA file tests")
|
2022-11-16 15:54:28 +03:00
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_ENABLE_CA_CERTIFICATE_FILE_TESTS)
|
|
|
|
endif()
|
2021-03-27 03:13:27 +03:00
|
|
|
endif()
|
2021-04-06 01:11:08 +03:00
|
|
|
|
2022-10-25 01:19:41 +03:00
|
|
|
if(QUIC_ENABLE_LOGGING)
|
|
|
|
if (QUIC_LOGGING_TYPE STREQUAL "etw")
|
|
|
|
if (WIN32)
|
|
|
|
message(STATUS "Configuring for manifested ETW logging")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_EVENTS_MANIFEST_ETW QUIC_LOGS_MANIFEST_ETW)
|
|
|
|
else()
|
|
|
|
message(WARNING "ETW logging is only available on WIN32. Disabling logging")
|
|
|
|
set(QUIC_ENABLE_LOGGING OFF)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
elseif (QUIC_LOGGING_TYPE STREQUAL "lttng")
|
|
|
|
if (QUIC_ENABLE_SANITIZERS)
|
|
|
|
message(WARNING "LTTng logging is incompatible with sanitizers. Skipping logging")
|
|
|
|
set(QUIC_ENABLE_LOGGING OFF)
|
|
|
|
else()
|
|
|
|
# FindLTTngUST does not exist before CMake 3.6, so disable logging for older cmake versions
|
|
|
|
if (${CMAKE_VERSION} VERSION_LESS "3.6.0")
|
|
|
|
message(WARNING "Logging unsupported on this version of CMake. Please upgrade to 3.6 or later.")
|
|
|
|
set(QUIC_ENABLE_LOGGING OFF)
|
|
|
|
else()
|
|
|
|
check_include_file(lttng/ust-config.h HAS_LTTNG)
|
|
|
|
if (NOT HAS_LTTNG)
|
|
|
|
message(WARNING "LTTng logging not found. Disabling logging")
|
|
|
|
set(QUIC_ENABLE_LOGGING OFF)
|
|
|
|
else()
|
|
|
|
check_symbol_exists(LTTNG_UST_HAVE_SDT_INTEGRATION lttng/ust-config.h HAS_LTTNG_SDT)
|
|
|
|
if(HAS_LTTNG_SDT)
|
|
|
|
message(WARNING "LTTng with SDT integration does not work. Disabling logging")
|
|
|
|
set(QUIC_ENABLE_LOGGING OFF)
|
|
|
|
else()
|
|
|
|
message(STATUS "Configuring for LTTng logging")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_CLOG)
|
|
|
|
include(FindLTTngUST)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
elseif (QUIC_LOGGING_TYPE STREQUAL "stdout")
|
|
|
|
message(STATUS "Configuring for stdout logging")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_EVENTS_STDOUT QUIC_LOGS_STDOUT)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
else()
|
|
|
|
message(STATUS "QUIC_ENABLE_LOGGING is false. Disabling logging")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT QUIC_ENABLE_LOGGING)
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_EVENTS_STUB QUIC_LOGS_STUB)
|
|
|
|
endif()
|
|
|
|
|
2022-12-19 01:40:33 +03:00
|
|
|
if (NOT MSVC AND NOT APPLE AND NOT ANDROID)
|
|
|
|
find_library(ATOMIC NAMES atomic libatomic.so.1)
|
|
|
|
if (ATOMIC)
|
|
|
|
message(STATUS "Found libatomic: ${ATOMIC}")
|
|
|
|
else()
|
|
|
|
message(STATUS "libatomic not found. If build fails, install libatomic")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
find_library(NUMA NAMES NUMA libnuma.so.1)
|
|
|
|
if (NUMA)
|
|
|
|
message(STATUS "Found libnuma: ${NUMA}")
|
2023-05-10 22:02:13 +03:00
|
|
|
find_file(NUMA-HEADER NAMES "numa.h")
|
2023-02-10 20:32:48 +03:00
|
|
|
if (NUMA-HEADER)
|
|
|
|
message(STATUS "Found numa.h: ${NUMA-HEADER}")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES CXPLAT_NUMA_AWARE)
|
|
|
|
else()
|
|
|
|
message(STATUS "numa.h not found. If build fails, install libnuma-dev")
|
|
|
|
endif()
|
2022-12-19 01:40:33 +03:00
|
|
|
else()
|
|
|
|
message(STATUS "libnuma not found. If build fails, install libnuma")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2024-04-25 23:03:44 +03:00
|
|
|
if (CMAKE_GENERATOR_PLATFORM STREQUAL "")
|
|
|
|
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} SYSTEM_PROCESSOR)
|
|
|
|
else()
|
|
|
|
string(TOLOWER ${CMAKE_GENERATOR_PLATFORM} SYSTEM_PROCESSOR)
|
|
|
|
endif()
|
2021-08-11 22:38:56 +03:00
|
|
|
|
2024-04-25 23:03:44 +03:00
|
|
|
if(WIN32)
|
2020-05-13 05:08:05 +03:00
|
|
|
# Generate the MsQuicEtw header file.
|
|
|
|
file(MAKE_DIRECTORY ${QUIC_BUILD_DIR}/inc)
|
2020-07-29 00:06:34 +03:00
|
|
|
|
2024-10-24 13:52:48 +03:00
|
|
|
if(NOT DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OR CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH)
|
|
|
|
find_program(MC_EXE NAMES mc.exe)
|
|
|
|
if(MC_EXE MATCHES "NOTFOUND")
|
|
|
|
# If not found, then VS project generator will set %PATH% env var to WinSDK bin directory
|
|
|
|
set(MC_EXE "mc.exe" CACHE STRING "mc.exe from %PATH%" FORCE)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
find_program(MC_EXE NAMES mc.exe REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2020-05-13 05:08:05 +03:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${QUIC_BUILD_DIR}/inc/MsQuicEtw.h
|
|
|
|
OUTPUT ${QUIC_BUILD_DIR}/inc/MsQuicEtw.rc
|
2020-06-13 00:29:53 +03:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/manifest/MsQuicEtw.man
|
2024-10-24 13:52:48 +03:00
|
|
|
COMMAND "${MC_EXE}" -um -h ${QUIC_BUILD_DIR}/inc -r ${QUIC_BUILD_DIR}/inc ${CMAKE_CURRENT_SOURCE_DIR}/src/manifest/MsQuicEtw.man)
|
2021-01-19 20:24:49 +03:00
|
|
|
add_custom_target(MsQuicEtw_HeaderBuild
|
|
|
|
DEPENDS ${QUIC_BUILD_DIR}/inc/MsQuicEtw.h)
|
2020-05-13 05:08:05 +03:00
|
|
|
|
2021-06-28 00:03:07 +03:00
|
|
|
set_property(TARGET MsQuicEtw_HeaderBuild PROPERTY FOLDER "${QUIC_FOLDER_PREFIX}helpers")
|
2021-01-19 20:24:49 +03:00
|
|
|
|
|
|
|
add_library(MsQuicEtw_Header INTERFACE)
|
2024-11-07 17:52:39 +03:00
|
|
|
target_include_directories(MsQuicEtw_Header INTERFACE
|
|
|
|
$<BUILD_INTERFACE:${QUIC_BUILD_DIR}/inc>
|
|
|
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
2021-01-19 20:24:49 +03:00
|
|
|
add_dependencies(MsQuicEtw_Header MsQuicEtw_HeaderBuild)
|
|
|
|
|
|
|
|
add_library(MsQuicEtw_Resource OBJECT ${QUIC_BUILD_DIR}/inc/MsQuicEtw.rc)
|
2021-06-28 00:03:07 +03:00
|
|
|
set_property(TARGET MsQuicEtw_Resource PROPERTY FOLDER "${QUIC_FOLDER_PREFIX}helpers")
|
2020-06-05 18:11:55 +03:00
|
|
|
|
2021-06-23 00:26:37 +03:00
|
|
|
message(STATUS "Disabling (client) shared port support")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_DISABLE_SHARED_PORT_TESTS)
|
|
|
|
|
2020-07-29 00:06:34 +03:00
|
|
|
if (QUIC_UWP_BUILD)
|
2021-09-13 22:57:45 +03:00
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_UWP_BUILD QUIC_RESTRICTED_BUILD)
|
|
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES "")
|
|
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "")
|
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES "")
|
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES_INIT "")
|
2020-06-04 18:25:31 +03:00
|
|
|
endif()
|
|
|
|
|
2021-08-28 03:02:19 +03:00
|
|
|
if (QUIC_GAMECORE_BUILD)
|
2024-10-25 14:44:09 +03:00
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_GAMECORE_BUILD QUIC_RESTRICTED_BUILD)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (QUIC_GAMECORE_BUILD AND NOT QUIC_EXTERNAL_TOOLCHAIN)
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES WINAPI_FAMILY=WINAPI_FAMILY_GAMES)
|
2021-09-13 22:57:45 +03:00
|
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES "")
|
|
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "")
|
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES "")
|
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES_INIT "")
|
|
|
|
|
|
|
|
set(UnsupportedLibs advapi32.lib comctl32.lib comsupp.lib dbghelp.lib gdi32.lib gdiplus.lib guardcfw.lib kernel32.lib mmc.lib msimg32.lib msvcole.lib msvcoled.lib mswsock.lib ntstrsafe.lib ole2.lib ole2autd.lib ole2auto.lib ole2d.lib ole2ui.lib ole2uid.lib ole32.lib oleacc.lib oleaut32.lib oledlg.lib oledlgd.lib oldnames.lib runtimeobject.lib shell32.lib shlwapi.lib strsafe.lib urlmon.lib user32.lib userenv.lib wlmole.lib wlmoled.lib onecore.lib)
|
|
|
|
set(Console_LinkOptions /DYNAMICBASE /NXCOMPAT)
|
|
|
|
foreach(arg ${UnsupportedLibs})
|
|
|
|
list(APPEND Console_LinkOptions "/NODEFAULTLIB:${arg}")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
set(Console_ArchOptions /favor:AMD64)
|
|
|
|
|
2021-09-20 20:37:59 +03:00
|
|
|
list(APPEND Console_ArchOptions /arch:AVX)
|
2021-09-13 22:57:45 +03:00
|
|
|
|
|
|
|
# Locate Software Development Kits
|
|
|
|
get_filename_component(Console_SdkRoot "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\GDK;InstallPath]" ABSOLUTE CACHE)
|
|
|
|
|
|
|
|
if(NOT EXISTS ${Console_SdkRoot})
|
2021-10-20 20:47:11 +03:00
|
|
|
if (EXISTS "C:\\Program Files (x86)\\Microsoft GDK")
|
|
|
|
set(Console_SdkRoot "C:\\Program Files (x86)\\Microsoft GDK")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Could not find GDK install")
|
|
|
|
endif()
|
2021-09-13 22:57:45 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
file(GLOB GdkFolders ${Console_SdkRoot}/*)
|
|
|
|
|
|
|
|
set(XdkEditionTarget 5000000000)
|
|
|
|
|
|
|
|
foreach(GdkFolder ${GdkFolders})
|
|
|
|
if (IS_DIRECTORY ${GdkFolder})
|
|
|
|
file(GLOB SubDirs ${GdkFolder}/*)
|
|
|
|
foreach(SubDir ${SubDirs})
|
|
|
|
if (SubDir MATCHES "GXDK$")
|
|
|
|
# Make sure library exists
|
|
|
|
set(GxdkLibDirectory "${SubDir}/gameKit/Lib/amd64")
|
|
|
|
set(GxdkRuntimeLib "${GxdkLibDirectory}/xgameplatform.lib")
|
|
|
|
if (EXISTS ${GxdkRuntimeLib})
|
|
|
|
get_filename_component(PotentialXdkEditionTarget ${GdkFolder} NAME)
|
2021-09-20 20:37:59 +03:00
|
|
|
# Always select lowest version equal or higher than 211000
|
|
|
|
if (PotentialXdkEditionTarget LESS XdkEditionTarget AND
|
|
|
|
PotentialXdkEditionTarget GREATER_EQUAL 211000)
|
2021-09-13 22:57:45 +03:00
|
|
|
set(XdkEditionTarget ${PotentialXdkEditionTarget})
|
|
|
|
set(Console_EndpointLibRoot "${GxdkLibDirectory}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if (XdkEditionTarget EQUAL 5000000000)
|
|
|
|
message(FATAL_ERROR "Gxdk Target Not Found")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message(STATUS "Chosing ${XdkEditionTarget} with root ${Console_EndpointLibRoot}")
|
|
|
|
|
2021-08-28 03:02:19 +03:00
|
|
|
endif()
|
|
|
|
|
2020-08-14 18:20:12 +03:00
|
|
|
if(QUIC_ENABLE_SANITIZERS)
|
2021-04-30 02:04:28 +03:00
|
|
|
# This fails when linking statically, so for today require dynamic linkage
|
|
|
|
if (QUIC_STATIC_LINK_CRT)
|
|
|
|
message(FATAL_ERROR "Static linkage unsupported with Address Sanitizer in Windows")
|
|
|
|
endif()
|
|
|
|
message(STATUS "Configuring sanitizers")
|
|
|
|
list(APPEND QUIC_COMMON_FLAGS /fsanitize=address)
|
2023-02-21 16:35:10 +03:00
|
|
|
list(APPEND QUIC_COMMON_DEFINES _DISABLE_VECTOR_ANNOTATION) # For std:vector usage in tests
|
2020-05-13 05:08:05 +03:00
|
|
|
endif()
|
|
|
|
|
2020-07-29 00:06:34 +03:00
|
|
|
set(QUIC_C_FLAGS ${QUIC_COMMON_FLAGS})
|
2020-11-24 19:58:10 +03:00
|
|
|
set(QUIC_CXX_FLAGS ${QUIC_COMMON_FLAGS} /EHsc /permissive-)
|
2020-05-13 05:08:05 +03:00
|
|
|
|
2020-07-29 00:06:34 +03:00
|
|
|
# These cannot be updated until CMake 3.13
|
2020-05-26 22:28:32 +03:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL /Zi")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL /Zi")
|
2021-09-20 20:37:59 +03:00
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /IGNORE:4075 /DEBUG /OPT:REF /OPT:ICF")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /IGNORE:4075 /DEBUG /OPT:REF /OPT:ICF")
|
2020-06-12 18:24:32 +03:00
|
|
|
|
2022-05-17 21:33:37 +03:00
|
|
|
# Find the right PGO file.
|
|
|
|
if(NOT EXISTS "${QUIC_PGO_FILE}")
|
|
|
|
set(QUIC_PGO_NAME "msquic.${QUIC_TLS}.pgd")
|
|
|
|
set(QUIC_PGO_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/bin/winuser/pgo_${SYSTEM_PROCESSOR}/${QUIC_PGO_NAME}")
|
|
|
|
endif()
|
|
|
|
if(NOT EXISTS "${QUIC_PGO_FILE}")
|
|
|
|
set(QUIC_PGO_NAME "msquic.pgd")
|
|
|
|
set(QUIC_PGO_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/bin/winuser/pgo_${SYSTEM_PROCESSOR}/${QUIC_PGO_NAME}")
|
|
|
|
endif()
|
|
|
|
message(STATUS "Using PGO file ${QUIC_PGO_NAME}")
|
|
|
|
|
2020-06-12 18:24:32 +03:00
|
|
|
# Configure PGO linker flags.
|
2020-05-26 22:28:32 +03:00
|
|
|
if(QUIC_PGO)
|
2020-06-12 18:24:32 +03:00
|
|
|
# Configured for training mode. Use the previous PGD file if present.
|
|
|
|
if(EXISTS "${QUIC_PGO_FILE}")
|
|
|
|
message(STATUS "/GENPROFILE:PDG")
|
2022-02-26 00:01:16 +03:00
|
|
|
configure_file("${QUIC_PGO_FILE}" "${QUIC_PGO_DIR}/msquic.pgd" COPYONLY)
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /GENPROFILE:\"PGD=${QUIC_PGO_DIR}/msquic.pgd\"")
|
2020-06-12 18:24:32 +03:00
|
|
|
else()
|
|
|
|
message(STATUS "/GENPROFILE")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /GENPROFILE")
|
|
|
|
endif()
|
2021-11-24 19:40:48 +03:00
|
|
|
set(CMAKE_VS_SDK_LIBRARY_DIRECTORIES "$(LibraryPath);$(VC_LibraryPath_VC_${SYSTEM_PROCESSOR}_Desktop)")
|
2020-06-12 18:24:32 +03:00
|
|
|
else()
|
|
|
|
# Just doing a normal build. Use the PGD file if present.
|
|
|
|
if(EXISTS "${QUIC_PGO_FILE}")
|
|
|
|
message(STATUS "Using profile-guided optimization")
|
2022-02-26 00:01:16 +03:00
|
|
|
file(MAKE_DIRECTORY ${QUIC_PGO_DIR})
|
|
|
|
configure_file("${QUIC_PGO_FILE}" "${QUIC_PGO_DIR}/msquic.pgd" COPYONLY)
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /USEPROFILE:\"PGD=${QUIC_PGO_DIR}/msquic.pgd\"")
|
2020-06-12 18:24:32 +03:00
|
|
|
endif()
|
2020-05-26 22:28:32 +03:00
|
|
|
endif()
|
2020-06-12 18:24:32 +03:00
|
|
|
|
2020-05-13 05:08:05 +03:00
|
|
|
if(QUIC_STATIC_LINK_CRT)
|
|
|
|
message(STATUS "Configuring for statically-linked CRT")
|
|
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
|
|
|
endif()
|
|
|
|
|
2022-08-10 15:17:53 +03:00
|
|
|
if(QUIC_STATIC_LINK_PARTIAL_CRT)
|
|
|
|
message(STATUS "Configuring for partially statically-linked CRT")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")
|
|
|
|
endif()
|
|
|
|
|
2023-07-05 22:08:43 +03:00
|
|
|
if (NOT QUIC_STATIC_LINK_CRT AND NOT QUIC_STATIC_LINK_PARTIAL_CRT)
|
|
|
|
# We are using dynamic linking. Ensure that only the release version of CRT is used.
|
|
|
|
message(STATUS "Configuring for release version of dynamically linked CRT")
|
|
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
|
|
|
|
endif()
|
|
|
|
|
2021-06-23 00:26:37 +03:00
|
|
|
else() #!WIN32
|
2020-05-13 05:08:05 +03:00
|
|
|
# Custom build flags.
|
2020-08-05 22:40:00 +03:00
|
|
|
|
2020-08-28 22:45:10 +03:00
|
|
|
if (QUIC_OPTIMIZE_LOCAL AND NOT CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
|
|
|
|
set(MARCH -march=native)
|
|
|
|
endif()
|
2021-08-19 22:22:19 +03:00
|
|
|
|
2023-02-09 03:24:15 +03:00
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-Og -fno-omit-frame-pointer")
|
2020-08-28 22:45:10 +03:00
|
|
|
set(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
|
2023-02-09 03:24:15 +03:00
|
|
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -fno-omit-frame-pointer ${MARCH} -DNDEBUG")
|
2021-06-17 17:57:05 +03:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "-O3 ${MARCH} -DNDEBUG")
|
2021-08-19 22:22:19 +03:00
|
|
|
if (CX_PLATFORM STREQUAL "darwin")
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf")
|
|
|
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -gdwarf")
|
|
|
|
else()
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb3")
|
|
|
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb3")
|
|
|
|
endif()
|
2020-08-28 22:45:10 +03:00
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
|
|
|
|
set(CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_C_FLAGS_MINSIZEREL})
|
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
|
|
|
|
|
2020-07-29 00:06:34 +03:00
|
|
|
list(APPEND QUIC_COMMON_FLAGS -fms-extensions -fPIC)
|
2021-01-13 03:52:23 +03:00
|
|
|
if (CX_PLATFORM STREQUAL "darwin")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES CX_PLATFORM_DARWIN)
|
2020-07-29 00:06:34 +03:00
|
|
|
list(APPEND QUIC_COMMON_FLAGS -Wno-microsoft-anon-tag -Wno-tautological-constant-out-of-range-compare -Wmissing-field-initializers)
|
2021-06-23 00:26:37 +03:00
|
|
|
message(STATUS "Disabling (client) shared port support")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_DISABLE_SHARED_PORT_TESTS)
|
2020-06-25 23:35:59 +03:00
|
|
|
else()
|
2021-01-13 03:52:23 +03:00
|
|
|
list(APPEND QUIC_COMMON_DEFINES CX_PLATFORM_LINUX)
|
2021-06-23 00:26:37 +03:00
|
|
|
message(STATUS "Enabling shared ephemeral port work around")
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES QUIC_SHARED_EPHEMERAL_WORKAROUND)
|
2020-06-25 23:35:59 +03:00
|
|
|
endif()
|
2020-05-13 05:08:05 +03:00
|
|
|
|
2020-08-14 18:20:12 +03:00
|
|
|
if(QUIC_ENABLE_SANITIZERS)
|
|
|
|
message(STATUS "Configuring sanitizers")
|
2022-12-14 21:33:24 +03:00
|
|
|
list(APPEND QUIC_COMMON_FLAGS -fsanitize=address,leak,undefined,alignment -fsanitize-address-use-after-scope -Og -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments)
|
2021-08-19 22:22:19 +03:00
|
|
|
if (CX_PLATFORM STREQUAL "darwin")
|
|
|
|
list(APPEND QUIC_COMMON_FLAGS -gdwarf)
|
|
|
|
else()
|
|
|
|
list(APPEND QUIC_COMMON_FLAGS -ggdb3)
|
|
|
|
endif()
|
2020-08-14 18:20:12 +03:00
|
|
|
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
|
|
|
|
list(APPEND QUIC_COMMON_FLAGS -fsanitize=unsigned-integer-overflow -fsanitize=local-bounds -fsanitize=integer -fsanitize=nullability)
|
|
|
|
endif()
|
2020-05-13 05:08:05 +03:00
|
|
|
endif()
|
|
|
|
|
2020-07-29 00:06:34 +03:00
|
|
|
set(QUIC_C_FLAGS ${QUIC_COMMON_FLAGS})
|
2020-08-28 22:45:10 +03:00
|
|
|
set(QUIC_CXX_FLAGS ${QUIC_COMMON_FLAGS})
|
2020-05-13 05:08:05 +03:00
|
|
|
endif()
|
|
|
|
|
2023-02-01 17:30:43 +03:00
|
|
|
if(QUIC_TLS STREQUAL "openssl" OR QUIC_TLS STREQUAL "openssl3")
|
2021-08-10 23:33:11 +03:00
|
|
|
add_library(OpenSSL INTERFACE)
|
2021-08-09 21:51:12 +03:00
|
|
|
|
2021-08-10 23:33:11 +03:00
|
|
|
include(FetchContent)
|
|
|
|
|
|
|
|
FetchContent_Declare(
|
|
|
|
OpenSSLQuic
|
|
|
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/submodules
|
|
|
|
CMAKE_ARGS "-DQUIC_USE_SYSTEM_LIBCRYPTO=${QUIC_USE_SYSTEM_LIBCRYPTO}"
|
|
|
|
)
|
|
|
|
FetchContent_MakeAvailable(OpenSSLQuic)
|
|
|
|
|
|
|
|
target_link_libraries(OpenSSL
|
|
|
|
INTERFACE
|
|
|
|
OpenSSLQuic::OpenSSLQuic
|
|
|
|
)
|
2020-05-13 05:08:05 +03:00
|
|
|
endif()
|
|
|
|
|
2023-02-15 16:45:23 +03:00
|
|
|
if (QUIC_USE_SYSTEM_LIBCRYPTO)
|
|
|
|
list(APPEND QUIC_COMMON_DEFINES CXPLAT_SYSTEM_CRYPTO)
|
|
|
|
endif()
|
|
|
|
|
2020-08-10 22:37:30 +03:00
|
|
|
if(QUIC_CODE_CHECK)
|
|
|
|
find_program(CLANGTIDY NAMES clang-tidy)
|
|
|
|
if(CLANGTIDY)
|
|
|
|
message(STATUS "Found clang-tidy: ${CLANGTIDY}")
|
|
|
|
set(CLANG_TIDY_CHECKS *
|
2020-12-07 20:55:58 +03:00
|
|
|
# add checks to ignore here:
|
2022-02-24 00:26:05 +03:00
|
|
|
-altera-*
|
2020-12-07 20:55:58 +03:00
|
|
|
-android-cloexec-fopen
|
2021-07-21 17:09:55 +03:00
|
|
|
-android-cloexec-socket
|
2022-10-17 16:39:56 +03:00
|
|
|
-bugprone-assignment-in-if-condition
|
2024-07-09 01:01:16 +03:00
|
|
|
-bugprone-casting-through-void
|
2022-02-24 00:26:05 +03:00
|
|
|
-bugprone-easily-swappable-parameters
|
|
|
|
-bugprone-implicit-widening-of-multiplication-result
|
2020-12-07 20:55:58 +03:00
|
|
|
-bugprone-macro-parentheses
|
2024-07-09 01:01:16 +03:00
|
|
|
-bugprone-multi-level-implicit-pointer-conversion
|
2021-07-21 17:09:55 +03:00
|
|
|
-bugprone-narrowing-conversions
|
|
|
|
-bugprone-reserved-identifier
|
2020-12-07 20:55:58 +03:00
|
|
|
-bugprone-sizeof-expression
|
2024-07-09 01:01:16 +03:00
|
|
|
-bugprone-switch-missing-default-case
|
2021-07-21 17:09:55 +03:00
|
|
|
-cert-dcl37-c
|
|
|
|
-cert-dcl51-cpp
|
2022-10-17 16:39:56 +03:00
|
|
|
-cert-err33-c
|
2024-07-09 01:01:16 +03:00
|
|
|
-clang-analyzer-optin.core.EnumCastOutOfRange
|
2020-12-07 20:55:58 +03:00
|
|
|
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
|
2024-07-09 01:01:16 +03:00
|
|
|
-clang-diagnostic-invalid-unevaluated-string
|
2020-12-07 20:55:58 +03:00
|
|
|
-clang-diagnostic-microsoft-anon-tag
|
2021-07-21 17:09:55 +03:00
|
|
|
-concurrency-mt-unsafe
|
2020-12-07 20:55:58 +03:00
|
|
|
-cppcoreguidelines-avoid-magic-numbers
|
|
|
|
-cppcoreguidelines-avoid-non-const-global-variables
|
|
|
|
-cppcoreguidelines-init-variables
|
2024-07-09 01:01:16 +03:00
|
|
|
-cppcoreguidelines-macro-to-enum
|
2021-07-21 17:09:55 +03:00
|
|
|
-cppcoreguidelines-narrowing-conversions
|
2024-07-09 01:01:16 +03:00
|
|
|
-google-readability-casting
|
2022-10-25 01:19:41 +03:00
|
|
|
-google-readability-function-size
|
2020-12-07 20:55:58 +03:00
|
|
|
-google-readability-todo
|
2022-10-25 01:19:41 +03:00
|
|
|
-hicpp-function-size
|
2020-12-07 20:55:58 +03:00
|
|
|
-hicpp-no-assembler
|
|
|
|
-hicpp-signed-bitwise
|
|
|
|
-llvmlibc-restrict-system-libc-headers
|
2024-07-09 01:01:16 +03:00
|
|
|
-misc-include-cleaner
|
2020-12-07 20:55:58 +03:00
|
|
|
-misc-no-recursion # do you really need recursion?
|
2024-07-09 01:01:16 +03:00
|
|
|
-misc-header-include-cycle
|
2022-10-25 01:19:41 +03:00
|
|
|
-modernize-macro-to-enum
|
2020-12-07 20:55:58 +03:00
|
|
|
-readability-avoid-const-params-in-decls
|
2024-07-09 01:01:16 +03:00
|
|
|
-readability-avoid-nested-conditional-operator
|
2022-10-17 16:39:56 +03:00
|
|
|
-readability-duplicate-include
|
2021-07-21 17:09:55 +03:00
|
|
|
-readability-function-cognitive-complexity
|
2022-10-25 01:19:41 +03:00
|
|
|
-readability-function-size
|
2022-10-17 16:39:56 +03:00
|
|
|
-readability-identifier-length
|
2024-07-09 01:01:16 +03:00
|
|
|
-readability-identifier-naming
|
2020-12-07 20:55:58 +03:00
|
|
|
-readability-isolate-declaration
|
|
|
|
-readability-magic-numbers
|
|
|
|
-readability-non-const-parameter
|
2024-07-09 01:01:16 +03:00
|
|
|
-readability-redundant-casting
|
2020-08-10 22:37:30 +03:00
|
|
|
)
|
|
|
|
string(REPLACE ";" "," CLANG_TIDY_CHECKS "${CLANG_TIDY_CHECKS}")
|
2020-12-07 20:55:58 +03:00
|
|
|
set(CMAKE_C_CLANG_TIDY_AVAILABLE ${CLANGTIDY} -checks=${CLANG_TIDY_CHECKS}
|
|
|
|
-system-headers --warnings-as-errors=*)
|
2020-08-10 22:37:30 +03:00
|
|
|
else()
|
|
|
|
message(STATUS "clang-tidy not found")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
find_program(CPPCHECK NAMES cppcheck)
|
|
|
|
if(CPPCHECK)
|
|
|
|
message(STATUS "Found cppcheck: ${CPPCHECK}")
|
2020-12-07 20:55:58 +03:00
|
|
|
set(CMAKE_C_CPPCHECK_AVAILABLE ${CPPCHECK} -q --inline-suppr
|
|
|
|
--suppress=duplicateValueTernary --suppress=objectIndex
|
2022-02-24 00:26:05 +03:00
|
|
|
--suppress=varFuncNullUB --suppress=constParameter
|
2020-12-07 20:55:58 +03:00
|
|
|
# these are finding potential logic issues, may want to suppress when focusing on nits:
|
|
|
|
--suppress=nullPointer --suppress=nullPointerRedundantCheck
|
2022-02-24 00:26:05 +03:00
|
|
|
--suppress=knownConditionTrueFalse --suppress=invalidscanf
|
2020-08-10 22:37:30 +03:00
|
|
|
--enable=warning,style,performance,portability -D__linux__)
|
|
|
|
else()
|
|
|
|
message(STATUS "cppcheck not found")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-07-29 00:06:34 +03:00
|
|
|
add_subdirectory(src/inc)
|
2021-07-23 22:07:27 +03:00
|
|
|
add_subdirectory(src/generated)
|
2020-07-29 00:06:34 +03:00
|
|
|
|
2020-05-13 05:08:05 +03:00
|
|
|
# Product code
|
|
|
|
add_subdirectory(src/core)
|
|
|
|
add_subdirectory(src/platform)
|
|
|
|
add_subdirectory(src/bin)
|
|
|
|
|
|
|
|
# Tool code
|
|
|
|
if(QUIC_BUILD_TOOLS)
|
2020-07-29 00:06:34 +03:00
|
|
|
add_subdirectory(src/tools)
|
2020-05-13 05:08:05 +03:00
|
|
|
endif()
|
|
|
|
|
2020-07-30 02:31:27 +03:00
|
|
|
# Performance code
|
|
|
|
if(QUIC_BUILD_PERF)
|
|
|
|
add_subdirectory(src/perf/lib)
|
|
|
|
add_subdirectory(src/perf/bin)
|
|
|
|
endif()
|
|
|
|
|
2020-05-13 05:08:05 +03:00
|
|
|
# Test code
|
|
|
|
if(QUIC_BUILD_TEST)
|
2021-06-28 00:03:07 +03:00
|
|
|
include(FetchContent)
|
2020-06-25 23:35:59 +03:00
|
|
|
|
2020-05-13 05:08:05 +03:00
|
|
|
enable_testing()
|
2021-07-01 00:12:48 +03:00
|
|
|
|
2021-06-28 00:03:07 +03:00
|
|
|
# Build the googletest framework.
|
|
|
|
|
|
|
|
# Enforce static builds for test artifacts
|
|
|
|
set(PREV_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS} CACHE INTERNAL "")
|
|
|
|
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
|
2021-07-30 03:06:10 +03:00
|
|
|
set(BUILD_GMOCK OFF CACHE BOOL "Builds the googlemock subproject")
|
|
|
|
set(INSTALL_GTEST OFF CACHE BOOL "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)")
|
|
|
|
if(WIN32 AND QUIC_STATIC_LINK_CRT)
|
|
|
|
option(gtest_force_shared_crt "Use shared (DLL) run-time lib even when Google Test is built as static lib." ON)
|
|
|
|
endif()
|
2021-06-28 00:03:07 +03:00
|
|
|
FetchContent_Declare(
|
|
|
|
googletest
|
|
|
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/submodules/googletest
|
|
|
|
)
|
|
|
|
FetchContent_MakeAvailable(googletest)
|
|
|
|
set(BUILD_SHARED_LIBS ${PREV_BUILD_SHARED_LIBS} CACHE INTERNAL "")
|
2020-05-13 05:08:05 +03:00
|
|
|
|
2021-02-12 21:58:41 +03:00
|
|
|
set_property(TARGET gtest PROPERTY CXX_STANDARD 17)
|
2021-06-28 00:03:07 +03:00
|
|
|
set_property(TARGET gtest PROPERTY FOLDER "${QUIC_FOLDER_PREFIX}tests")
|
2021-07-30 03:06:10 +03:00
|
|
|
|
|
|
|
set_property(TARGET gtest_main PROPERTY CXX_STANDARD 17)
|
2021-06-28 00:03:07 +03:00
|
|
|
set_property(TARGET gtest_main PROPERTY FOLDER "${QUIC_FOLDER_PREFIX}tests")
|
2021-07-30 03:06:10 +03:00
|
|
|
set_property(TARGET gtest_main PROPERTY EXCLUDE_FROM_ALL ON)
|
|
|
|
set_property(TARGET gtest_main PROPERTY EXCLUDE_FROM_DEFAULT_BUILD ON)
|
2020-06-05 18:11:55 +03:00
|
|
|
|
2021-08-03 02:04:55 +03:00
|
|
|
if (HAS_SPECTRE)
|
|
|
|
target_compile_options(gtest PRIVATE /Qspectre)
|
|
|
|
target_compile_options(gtest_main PRIVATE /Qspectre)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (HAS_GUARDCF)
|
|
|
|
target_compile_options(gtest PRIVATE /guard:cf)
|
|
|
|
target_compile_options(gtest_main PRIVATE /guard:cf)
|
|
|
|
endif()
|
|
|
|
|
2024-02-06 22:21:25 +03:00
|
|
|
if(WIN32 AND QUIC_ENABLE_SANITIZERS)
|
|
|
|
target_compile_options(gtest PRIVATE /fsanitize=address)
|
|
|
|
target_compile_options(gtest_main PRIVATE /fsanitize=address)
|
|
|
|
target_compile_definitions(gtest PRIVATE _DISABLE_VECTOR_ANNOTATION)
|
|
|
|
target_compile_definitions(gtest_main PRIVATE _DISABLE_VECTOR_ANNOTATION)
|
|
|
|
endif()
|
|
|
|
|
2020-05-13 05:08:05 +03:00
|
|
|
add_subdirectory(src/core/unittest)
|
|
|
|
add_subdirectory(src/platform/unittest)
|
|
|
|
add_subdirectory(src/test/lib)
|
|
|
|
add_subdirectory(src/test/bin)
|
|
|
|
endif()
|