From af71bcbff3459320d2a9789e9f33da1602f17620 Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Mon, 25 Feb 2019 21:28:31 +0100 Subject: [PATCH] moved message and message_queue to common library --- CMakeLists.txt | 14 ++++++++++---- lib/wsfs/adapter/server_protocol.c | 5 +++-- lib/wsfs/adapter/server_protocol_intern.h | 3 ++- lib/wsfs/{adapter => }/message.c | 2 +- lib/wsfs/{adapter => }/message.h | 0 lib/wsfs/{adapter => }/message_queue.c | 4 ++-- lib/wsfs/{adapter => }/message_queue.h | 0 7 files changed, 18 insertions(+), 10 deletions(-) rename lib/wsfs/{adapter => }/message.c (93%) rename lib/wsfs/{adapter => }/message.h (100%) rename lib/wsfs/{adapter => }/message_queue.c (94%) rename lib/wsfs/{adapter => }/message_queue.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e37be6e..f952ae3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,7 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(C_WARNINGS -Wall -Wextra) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(EXTRA_INCLUDE_DIRS "include" @@ -40,7 +41,12 @@ set(EXTRA_CFLAGS ${JANSSON_CFLAGS_OTHER} "-pthread" ) +# libwsfs-common +set(WSFS_COMMON_SOURCES + lib/wsfs/message.c + lib/wsfs/message_queue.c +) # libwsfs-adapter @@ -48,8 +54,6 @@ set(WSFS_ADAPTER_SOURCES lib/wsfs/adapter/status.c lib/wsfs/adapter/filesystem.c lib/wsfs/adapter/server.c - lib/wsfs/adapter/message.c - lib/wsfs/adapter/message_queue.c lib/wsfs/adapter/time/timepoint.c lib/wsfs/adapter/time/timer.c lib/wsfs/adapter/time/timeout_manager.c @@ -68,7 +72,7 @@ set(WSFS_ADAPTER_SOURCES lib/wsfs/adapter/jsonrpc/util.c ) -add_library(wsfs-adapter SHARED ${WSFS_ADAPTER_SOURCES}) +add_library(wsfs-adapter SHARED ${WSFS_ADAPTER_SOURCES} ${WSFS_COMMON_SOURCES}) set_target_properties(wsfs-adapter PROPERTIES VERSION ${PROJECT_VERSION}) set_target_properties(wsfs-adapter PROPERTIES SOVERSION 0) @@ -80,6 +84,7 @@ target_compile_options(wsfs-adapter PUBLIC ${EXTRA_CFLAGS}) file(WRITE "${PROJECT_BINARY_DIR}/libwsfs-adapter.pc" "prefix=\"${CMAKE_INSTALL_PREFIX}\" + exec_prefix=\${prefix} libdir=\${exec_prefix}/lib${LIB_SUFFIX} includedir=\${prefix}/include @@ -113,7 +118,7 @@ set(WSFS_PROVIDER_SOURCES lib/wsfs/provider/operation/read.c ) -add_library(wsfs-provider SHARED ${WSFS_PROVIDER_SOURCES}) +add_library(wsfs-provider SHARED ${WSFS_PROVIDER_SOURCES} ${WSFS_COMMON_SOURCES}) set_target_properties(wsfs-provider PROPERTIES VERSION ${PROJECT_VERSION}) set_target_properties(wsfs-provider PROPERTIES SOVERSION 0) @@ -194,6 +199,7 @@ add_executable(alltests test/test_timepoint.cc test/test_timer.cc test/test_url.cc + ${WSFS_COMMON_SOURCES} ) target_link_libraries(alltests PUBLIC wsfs-adapter-static wsfs-provider-static ${EXTRA_LIBS} ${GTEST_LIBRARIES}) diff --git a/lib/wsfs/adapter/server_protocol.c b/lib/wsfs/adapter/server_protocol.c index 3db067e..be402b1 100644 --- a/lib/wsfs/adapter/server_protocol.c +++ b/lib/wsfs/adapter/server_protocol.c @@ -3,10 +3,11 @@ #include #include -#include "wsfs/adapter/message.h" -#include "wsfs/adapter/filesystem.h" +#include "wsfs/message.h" #include "wsfs/util.h" +#include "wsfs/adapter/filesystem.h" + static int wsfs_server_protocol_callback( struct lws * wsi, enum lws_callback_reasons reason, diff --git a/lib/wsfs/adapter/server_protocol_intern.h b/lib/wsfs/adapter/server_protocol_intern.h index 7931411..4551062 100644 --- a/lib/wsfs/adapter/server_protocol_intern.h +++ b/lib/wsfs/adapter/server_protocol_intern.h @@ -1,9 +1,10 @@ #ifndef WSFS_SERVER_PROTOCOL_INTERN_H #define WSFS_SERVER_PROTOCOL_INTERN_H +#include "wsfs/message_queue.h" + #include "wsfs/adapter/server_protocol.h" #include "wsfs/adapter/filesystem.h" -#include "wsfs/adapter/message_queue.h" #include "wsfs/adapter/jsonrpc/server.h" #include "wsfs/adapter/time/timeout_manager.h" diff --git a/lib/wsfs/adapter/message.c b/lib/wsfs/message.c similarity index 93% rename from lib/wsfs/adapter/message.c rename to lib/wsfs/message.c index 379b637..eedd392 100644 --- a/lib/wsfs/adapter/message.c +++ b/lib/wsfs/message.c @@ -1,4 +1,4 @@ -#include "wsfs/adapter/message.h" +#include "wsfs/message.h" #include #include diff --git a/lib/wsfs/adapter/message.h b/lib/wsfs/message.h similarity index 100% rename from lib/wsfs/adapter/message.h rename to lib/wsfs/message.h diff --git a/lib/wsfs/adapter/message_queue.c b/lib/wsfs/message_queue.c similarity index 94% rename from lib/wsfs/adapter/message_queue.c rename to lib/wsfs/message_queue.c index 6fb0e22..08b7e5e 100644 --- a/lib/wsfs/adapter/message_queue.c +++ b/lib/wsfs/message_queue.c @@ -1,5 +1,5 @@ -#include "wsfs/adapter/message_queue.h" -#include "wsfs/adapter/message.h" +#include "wsfs/message_queue.h" +#include "wsfs/message.h" void wsfs_message_queue_init( struct wsfs_message_queue * queue) diff --git a/lib/wsfs/adapter/message_queue.h b/lib/wsfs/message_queue.h similarity index 100% rename from lib/wsfs/adapter/message_queue.h rename to lib/wsfs/message_queue.h