Add gitlab issue/merge request templates
[apps/agl-service-can-low-level.git] / low-can-binding / CMakeLists.txt
1 ###########################################################################
2 # Copyright 2015, 2016, 2017 IoT.bzh
3 #
4 # author: Fulup Ar Foll <fulup@iot.bzh>
5 # contrib: Romain Forlot <romain.forlot@iot.bzh>
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 ###########################################################################
19
20 # Add target to project dependency list
21
22 PROJECT_TARGET_ADD(low-can)
23
24         if(WITH_FEATURE_ISOTP)
25         set(SOURCES_ISOTP
26                 utils/socketcan-isotp.cpp
27         )
28         endif()
29
30
31         if(WITH_FEATURE_J1939)
32         set(SOURCES_J1939
33                 can/message/j1939-message.cpp
34                 utils/socketcan-j1939/socketcan-j1939.cpp
35                 utils/socketcan-j1939/socketcan-j1939-data.cpp
36                 utils/socketcan-j1939/socketcan-j1939-addressclaiming.cpp
37         )
38         endif()
39
40         set (SOURCES_LIB
41                 binding/low-can-hat.cpp
42                 binding/low-can-subscription.cpp
43                 binding/application.cpp
44                 can/can-bus.cpp
45                 can/can-decoder.cpp
46                 can/can-encoder.cpp
47                 can/message-set.cpp
48                 can/message-definition.cpp
49                 can/message/message.cpp
50                 can/message/can-message.cpp
51                 can/signals.cpp
52                 diagnostic/diagnostic-message.cpp
53                 diagnostic/diagnostic-manager.cpp
54                 diagnostic/active-diagnostic-request.cpp
55                 utils/signals.cpp
56                 utils/openxc-utils.cpp
57                 utils/timer.cpp
58                 utils/socketcan.cpp
59                 #utils/socketcan-raw.cpp
60                 utils/socketcan-bcm.cpp
61                 utils/converter.cpp
62                 utils/config-parser.cpp
63         )
64
65         add_library(${TARGET_NAME} SHARED ${SOURCES_LIB} ${SOURCES_J1939} ${SOURCES_ISOTP})
66
67         # Binder exposes a unique public entry point
68         SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
69         LABELS "LIBRARY"
70         IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/lib${TARGET_NAME}.so
71         )
72
73         TARGET_LINK_LIBRARIES(${TARGET_NAME}
74                 ini-config
75                 openxc-message-format
76                 uds-c
77                 isotp-c
78                 bitfield-c
79                 ${link_libraries})
80
81 PROJECT_TARGET_ADD(low-can-binding)
82
83         # Define project Targets
84         set (SOURCES
85                 binding/low-can-cb.cpp
86                 )
87
88         add_library(${TARGET_NAME} MODULE ${SOURCES})
89
90         set(OPENAPI_DEF "binding/low-can-apidef" CACHE STRING "name and path to the JSON API definition without extension")
91         # Binder exposes a unique public entry point
92         SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
93                 PREFIX "afb-"
94                 LABELS "BINDINGV3"
95                 LINK_FLAGS ${BINDINGS_LINK_FLAG}
96                 INSTALL_RPATH "$ORIGIN"
97                 OUTPUT_NAME ${TARGET_NAME}
98         )
99
100         # Library dependencies (include updates automatically)
101         TARGET_LINK_LIBRARIES(${TARGET_NAME}
102                 low-can
103                 openxc-message-format
104                 uds-c
105                 isotp-c
106                 bitfield-c
107                 appcontroller
108                 ${link_libraries})