subpath: creation for splitting locale-root
[src/app-framework-binder.git] / src / CMakeLists.txt
1 ###########################################################################
2 # Copyright 2015, 2016, 2017 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 INCLUDE(FindPkgConfig)
24
25 ADD_SUBDIRECTORY(genskel)
26 ADD_SUBDIRECTORY(tests)
27
28 ADD_DEFINITIONS(-DBINDING_INSTALL_DIR="${binding_install_dir}")
29 # Always add INFER_EXTENSION (more details in afb-hreq.c)
30 ADD_DEFINITIONS(-DINFER_EXTENSION)
31 ADD_DEFINITIONS(-DAGL_DEVEL)
32
33 ADD_LIBRARY(afb-lib STATIC
34         afb-api.c
35         afb-api-dbus.c
36         afb-api-so.c
37         afb-api-so-v1.c
38         afb-api-so-v2.c
39         afb-api-ws.c
40         afb-apiset.c
41         afb-auth.c
42         afb-common.c
43         afb-config.c
44         afb-context.c
45         afb-cred.c
46         afb-debug.c
47         afb-ditf.c
48         afb-evt.c
49         afb-hook.c
50         afb-hreq.c
51         afb-hsrv.c
52         afb-hswitch.c
53         afb-method.c
54         afb-monitor.c
55         afb-msg-json.c
56         afb-session.c
57         afb-stub-ws.c
58         afb-svc.c
59         afb-trace.c
60         afb-websock.c
61         afb-ws-client.c
62         afb-ws-json1.c
63         afb-ws.c
64         afb-wsj1.c
65         afb-xreq.c
66         jobs.c
67         locale-root.c
68         sd-fds.c
69         sig-monitor.c
70         subpath.c
71         verbose.c
72         websock.c
73         wrap-json.c
74 )
75
76 ###########################################
77 # build and install afb-daemon
78 ###########################################
79 ADD_EXECUTABLE(afb-daemon main.c)
80 TARGET_LINK_LIBRARIES(afb-daemon
81         afb-lib
82         ${link_libraries}
83 )
84 INSTALL(TARGETS afb-daemon
85         RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
86
87 ###########################################
88 # build and install libafbwsc
89 ###########################################
90 ADD_LIBRARY(afbwsc SHARED afb-ws.c afb-ws-client.c afb-wsj1.c websock.c)
91 SET_TARGET_PROPERTIES(afbwsc PROPERTIES
92         VERSION ${LIBAFBWSC_VERSION}
93         SOVERSION ${LIBAFBWSC_SOVERSION})
94 TARGET_LINK_LIBRARIES(afbwsc
95         ${libsystemd_LDFLAGS}
96         ${json-c_LDFLAGS}
97         -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-afbwsc.map
98         -Wl,--as-needed
99         -Wl,--gc-sections
100 )
101 INSTALL(TARGETS afbwsc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
102 INSTALL(FILES afb-wsj1.h afb-ws-client.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/afb)
103
104 ###########################################
105 # build and install afb-client-demo
106 ###########################################
107 ADD_EXECUTABLE(afb-client-demo afb-client-demo.c)
108 TARGET_LINK_LIBRARIES(afb-client-demo
109         afbwsc
110         ${link_libraries}
111         ${libsystemd_LDFLAGS}
112 )
113 INSTALL(TARGETS afb-client-demo
114         RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
115
116