1 ###########################################################################
2 # Copyright (C) 2015-2019 "IoT.bzh"
4 # author: José Bollo <jose.bollo@iot.bzh>
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 ###########################################################################
19 if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
20 message(FATAL_ERROR "Require at least gcc-4.9")
21 endif(CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
23 ADD_DEFINITIONS(-DINTRINSIC_BINDING_DIR="${INTRINSIC_BINDING_DIR}")
24 # Always add INFER_EXTENSION (more details in afb-hreq.c)
25 ADD_DEFINITIONS(-DINFER_EXTENSION)
27 ############################################################################
28 # TODO: improve below setting by using config file
29 option(WITH_SIG_MONITOR_DUMPSTACK "Activate dump stack on error" ON)
30 option(WITH_SIG_MONITOR_SIGNALS "Activate handling of signals" ON)
31 option(WITH_SIG_MONITOR_FOR_CALL "Activate monitoring of calls" ON)
32 option(WITH_SIG_MONITOR_TIMERS "Activate monitoring of call expiration" ON)
33 option(WITH_AFB_HOOK "Include hooking" ON)
34 option(WITH_AFB_TRACE "Include monitoring trace" ON)
35 option(WITH_SUPERVISOR "Activates installation of supervisor" OFF)
36 option(WITH_DBUS_TRANSPARENCY "Allows API transparency over DBUS" OFF)
37 option(WITH_LEGACY_BINDING_V1 "Includes the legacy Binding API version 1" OFF)
38 option(WITH_LEGACY_BINDING_V2 "Includes the legacy Binding API version 2" ON)
39 option(WITH_LEGACY_BINDING_VDYN "Includes the legacy Binding API version dynamic" OFF)
40 option(WITH_DYNAMIC_BINDING "Allow to load dynamic bindings (shared libraries)" ON)
42 if(INCLUDE_SUPERVISOR)
43 set(WITH_SUPERVISOR ON)
45 if(INCLUDE_DBUS_TRANSPARENCY)
46 set(WITH_DBUS_TRANSPARENCY ON)
48 if(INCLUDE_LEGACY_BINDING_V1)
49 set(WITH_LEGACY_BINDING_V1 ON)
51 if(INCLUDE_LEGACY_BINDING_VDYN)
52 set(WITH_LEGACY_BINDING_VDYN ON)
56 -DAGL_DEVEL=$<BOOL:${AGL_DEVEL}>
57 -DWITH_SIG_MONITOR_DUMPSTACK=$<BOOL:${WITH_SIG_MONITOR_DUMPSTACK}>
58 -DWITH_SIG_MONITOR_SIGNALS=$<BOOL:${WITH_SIG_MONITOR_SIGNALS}>
59 -DWITH_SIG_MONITOR_FOR_CALL=$<BOOL:${WITH_SIG_MONITOR_FOR_CALL}>
60 -DWITH_SIG_MONITOR_TIMERS=$<BOOL:${WITH_SIG_MONITOR_TIMERS}>
61 -DWITH_AFB_HOOK=$<BOOL:${WITH_AFB_HOOK}>
62 -DWITH_AFB_TRACE=$<BOOL:${WITH_AFB_TRACE}>
63 -DWITH_LEGACY_BINDING_V1=$<BOOL:${INCLUDE_LEGACY_BINDING_V1}>
64 -DWITH_LEGACY_BINDING_V2=$<BOOL:${WITH_LEGACY_BINDING_V2}>
65 -DWITH_LEGACY_BINDING_VDYN=$<BOOL:${INCLUDE_LEGACY_BINDING_VDYN}>
66 -DWITH_DBUS_TRANSPARENCY=$<BOOL:${INCLUDE_DBUS_TRANSPARENCY}>
67 -DWITH_SUPERVISION=$<BOOL:${INCLUDE_SUPERVISOR}>
68 -DWITH_DYNAMIC_BINDING=$<BOOL:${WITH_DYNAMIC_BINDING}>
70 ############################################################################
134 ADD_LIBRARY(afb-lib STATIC ${AFB_LIB_SOURCES})
136 ###########################################
137 # build and install afb-daemon
138 ###########################################
139 ADD_EXECUTABLE(afb-daemon main-afb-daemon.c)
140 TARGET_LINK_LIBRARIES(afb-daemon
144 INSTALL(TARGETS afb-daemon
145 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
147 ###########################################
148 # build and install afb-daemon
149 ###########################################
150 IF(INCLUDE_SUPERVISOR)
151 ADD_EXECUTABLE(afs-supervisor main-afs-supervisor.c afs-supervisor.c afs-discover.c afs-args.c)
152 TARGET_LINK_LIBRARIES(afs-supervisor
156 INSTALL(TARGETS afs-supervisor
157 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
160 ###########################################
161 # build and install libafbwsc
162 ###########################################
163 ADD_LIBRARY(afbwsc SHARED afb-ws.c afb-ws-client.c afb-wsj1.c websock.c afb-proto-ws.c fdev.c fdev-systemd.c verbose.c)
164 SET_TARGET_PROPERTIES(afbwsc PROPERTIES
165 VERSION ${LIBAFBWSC_VERSION}
166 SOVERSION ${LIBAFBWSC_SOVERSION})
167 TARGET_LINK_LIBRARIES(afbwsc
168 ${libsystemd_LDFLAGS}
171 -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-afbwsc.map
175 INSTALL(TARGETS afbwsc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
176 INSTALL(FILES afb-wsj1.h afb-ws-client.h afb-proto-ws.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/afb)
178 ###########################################
179 # build and install afb-client-demo
180 ###########################################
181 ADD_EXECUTABLE(afb-client-demo main-afb-client-demo.c)
182 TARGET_LINK_LIBRARIES(afb-client-demo
185 ${libsystemd_LDFLAGS}
187 INSTALL(TARGETS afb-client-demo
188 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})