socketcan-bcm: Fix wrongly opened socket
[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         )
63
64         add_library(${TARGET_NAME} SHARED ${SOURCES_LIB} ${SOURCES_J1939} ${SOURCES_ISOTP})
65
66         TARGET_LINK_LIBRARIES(${TARGET_NAME}
67                 ini-config
68                 openxc-message-format
69                 uds-c
70                 isotp-c
71                 bitfield-c
72                 ${link_libraries})
73
74 PROJECT_TARGET_ADD(low-can-binding)
75
76         # Define project Targets
77         set (SOURCES
78                 binding/low-can-cb.cpp
79                 )
80
81         add_library(${TARGET_NAME} MODULE ${SOURCES})
82
83         set(OPENAPI_DEF "binding/low-can-apidef" CACHE STRING "name and path to the JSON API definition without extension")
84         # Binder exposes a unique public entry point
85         SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
86                 PREFIX "afb-"
87                 LABELS "BINDINGV3"
88                 LINK_FLAGS ${BINDINGS_LINK_FLAG}
89                 OUTPUT_NAME ${TARGET_NAME}
90         )
91
92         # Library dependencies (include updates automatically)
93         TARGET_LINK_LIBRARIES(${TARGET_NAME}
94                 low-can
95                 ini-config
96                 openxc-message-format
97                 uds-c
98                 isotp-c
99                 bitfield-c
100                 appcontroller
101                 ${link_libraries})