-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
212 lines (165 loc) · 5.25 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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
cmake_minimum_required(VERSION 3.11)
set (CMAKE_CONFIGURATION_TYPES "Debug;Release")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
#set(dir ${CMAKE_CURRENT_SOURCE_DIR}/build)
project(aes67)
################
################ User Options
################
# Which port to use
# see dir ports (ie macos, unix)
# if not set assumes is setup will guess based on platform
#set(AES67_PORT "macos")
# Explicitly specify which mDNS backend implementation to use:
# - dnssd
# - avahi
# If not set, will try to guess based on platform.
#set(AES67_MDNS "dnssd")
# Compile Ravenna support into sapd
set(SAPD_WITH_RAV TRUE)
################
################ Core Configuration
################
set(AES67_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(AES67_INCLUDE_DIRS
${AES67_DIR}/src/include
${AES67_DIR}/src/third_party
)
set(AES67_THIRDPARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/third_party")
set(CMAKE_C_FLAGS "-Wall -O")
set(AES67_INCLUDES
${AES67_DIR}/src/include/aes67/opt.h
${AES67_DIR}/src/include/aes67/arch.h
${AES67_DIR}/src/include/aes67/debug.h
${AES67_DIR}/src/include/aes67/def.h
${AES67_DIR}/src/include/aes67/net.h
${AES67_DIR}/src/include/aes67/ptp.h
${AES67_DIR}/src/include/aes67/sdp.h
${AES67_DIR}/src/include/aes67/sap.h
${AES67_DIR}/src/include/aes67/rtp-avp.h
${AES67_DIR}/src/include/aes67/rtp.h
${AES67_DIR}/src/include/aes67/audio.h
${AES67_DIR}/src/include/aes67/eth.h
${AES67_DIR}/src/include/aes67/host/time.h
${AES67_DIR}/src/include/aes67/host/timer.h
# src/include/aes67/host/sock.h
)
set(AES67_SOURCE_FILES
${AES67_DIR}/src/core/def.c
${AES67_DIR}/src/core/net.c
${AES67_DIR}/src/core/sdp.c
${AES67_DIR}/src/core/sap.c
${AES67_DIR}/src/core/rtp.c
${AES67_DIR}/src/core/eth.c
)
################
################ Platform Port
################
if (NOT DEFINED ${AES67_PORT})
message(STATUS "No aes67 ports specified, trying to guess")
if (APPLE)
set(AES67_PORT "macos")
elseif(UNIX)
set(AES67_PORT "unix")
elseif(WIN32)
set(AES67_PORT "win32")
endif()
endif()
message(STATUS "aes67 platform/port: ${AES67_PORT}")
if(AES67_PORT)
set(AES67_PORT_DIR "${AES67_DIR}/ports/${AES67_PORT}")
set(AES67_PORT_LIB "aes67-port-${AES67_PORT}")
add_subdirectory("${AES67_PORT_DIR}")
else()
message(FATAL_ERROR "no port defined!")
endif()
################
################ mDNS backend
################
if (NOT DEFINED ${AES67_MDNS})
message(STATUS "No mDNS backend selected, trying to guess")
if (APPLE)
set(AES67_MDNS "dnssd")
elseif(UNIX)
set(AES67_MDNS "avahi")
elseif(WIN32)
# assume that windows machines will use bonjour
set(AES67_MDNS "dnssd")
endif()
endif()
message(STATUS "mDNS backend: ${AES67_MDNS}")
if ("${AES67_MDNS}" STREQUAL "dnssd")
find_package(DNSSD REQUIRED)
set(AES67_MDNS_SOURCE_FILES
${AES67_DIR}/src/utils/mdns-dnssd.c
)
set(AES67_MDNS_INCLUDE_DIRS ${DNSSD_INCLUDE_DIRS})
set(AES67_MDNS_LIBRARIES ${DNSSD_LIBRARIES})
elseif("${AES67_MDNS}" STREQUAL "avahi")
find_package(Avahi REQUIRED)
set(AES67_MDNS_SOURCE_FILES ${AES67_DIR}/src/utils/mdns-avahi.c)
set(AES67_MDNS_INCLUDE_DIRS ${Avahi_CLIENT_INCLUDE_DIRS})
set(AES67_MDNS_LIBRARIES ${Avahi_COMMON_LIBRARY} ${Avahi_CLIENT_LIBRARY})
elseif(DEFINED AES67_MDNS)
message(ERROR "mDNS option '${AES67_MDNS}' unknown")
endif()
# Archive
list(APPEND AES67_TARGET_LIST aes67)
add_library(aes67 STATIC
${AES67_INCLUDES}
${AES67_SOURCE_FILES}
)
target_include_directories(aes67 PRIVATE
${AES67_DIR}
${AES67_PORT_INCLUDE_DIRS}
)
target_include_directories(aes67 PUBLIC
${AES67_INCLUDE_DIRS}
)
target_link_libraries(aes67 ${AES67_PORT_LIB})
# Shared library
#list(APPEND AES67_TARGET_LIST caes67)
#add_library(caes67 SHARED
# ${AES67_INCLUDES}
# ${AES67_SOURCE_FILES}
# )
#target_include_directories(caes67 PRIVATE
# ${AES67_DIR}
# ${AES67_PORT_INCLUDE_DIRS}
# )
#target_include_directories(caes67 PUBLIC
# ${AES67_INCLUDE_DIRS}
# )
set_property(TARGET aes67 PROPERTY C_STANDARD 99)
set_property(TARGET aes67 PROPERTY LINKER_LANGUAGE C)
add_subdirectory("${AES67_DIR}/test" EXCLUDE_FROM_ALL)
#if(NOT ${AES67_WITHOUT_UTILS})
add_subdirectory("${AES67_DIR}/src/utils")
#endif()
#list(APPEND AES67_TARGET_LIST mytest)
#add_executable(mytest test.c)
#target_include_directories(mytest PRIVATE
# ${AES67_DIR}
# ${AES67_PORT_INCLUDE_DIRS}
# )
#target_link_libraries(mytest aes67 ${AES67_PORT_LIB})
if(CMAKE_BUILD_TYPE MATCHES Debug)
foreach(TARGET IN LISTS AES67_TARGET_LIST)
target_compile_definitions(${TARGET} PUBLIC DEBUG=1)
endforeach()
elseif(CMAKE_BUILD_TYPE MATCHES Release)
foreach(TARGET IN LISTS AES67_TARGET_LIST)
target_compile_definitions(${TARGET} PUBLIC RELEASE=1)
endforeach()
endif()
install(TARGETS
aes67
sap-pack
sap-unpack
sapd
sdp-gen
sdp-parse
rtsp-describe
rav-lookup
)
install(DIRECTORY "${AES67_DIR}/src/include/aes67" DESTINATION include)