1 ###########################################################################
2 # Copyright 2015, 2016, 2017 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 (NOT DEFINED ALLOW_NO_BINDER)
20 if (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
21 message(FATAL_ERROR "Require at least gcc-4.9")
22 endif(CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9)
23 endif(ALLOW_NO_BINDER)
25 INCLUDE(FindPkgConfig)
27 ADD_SUBDIRECTORY(genskel)
30 ###########################################
32 ADD_SUBDIRECTORY(tests)
34 ADD_DEFINITIONS(-DBINDING_INSTALL_DIR="${binding_install_dir}")
35 # Always add INFER_EXTENSION (more details in afb-hreq.c)
36 ADD_DEFINITIONS(-DINFER_EXTENSION)
38 ADD_LIBRARY(afb-lib STATIC
84 ###########################################
85 # build and install afb-daemon
86 ###########################################
87 ADD_EXECUTABLE(afb-daemon main.c)
88 TARGET_LINK_LIBRARIES(afb-daemon
92 INSTALL(TARGETS afb-daemon
93 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
95 ###########################################
96 # build and install libafbwsc
97 ###########################################
98 ADD_LIBRARY(afbwsc SHARED afb-ws.c afb-ws-client.c afb-wsj1.c websock.c afb-proto-ws.c jobs-fake.c)
99 SET_TARGET_PROPERTIES(afbwsc PROPERTIES
100 VERSION ${LIBAFBWSC_VERSION}
101 SOVERSION ${LIBAFBWSC_SOVERSION})
102 TARGET_LINK_LIBRARIES(afbwsc
103 ${libsystemd_LDFLAGS}
106 -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-afbwsc.map
110 INSTALL(TARGETS afbwsc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
111 INSTALL(FILES afb-wsj1.h afb-ws-client.h afb-proto-ws.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/afb)
113 ###########################################
114 # build and install afb-client-demo
115 ###########################################
116 ADD_EXECUTABLE(afb-client-demo afb-client-demo.c)
117 TARGET_LINK_LIBRARIES(afb-client-demo
120 ${libsystemd_LDFLAGS}
122 INSTALL(TARGETS afb-client-demo
123 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
125 ###########################################
127 MESSAGE(WARNING "NOT compiling the binder! but tools are compiled")