globset: Introduce globset for event handling
[src/app-framework-binder.git] / src / CMakeLists.txt
1 ###########################################################################
2 # Copyright (C) 2015-2018 "IoT.bzh"
3 #
4 # author: José Bollo <jose.bollo@iot.bzh>
5 #
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
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
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 ###########################################################################
18
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)
22
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)
26
27 SET(AFB_LIB_SOURCES
28         afb-api.c
29         afb-api-so.c
30         afb-api-so-v2.c
31         afb-api-so-v3.c
32         afb-api-so-vdyn.c
33         afb-api-v3.c
34         afb-api-ws.c
35         afb-apiset.c
36         afb-auth.c
37         afb-autoset.c
38         afb-calls.c
39         afb-common.c
40         afb-config.c
41         afb-context.c
42         afb-cred.c
43         afb-debug.c
44         afb-evt.c
45         afb-export.c
46         afb-fdev.c
47         afb-hook.c
48         afb-hook-flags.c
49         afb-hreq.c
50         afb-hsrv.c
51         afb-hswitch.c
52         afb-method.c
53         afb-monitor.c
54         afb-msg-json.c
55         afb-proto-ws.c
56         afb-session.c
57         afb-socket.c
58         afb-stub-ws.c
59         afb-systemd.c
60         afb-trace.c
61         afb-websock.c
62         afb-ws-client.c
63         afb-ws-json1.c
64         afb-ws.c
65         afb-wsj1.c
66         afb-xreq.c
67         fdev.c
68         fdev-epoll.c
69         fdev-systemd.c
70         globset.c
71         jobs.c
72         locale-root.c
73         pearson.c
74         process-name.c
75         sig-monitor.c
76         subpath.c
77         verbose.c
78         websock.c
79         wrap-json.c
80 )
81
82 IF(INCLUDE_LEGACY_BINDING_V1)
83         ADD_DEFINITIONS(-DWITH_LEGACY_BINDING_V1)
84         SET(AFB_LIB_SOURCES ${AFB_LIB_SOURCES} afb-api-so-v1.c)
85 ENDIF(INCLUDE_LEGACY_BINDING_V1)
86 IF(INCLUDE_LEGACY_BINDING_VDYN)
87         ADD_DEFINITIONS(-DWITH_LEGACY_BINDING_VDYN)
88         SET(AFB_LIB_SOURCES ${AFB_LIB_SOURCES} afb-api-so-vdyn.c)
89 ENDIF(INCLUDE_LEGACY_BINDING_VDYN)
90
91 IF(INCLUDE_DBUS_TRANSPARENCY)
92         ADD_DEFINITIONS(-DWITH_DBUS_TRANSPARENCY)
93         SET(AFB_LIB_SOURCES ${AFB_LIB_SOURCES} afb-api-dbus.c)
94 ENDIF()
95 IF(INCLUDE_SUPERVISOR)
96         ADD_DEFINITIONS(-DWITH_SUPERVISION)
97         SET(AFB_LIB_SOURCES ${AFB_LIB_SOURCES} afb-supervision.c)
98 ENDIF()
99
100 ADD_LIBRARY(afb-lib STATIC ${AFB_LIB_SOURCES})
101
102 ###########################################
103 # build and install afb-daemon
104 ###########################################
105 ADD_EXECUTABLE(afb-daemon main-afb-daemon.c)
106 TARGET_LINK_LIBRARIES(afb-daemon
107         afb-lib
108         ${link_libraries}
109 )
110 INSTALL(TARGETS afb-daemon
111         RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
112
113 ###########################################
114 # build and install afb-daemon
115 ###########################################
116 IF(INCLUDE_SUPERVISOR)
117         ADD_EXECUTABLE(afs-supervisor main-afs-supervisor.c afs-supervisor.c afs-discover.c afs-config.c)
118         TARGET_LINK_LIBRARIES(afs-supervisor
119                 afb-lib
120                 ${link_libraries}
121         )
122         INSTALL(TARGETS afs-supervisor
123                 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
124 ENDIF()
125
126 ###########################################
127 # build and install libafbwsc
128 ###########################################
129 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)
130 SET_TARGET_PROPERTIES(afbwsc PROPERTIES
131         VERSION ${LIBAFBWSC_VERSION}
132         SOVERSION ${LIBAFBWSC_SOVERSION})
133 TARGET_LINK_LIBRARIES(afbwsc
134         ${libsystemd_LDFLAGS}
135         ${json-c_LDFLAGS}
136         -lpthread
137         -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-afbwsc.map
138         -Wl,--as-needed
139         -Wl,--gc-sections
140 )
141 INSTALL(TARGETS afbwsc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
142 INSTALL(FILES afb-wsj1.h afb-ws-client.h afb-proto-ws.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/afb)
143
144 ###########################################
145 # build and install afb-client-demo
146 ###########################################
147 ADD_EXECUTABLE(afb-client-demo main-afb-client-demo.c)
148 TARGET_LINK_LIBRARIES(afb-client-demo
149         afbwsc
150         ${link_libraries}
151         ${libsystemd_LDFLAGS}
152 )
153 INSTALL(TARGETS afb-client-demo
154         RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
155