From 13a8c36f354376b622cebb3348f2500d87b980a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Bollo?= Date: Fri, 27 May 2016 17:15:21 +0200 Subject: [PATCH] Adds the library libafbwsc.so MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- CMakeLists.txt | 4 +++- afb-wsc.pc.in | 31 +++++++++++++++++++++++++++++++ src/CMakeLists.txt | 23 ++++++++++++++++++++++- src/afb-client-demo.c | 2 +- src/export-afbwsc.map | 9 +++++++++ 5 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 afb-wsc.pc.in create mode 100644 src/export-afbwsc.map diff --git a/CMakeLists.txt b/CMakeLists.txt index 6089f282..c5094bb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 index 00000000..a8b29d71 --- /dev/null +++ b/afb-wsc.pc.in @@ -0,0 +1,31 @@ +## +## Copyright (C) 2016 "IoT.bzh" +## Author: José Bollo +## +## 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 + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3b3c6fd4..f41a3a88 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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}) + + diff --git a/src/afb-client-demo.c b/src/afb-client-demo.c index 349a0274..6344d6a3 100644 --- a/src/afb-client-demo.c +++ b/src/afb-client-demo.c @@ -30,7 +30,7 @@ #include -#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 index 00000000..c775a16f --- /dev/null +++ b/src/export-afbwsc.map @@ -0,0 +1,9 @@ +{ +global: + afb_ws_client_connect_wsj1; + afb_wsj1_*; + afb_common_*; +local: + *; +}; + -- 2.16.6