converter: Fix to_hex conversion
[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         # Binder exposes a unique public entry point
67         SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
68         LABELS "LIBRARY"
69         IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/lib${TARGET_NAME}.so
70         )
71
72         TARGET_LINK_LIBRARIES(${TARGET_NAME}
73                 ini-config
74                 openxc-message-format
75                 uds-c
76                 isotp-c
77                 bitfield-c
78                 ${link_libraries})
79
80 PROJECT_TARGET_ADD(low-can-binding)
81
82         # Define project Targets
83         set (SOURCES
84                 binding/low-can-cb.cpp
85                 )
86
87         add_library(${TARGET_NAME} MODULE ${SOURCES})
88
89         set(OPENAPI_DEF "binding/low-can-apidef" CACHE STRING "name and path to the JSON API definition without extension")
90         # Binder exposes a unique public entry point
91         SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
92                 PREFIX "afb-"
93                 LABELS "BINDINGV3"
94                 LINK_FLAGS ${BINDINGS_LINK_FLAG}
95                 INSTALL_RPATH "$ORIGIN"
96                 OUTPUT_NAME ${TARGET_NAME}
97         )
98
99         # Library dependencies (include updates automatically)
100         TARGET_LINK_LIBRARIES(${TARGET_NAME}
101                 low-can
102                 ini-config
103                 openxc-message-format
104                 uds-c
105                 isotp-c
106                 bitfield-c
107                 appcontroller
108                 ${link_libraries})