forked from COVESA/Open1722
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
128 lines (103 loc) · 4.34 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
cmake_minimum_required(VERSION 3.20)
project(open1722 VERSION 0.1)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
#### Libraries ################################################################
# PDU parsing library
add_library(open1722pdu SHARED
"src/avtp/CommonHeader.c"
"src/avtp/Crf.c"
"src/avtp/Rvf.c"
"src/avtp/Udp.c"
"src/avtp/Utils.c"
"src/avtp/aaf/CommonStream.c"
"src/avtp/aaf/PcmStream.c"
"src/avtp/acf/Can.c"
"src/avtp/acf/CanBrief.c"
"src/avtp/acf/Common.c"
"src/avtp/acf/Ntscf.c"
"src/avtp/acf/Sensor.c"
"src/avtp/acf/SensorBrief.c"
"src/avtp/acf/Tscf.c"
"src/avtp/cvf/Cvf.c"
"src/avtp/cvf/H264.c"
"src/avtp/cvf/Jpeg2000.c"
"src/avtp/cvf/Mjpeg.c")
target_include_directories(open1722pdu PRIVATE "include")
#### Examples #################################################################
# Common library accross all examples
add_library(open1722examples STATIC "examples/common/common.c")
target_include_directories(open1722examples PRIVATE "examples" "include")
# AAF listener app
add_executable(aaf-listener "examples/aaf/aaf-listener.c")
target_include_directories(aaf-listener PRIVATE "examples" "include")
target_link_libraries(aaf-listener open1722pdu open1722examples)
# AAF talker app
add_executable(aaf-talker "examples/aaf/aaf-talker.c")
target_include_directories(aaf-talker PRIVATE "examples" "include")
target_link_libraries(aaf-talker open1722pdu open1722examples)
# CAN talker app
add_executable(acf-can-talker "examples/acf-can/acf-can-talker.c")
target_include_directories(acf-can-talker PRIVATE "examples" "include")
target_link_libraries(acf-can-talker open1722pdu open1722examples)
# CAN listener app
add_executable(acf-can-listener "examples/acf-can/acf-can-listener.c")
target_include_directories(acf-can-listener PRIVATE "examples" "include")
target_link_libraries(acf-can-listener open1722pdu open1722examples)
# CRF talker app
add_executable(crf-talker "examples/crf/crf-talker.c")
target_include_directories(crf-talker PRIVATE "examples" "include")
target_link_libraries(crf-talker open1722pdu open1722examples m)
# CRF listener app
add_executable(crf-listener "examples/crf/crf-listener.c")
target_include_directories(crf-listener PRIVATE "examples" "include")
target_link_libraries(crf-listener open1722pdu open1722examples m)
# CVF talker app
add_executable(cvf-talker "examples/cvf/cvf-talker.c")
target_include_directories(cvf-talker PRIVATE "examples" "include")
target_link_libraries(cvf-talker open1722pdu open1722examples)
# CVF listener app
add_executable(cvf-listener "examples/cvf/cvf-listener.c")
target_include_directories(cvf-listener PRIVATE "examples" "include")
target_link_libraries(cvf-listener open1722pdu open1722examples)
#### Tests ####################################################################
enable_testing()
# find_package(cmocka 1.1.0 REQUIRED)
list(APPEND TEST_TARGETS test-aaf)
list(APPEND TEST_TARGETS test-avtp)
list(APPEND TEST_TARGETS test-can)
list(APPEND TEST_TARGETS test-crf)
list(APPEND TEST_TARGETS test-cvf)
list(APPEND TEST_TARGETS test-rvf)
# list(APPEND TEST_TARGETS test-stream)
foreach(TEST_TARGET IN LISTS TEST_TARGETS)
add_executable(${TEST_TARGET} "unit/${TEST_TARGET}.c")
target_include_directories(${TEST_TARGET} PRIVATE "include")
target_link_libraries(${TEST_TARGET} open1722pdu cmocka m)
add_test(NAME ${TEST_TARGET} COMMAND "${PROJECT_BINARY_DIR}/${TEST_TARGET}")
endforeach()
#### Install ##################################################################
install(TARGETS open1722pdu DESTINATION lib)
install(TARGETS
aaf-listener
aaf-talker
acf-can-listener
acf-can-talker
crf-listener
crf-talker
cvf-listener
cvf-talker
DESTINATION bin)
install(DIRECTORY "include/" DESTINATION include)
#### Packaging ################################################################
include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR "${open1722_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${open1722_VERSION_MINOR}")
# set(CPACK_PACKAGE_DIRECTORY "${PROJECT_BINARY_DIR}/release")
set(CPACK_GENERATOR "TGZ" "DEB")
set(CPACK_SOURCE_GENERATOR "TGZ" "DEB")
# Debian package
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Adriaan Niess [Robert Bosch GmbH]")
include(CPack)