1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-04-18 17:24:03 +03:00
mvfst/CMakeLists.txt
Hani Damlaj 2660a288b3 Update Company Name
Summary: - as title

Reviewed By: lnicco

Differential Revision: D33513410

fbshipit-source-id: 282b6f512cf83b9abb7990402661135b658f7bd1
2022-01-13 12:07:48 -08:00

131 lines
3.3 KiB
CMake

# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.10)
project(mvfst)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
# for in-fbsource builds
"${CMAKE_CURRENT_SOURCE_DIR}/opensource/fbcode_builder/CMake"
# For shipit-transformed builds
"${CMAKE_CURRENT_SOURCE_DIR}/build/fbcode_builder/CMake"
${CMAKE_MODULE_PATH})
include(FBBuildOptions)
fb_activate_static_library_option()
# QUIC_FBCODE_ROOT is where the top level quic/ directory resides, so
# an #include <quic/path/to/file> will resolve to
# $QUIC_FBCODE_ROOT/quic/path/to/file on disk
set(QUIC_FBCODE_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
# Dependencies
find_package(Boost 1.62
REQUIRED COMPONENTS
iostreams
system
thread
filesystem
regex
context
date_time
program_options
)
find_package(fmt REQUIRED)
find_package(folly REQUIRED)
find_package(Fizz REQUIRED)
find_package(Glog REQUIRED)
find_package(Threads)
if(DEFINED CCP_ENABLED)
find_package(libccp REQUIRED)
set(LIBCCP_LIBRARY libccp::ccp_static)
# mvfst implementation of ccp is guarded with ifdef CCP_ENABLED
add_compile_definitions(CCP_ENABLED=${CCP_ENABLED})
# libccp header files include extern c if __CPLUSPLUS__ is defined
add_compile_definitions(__CPLUSPLUS__=1)
endif()
SET(GFLAG_DEPENDENCIES "")
SET(QUIC_EXTRA_LINK_LIBRARIES "")
SET(QUIC_EXTRA_INCLUDE_DIRECTORIES "")
find_package(gflags CONFIG QUIET)
if (gflags_FOUND)
message(STATUS "Found gflags from package config")
if (TARGET gflags-shared)
list(APPEND GFLAG_DEPENDENCIES gflags-shared)
elseif (TARGET gflags)
list(APPEND GFLAG_DEPENDENCIES gflags)
else()
message(FATAL_ERROR "Unable to determine the target name for the GFlags package.")
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARIES})
list(APPEND CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
else()
find_package(Gflags REQUIRED MODULE)
list(APPEND QUIC_EXTRA_LINK_LIBRARIES ${LIBGFLAGS_LIBRARY})
list(APPEND QUIC_EXTRA_INCLUDE_DIRECTORIES ${LIBGFLAGS_INCLUDE_DIR})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBGFLAGS_LIBRARY})
list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBGFLAGS_INCLUDE_DIR})
endif()
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND
_QUIC_BASE_COMPILE_OPTIONS
-Wall
-Wextra
)
endif()
list(APPEND
_QUIC_COMMON_COMPILE_OPTIONS
${_QUIC_BASE_COMPILE_OPTIONS}
)
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND
_QUIC_COMMON_COMPILE_OPTIONS
-Woverloaded-virtual
-Wnon-virtual-dtor
-Wtype-limits
-Wunused-value
)
endif()
SET(LIBFIZZ_LIBRARY ${FIZZ_LIBRARIES})
SET(LIBFIZZ_INCLUDE_DIR ${FIZZ_INCLUDE_DIR})
if(BUILD_TESTS)
enable_testing()
include(QuicTest)
endif()
add_subdirectory(quic)
install(
EXPORT mvfst-exports
FILE mvfst-targets.cmake
NAMESPACE mvfst::
DESTINATION lib/cmake/mvfst/
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/mvfst-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/mvfst-config.cmake
INSTALL_DESTINATION lib/cmake/mvfst/
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/mvfst-config.cmake
DESTINATION lib/cmake/mvfst/
)