This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
94 lines (75 loc) · 1.99 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
cmake_minimum_required(VERSION 3.17)
project(quicr-transport
VERSION 1.0.0.0
DESCRIPTION "transport lib for QUICR project"
LANGUAGES CXX)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
option(QTRANSPORT_BUILD_TESTS "Build tests for quicr transport" ON)
else()
option(QTRANSPORT_BUILD_TESTS "Build tests for quicr transport" OFF)
endif()
option(PLATFORM_ESP_IDF "Enabble suppport for esp-idf (Default OFF)" OFF)
option(USE_MBEDTLS OFF)
option(LINT "Lint using clang-tidy" OFF)
if (NOT PLATFORM_ESP_IDF)
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
else()
set(USE_MBEDTLS ON)
endif()
###
### Dependencies
###
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
add_subdirectory(dependencies)
###
### Main code
###
set (BUILD_SHARED_LIBS OFF)
set (BUILD_STATIC_LIBS ON)
set (sources
src/transport.cpp
src/transport_udp.cpp
)
if (NOT PLATFORM_ESP_IDF)
list(APPEND sources src/transport_picoquic.cpp)
endif()
add_library(quicr-transport ${sources})
target_link_libraries(quicr-transport
PUBLIC
spdlog
)
if (NOT PLATFORM_ESP_IDF)
target_link_libraries(quicr-transport
PUBLIC
picoquic-core picoquic-log)
endif()
if (PLATFORM_ESP_IDF)
add_compile_definitions(${LIB_NAME} PLATFORM_ESP)
endif()
target_include_directories(quicr-transport PUBLIC include src )
set_target_properties(quicr-transport
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS OFF)
# linting
if (LINT)
include(Lint)
lint(quicr-transport)
endif (LINT)
target_compile_options(quicr-transport
PRIVATE
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:GNU>>: -Wpedantic -Wextra -Wall>
$<$<C_COMPILER_ID:MSVC>: >)
if(MSVC)
target_compile_definitions(quicr-transport _CRT_SECURE_NO_WARNINGS)
endif()
###
### Applications
###
if(BUILD_TESTING AND QTRANSPORT_BUILD_TESTS)
enable_testing()
add_subdirectory(cmd)
add_subdirectory(test)
endif()