Adds the library libafbwsc.so
authorJosé Bollo <jose.bollo@iot.bzh>
Fri, 27 May 2016 15:15:21 +0000 (17:15 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Fri, 27 May 2016 15:15:21 +0000 (17:15 +0200)
This library is intended to be used by C clients to connect
to the binder and access to its fetures through the websocket.

An example of integration is given by afb-client-demo.c

It is known that it introduces an unwanted dependency to afb-common.
This is a temporary issue.

Change-Id: Ie0a395f116f6ee05679525a6399ef23ef245c944
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
CMakeLists.txt
afb-wsc.pc.in [new file with mode: 0644]
src/CMakeLists.txt
src/afb-client-demo.c
src/export-afbwsc.map [new file with mode: 0644]

index 6089f28..c5094bb 100644 (file)
@@ -67,11 +67,13 @@ ADD_SUBDIRECTORY(include)
 ADD_SUBDIRECTORY(plugins)
 
 ############################################################
-# installs the pkgconfig file
+# installs the pkgconfig files
 CONFIGURE_FILE(afb-daemon.pc.in afb-daemon.pc @ONLY)
+CONFIGURE_FILE(afb-wsc.pc.in afb-wsc.pc @ONLY)
 
 INSTALL(FILES
     ${CMAKE_CURRENT_BINARY_DIR}/afb-daemon.pc
+    ${CMAKE_CURRENT_BINARY_DIR}/afb-wsc.pc
     DESTINATION
     ${CMAKE_INSTALL_LIBDIR}/pkgconfig
     )
diff --git a/afb-wsc.pc.in b/afb-wsc.pc.in
new file mode 100644 (file)
index 0000000..a8b29d7
--- /dev/null
@@ -0,0 +1,31 @@
+##
+## Copyright (C) 2016 "IoT.bzh"
+## Author: José Bollo <jose.bollo@iot.bzh>
+##
+## This file is part of afb-daemon project.
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+
+Name: @PROJECT_PRETTY_NAME@
+Description: @PROJECT_DESCRIPTION@
+Version: @PROJECT_VERSION@
+URL: @PROJECT_URL@
+
+Requires: json-c libsystemd
+Cflags: -I${includedir}
+Libs: -L${libdir} -lafbwsc
+
index 3b3c6fd..f41a3a8 100644 (file)
@@ -51,6 +51,9 @@ ADD_LIBRARY(afb-lib STATIC
        websock.c
 )
 
+###########################################
+# build and install afb-daemon
+###########################################
 ADD_EXECUTABLE(afb-daemon main.c)
 TARGET_LINK_LIBRARIES(afb-daemon
        afb-lib
@@ -66,11 +69,29 @@ TARGET_LINK_LIBRARIES(afb-daemon
 INSTALL(TARGETS afb-daemon
         RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 
+###########################################
+# build and install libafbwsc
+###########################################
+ADD_LIBRARY(afbwsc SHARED afb-ws.c afb-ws-client.c afb-wsj1.c websock.c afb-common.c)
+TARGET_LINK_LIBRARIES(afbwsc
+       ${libsystemd_LIBRARIES}
+       -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export-afbwsc.map
+       -Wl,--as-needed
+       -Wl,--gc-sections
+)
+INSTALL(TARGETS afbwsc LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+INSTALL(FILES afb-wsj1.h afb-ws-client.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/afb)
+
+###########################################
+# build and install afb-client-demo
+###########################################
 ADD_EXECUTABLE(afb-client-demo afb-client-demo.c)
 TARGET_LINK_LIBRARIES(afb-client-demo
-       afb-lib
+       afbwsc
        ${link_libraries}
        ${libsystemd_LIBRARIES}
 )
 INSTALL(TARGETS afb-client-demo
         RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+
index 349a027..6344d6a 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <systemd/sd-event.h>
 
-#include "afb-common.h"
+#include "afb-common.h"  /* TODO: remove dependency to afb-common.h */
 #include "afb-wsj1.h"
 #include "afb-ws-client.h"
 
diff --git a/src/export-afbwsc.map b/src/export-afbwsc.map
new file mode 100644 (file)
index 0000000..c775a16
--- /dev/null
@@ -0,0 +1,9 @@
+{
+global:
+       afb_ws_client_connect_wsj1;
+       afb_wsj1_*;
+       afb_common_*;
+local:
+       *;
+};
+