1 ###########################################################################
2 # Copyright (C) 2015-2018 "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(-DBINDING_INSTALL_DIR="${binding_install_dir}")
24 # Always add INFER_EXTENSION (more details in afb-hreq.c)
25 ADD_DEFINITIONS(-DINFER_EXTENSION)
80 IF(INCLUDE_LEGACY_BINDING_V1)
81 ADD_DEFINITIONS(-DWITH_LEGACY_BINDING_V1)
82 SET(AFB_LIB_SOURCES ${AFB_LIB_SOURCES} afb-api-so-v1.c)
83 ENDIF(INCLUDE_LEGACY_BINDING_V1)
84 IF(INCLUDE_LEGACY_BINDING_VDYN)
85 ADD_DEFINITIONS(-DWITH_LEGACY_BINDING_VDYN)
86 SET(AFB_LIB_SOURCES ${AFB_LIB_SOURCES} afb-api-so-vdyn.c)
87 ENDIF(INCLUDE_LEGACY_BINDING_VDYN)
89 IF(INCLUDE_DBUS_TRANSPARENCY)
90 ADD_DEFINITIONS(-DWITH_DBUS_TRANSPARENCY)
91 SET(AFB_LIB_SOURCES ${AFB_LIB_SOURCES} afb-api-dbus.c)
94 ADD_LIBRARY(afb-lib STATIC ${AFB_LIB_SOURCES})
96 ###########################################
97 # build and install afb-daemon
98 ###########################################
99 ADD_EXECUTABLE(afb-daemon main-afb-daemon.c)
100 TARGET_LINK_LIBRARIES(afb-daemon
104 INSTALL(TARGETS afb-daemon
105 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
107 ###########################################
108 # build and install afb-daemon
109 ###########################################
110 IF(INCLUDE_SUPERVISOR)
111 ADD_EXECUTABLE(afs-supervisor main-afs-supervisor.c afs-supervisor.c afs-discover.c afs-config.c)
112 TARGET_LINK_LIBRARIES(afs-supervisor
116 INSTALL(TARGETS afs-supervisor
117 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
120 ###########################################
121 # build and install libafbwsc
122 ###########################################
123 ADD_LIBRARY(afbwsc SHARED afb-ws.c afb-ws-client.c afb-wsj1.c websock.c afb-proto-ws.c jobs-fake.c fdev.c fdev-systemd.c)
124 SET_TARGET_PROPERTIES(afbwsc PROPERTIES
125 VERSION ${LIBAFBWSC_VERSION}
126 SOVERSION ${LIBAFBWSC_SOVERSION})
127 TARGET_LINK_LIBRARIES(afbwsc
128 ${libsystemd_LDFLAGS}
131 -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-afbwsc.map
135 INSTALL(TARGETS afbwsc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
136 INSTALL(FILES afb-wsj1.h afb-ws-client.h afb-proto-ws.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/afb)
138 ###########################################
139 # build and install afb-client-demo
140 ###########################################
141 ADD_EXECUTABLE(afb-client-demo main-afb-client-demo.c)
142 TARGET_LINK_LIBRARIES(afb-client-demo
145 ${libsystemd_LDFLAGS}
147 INSTALL(TARGETS afb-client-demo
148 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})