-
-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
137 lines (122 loc) · 3.94 KB
/
CMakeLists.txt
File metadata and controls
137 lines (122 loc) · 3.94 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
cmake_minimum_required(VERSION 3.16)
project(smolrtsp LANGUAGES C)
# Fix the warnings about `DOWNLOAD_EXTRACT_TIMESTAMP` in newer CMake versions.
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()
option(SMOLRTSP_SHARED "Build a shared library" OFF)
option(SMOLRTSP_FULL_MACRO_EXPANSION "Show full macro expansion backtraces" OFF)
include(FetchContent)
FetchContent_Declare(
slice99
URL https://github.com/hirrolot/slice99/archive/refs/tags/v0.7.8.tar.gz
)
FetchContent_Declare(
metalang99
URL https://github.com/hirrolot/metalang99/archive/refs/tags/v1.13.5.tar.gz
)
FetchContent_Declare(
datatype99
URL https://github.com/hirrolot/datatype99/archive/refs/tags/v1.6.5.tar.gz
)
FetchContent_Declare(
interface99
URL https://github.com/hirrolot/interface99/archive/refs/tags/v1.0.2.tar.gz
)
FetchContent_MakeAvailable(slice99 datatype99 interface99)
set(SMOLRTSP_SOURCES
include/smolrtsp/types/error.h
include/smolrtsp/types/header_map.h
include/smolrtsp/types/header.h
include/smolrtsp/types/message_body.h
include/smolrtsp/types/method.h
include/smolrtsp/types/reason_phrase.h
include/smolrtsp/types/request_line.h
include/smolrtsp/types/request_uri.h
include/smolrtsp/types/request.h
include/smolrtsp/types/response_line.h
include/smolrtsp/types/response.h
include/smolrtsp/types/rtsp_version.h
include/smolrtsp/types/status_code.h
include/smolrtsp/types/sdp.h
include/smolrtsp/types/rtp.h
include/smolrtsp/nal/h264.h
include/smolrtsp/nal/h265.h
include/smolrtsp/nal.h
include/smolrtsp/writer.h
include/smolrtsp/util.h
include/smolrtsp/transport.h
include/smolrtsp/rtp_transport.h
include/smolrtsp/nal_transport.h
include/smolrtsp/droppable.h
include/smolrtsp/controller.h
include/smolrtsp/io_vec.h
include/smolrtsp/context.h
include/smolrtsp/option.h
src/types/error.c
src/types/header_map.c
src/types/header.c
src/types/message_body.c
src/types/method.c
src/types/parsing.c
src/types/parsing.h
src/types/reason_phrase.c
src/types/request_line.c
src/types/request_uri.c
src/types/request.c
src/types/response_line.c
src/types/response.c
src/types/rtsp_version.c
src/types/status_code.c
src/types/sdp.c
src/types/rtp.c
src/nal/h264.c
src/nal/h265.c
src/nal.c
src/writer.c
src/writer/fd.c
src/writer/file.c
src/writer/string.c
src/util.c
src/transport/tcp.c
src/transport/udp.c
src/rtp_transport.c
src/nal_transport.c
src/io_vec.c
src/controller.c
src/context.c
src/macros.h
)
if(SMOLRTSP_SHARED)
add_library(${PROJECT_NAME} SHARED ${SMOLRTSP_SOURCES})
else()
add_library(${PROJECT_NAME} STATIC ${SMOLRTSP_SOURCES})
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wno-misleading-indentation)
endif()
if(NOT SMOLRTSP_FULL_MACRO_EXPANSION)
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(${PROJECT_NAME} PUBLIC -fmacro-backtrace-limit=1)
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
target_compile_options(${PROJECT_NAME} PUBLIC -ftrack-macro-expansion=0)
endif()
endif()
# Precompile headers that use Datatype99/Interface99.
target_precompile_headers(
${PROJECT_NAME} PRIVATE
include/smolrtsp/types/error.h
include/smolrtsp/nal/h264.h
include/smolrtsp/nal/h265.h
include/smolrtsp/nal.h
include/smolrtsp/writer.h
include/smolrtsp/transport.h
include/smolrtsp/droppable.h
include/smolrtsp/controller.h
include/smolrtsp/rtp_transport.h
include/smolrtsp/util.h)
target_include_directories(${PROJECT_NAME} PUBLIC include)
target_link_libraries(${PROJECT_NAME} PUBLIC slice99 metalang99 datatype99 interface99)
set_target_properties(${PROJECT_NAME} PROPERTIES C_STANDARD 99 C_STANDARD_REQUIRED ON)