Vasum wrapper #4, cleanup 86/39286/3
authorKrzysztof Dynowski <k.dynowski@samsung.com>
Tue, 12 May 2015 13:05:13 +0000 (15:05 +0200)
committerKrzysztof Dynowski <k.dynowski@samsung.com>
Tue, 12 May 2015 15:10:07 +0000 (17:10 +0200)
[Bug/Feature]   Cleanup folder structure
[Cause]         wrapper mixed with client
[Solution]      #4 move wrapper sources to separate folder
[Verification]  Build, build old clients

Change-Id: I467e12d996e2c23ce0e46182c7e3d74ea2943ada

CMakeLists.txt
client/CMakeLists.txt
tests/unit_tests/CMakeLists.txt
wrapper/CMakeLists.txt [new file with mode: 0644]
wrapper/vasum.h [moved from client/vasum.h with 100% similarity]
wrapper/vasum.pc.in [moved from client/vasum.pc.in with 100% similarity]
wrapper/vasum_list.h [moved from client/vasum_list.h with 100% similarity]
wrapper/wrapper-compatibility.cpp [moved from client/wrapper-compat.cpp with 99% similarity]
wrapper/wrapper-compatibility.h [moved from client/wrapper-compat.h with 100% similarity]
wrapper/wrapper.cpp [moved from client/vasum-wrapper.cpp with 99% similarity]

index 05fbc53..a0b6b1b 100644 (file)
@@ -148,6 +148,7 @@ SET(ZONE_SUPPORT_FOLDER ${PROJECT_SOURCE_DIR}/zone-support)
 SET(ZONE_DAEMON_FOLDER ${PROJECT_SOURCE_DIR}/zone-daemon)
 SET(TESTS_FOLDER ${PROJECT_SOURCE_DIR}/tests)
 SET(CLI_FOLDER ${PROJECT_SOURCE_DIR}/cli)
+SET(WRAPPER_FOLDER ${PROJECT_SOURCE_DIR}/wrapper)
 
 IF(NOT DEFINED SYSCONF_INSTALL_DIR)
     SET(SYSCONF_INSTALL_DIR "/etc")
@@ -190,4 +191,5 @@ ADD_SUBDIRECTORY(${ZONE_SUPPORT_FOLDER})
 ADD_SUBDIRECTORY(${ZONE_DAEMON_FOLDER})
 ADD_SUBDIRECTORY(${TESTS_FOLDER})
 ADD_SUBDIRECTORY(${CLI_FOLDER})
+ADD_SUBDIRECTORY(${WRAPPER_FOLDER})
 
index 253a19e..9b1d890 100644 (file)
 # @author Mateusz Malicki (m.malicki2@samsung.com)
 #
 
+PROJECT(vasum-client)
 MESSAGE(STATUS "")
 MESSAGE(STATUS "Generating makefile for the Client...")
-## set client library sources (without wrapper files)
 FILE(GLOB project_SRCS *.cpp *.hpp *.h)
-FILE(GLOB project_SRCS_rm vasum-wrapper.cpp
-                          wrapper-compat.*
-                          vasum.h
-                          vasum_list.h)
-LIST(REMOVE_ITEM project_SRCS ${project_SRCS_rm})
-
-## set wrapper library sources (without vasum-client.cpp)
-FILE(GLOB wrapper_SRCS *.cpp *.hpp *.h)
-FILE(GLOB wrapper_SRCS_rm vasum-client.cpp)
-LIST(REMOVE_ITEM wrapper_SRCS ${wrapper_SRCS_rm})
 
 FILE(GLOB common_SRCS ${COMMON_FOLDER}/epoll/*.hpp              ${COMMON_FOLDER}/epoll/*.cpp
                       ${COMMON_FOLDER}/ipc/*.hpp                ${COMMON_FOLDER}/ipc/*.cpp
@@ -38,10 +28,8 @@ FILE(GLOB common_SRCS ${COMMON_FOLDER}/epoll/*.hpp              ${COMMON_FOLDER}
                       ${COMMON_FOLDER}/utils/*.hpp              ${COMMON_FOLDER}/utils/*.cpp
                       ${COMMON_FOLDER}/*.hpp                    ${COMMON_FOLDER}/*.cpp)
 
-## set version highier then vasum.so.0.1.0
 SET(_LIB_VERSION_ "${VERSION}")
 SET(_LIB_SOVERSION_ "0")
-SET(PC_FILE_CLIENT "${PROJECT_NAME}-client.pc")
 SET(PC_FILE "${PROJECT_NAME}.pc")
 
 ## Set the default ELF image symbol visibility to hidden. Using this feature
@@ -51,13 +39,7 @@ SET(PC_FILE "${PROJECT_NAME}.pc")
 ADD_DEFINITIONS(-fvisibility=hidden)
 
 ## Setup target ################################################################
-ADD_LIBRARY(${PROJECT_NAME}-client SHARED ${project_SRCS} ${common_SRCS})
-SET_TARGET_PROPERTIES(${PROJECT_NAME}-client PROPERTIES
-        SOVERSION ${_LIB_SOVERSION_}
-        VERSION ${_LIB_VERSION_}
-        COMPILE_DEFINITIONS HOST_IPC_SOCKET="${VSM_SERVER_IPC_SOCKET_PATH}")
-
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${wrapper_SRCS} ${common_SRCS})
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${project_SRCS} ${common_SRCS})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
         SOVERSION ${_LIB_SOVERSION_}
         VERSION ${_LIB_VERSION_}
@@ -70,23 +52,20 @@ INCLUDE_DIRECTORIES(SYSTEM ${LIB_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
 INCLUDE_DIRECTORIES(${SERVER_FOLDER})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME}-client ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES}
-                      Config SimpleDbus)
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES}
                       Config SimpleDbus)
 
 ## Generate the pc file ########################################################
-CONFIGURE_FILE(${PC_FILE_CLIENT}.in ${CMAKE_BINARY_DIR}/${PC_FILE_CLIENT} @ONLY)
 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY)
 
 
 ## Install #####################################################################
-INSTALL(FILES       ${CMAKE_BINARY_DIR}/${PC_FILE_CLIENT} ${CMAKE_BINARY_DIR}/${PC_FILE}
+INSTALL(FILES       ${CMAKE_BINARY_DIR}/${PC_FILE}
         DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
-INSTALL(TARGETS     ${PROJECT_NAME}-client ${PROJECT_NAME}
+INSTALL(TARGETS     ${PROJECT_NAME}
         DESTINATION ${CMAKE_INSTALL_LIBDIR}
         COMPONENT   RuntimeLibraries)
 
-INSTALL(FILES       vasum-client.h vasum.h vasum_list.h
-        DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME})
+INSTALL(FILES       vasum-client.h
+        DESTINATION ${INCLUDE_INSTALL_DIR}/vasum)
index 65646ea..889dd91 100644 (file)
@@ -23,8 +23,6 @@ FILE(GLOB_RECURSE project_SRCS *.cpp *.hpp)
 FILE(GLOB_RECURSE common_SRCS ${COMMON_FOLDER}/*.cpp ${COMMON_FOLDER}/*.hpp)
 FILE(GLOB         server_SRCS ${SERVER_FOLDER}/*.cpp ${SERVER_FOLDER}/*.hpp)
 FILE(GLOB         client_SRCS ${CLIENT_FOLDER}/*.cpp ${CLIENT_FOLDER}/*.h)
-FILE(GLOB         client_SRCS_rm ${CLIENT_FOLDER}/vasum-wrapper*.cpp)
-LIST(REMOVE_ITEM client_SRCS ${client_SRCS_rm})
 FILE(GLOB         socket_test_SRCS ${SOCKET_TEST_FOLDER}/*.cpp ${SOCKET_TEST_FOLDER}/*.hpp)
 
 FILE(GLOB         main_SRC ${SERVER_FOLDER}/main.cpp)
diff --git a/wrapper/CMakeLists.txt b/wrapper/CMakeLists.txt
new file mode 100644 (file)
index 0000000..532e693
--- /dev/null
@@ -0,0 +1,76 @@
+# Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    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.
+#
+#
+# @file   CMakeLists.txt
+# @author Mateusz Malicki (m.malicki2@samsung.com)
+#
+
+PROJECT(vasum)
+MESSAGE(STATUS "")
+MESSAGE(STATUS "Generating makefile for the Vasum wrapper...")
+
+## set wrapper library sources (without vasum-client.cpp)
+FILE(GLOB wrapper_SRCS *.cpp *.hpp *.h
+     ${CLIENT_FOLDER}/vasum-client-impl.hpp     ${CLIENT_FOLDER}/vasum-client-impl.cpp
+     ${CLIENT_FOLDER}/host-ipc-connection.hpp   ${CLIENT_FOLDER}/host-ipc-connection.cpp
+     ${CLIENT_FOLDER}/utils.hpp                 ${CLIENT_FOLDER}/utils.cpp)
+
+FILE(GLOB common_SRCS ${COMMON_FOLDER}/epoll/*.hpp              ${COMMON_FOLDER}/epoll/*.cpp
+                      ${COMMON_FOLDER}/ipc/*.hpp                ${COMMON_FOLDER}/ipc/*.cpp
+                      ${COMMON_FOLDER}/ipc/internals/*.hpp      ${COMMON_FOLDER}/ipc/internals/*.cpp
+                      ${COMMON_FOLDER}/utils/*.hpp              ${COMMON_FOLDER}/utils/*.cpp
+                      ${COMMON_FOLDER}/*.hpp                    ${COMMON_FOLDER}/*.cpp)
+
+SET(_LIB_VERSION_ "${VERSION}")
+SET(_LIB_SOVERSION_ "0")
+SET(PC_FILE "${PROJECT_NAME}.pc")
+
+## Set the default ELF image symbol visibility to hidden. Using this feature
+## can very substantially improve linking and load times of shared object
+## libraries, produce more optimized code, provide near-perfect API export
+## and prevent symbol clashes
+ADD_DEFINITIONS(-fvisibility=hidden)
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${wrapper_SRCS} ${common_SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
+        SOVERSION ${_LIB_SOVERSION_}
+        VERSION ${_LIB_VERSION_}
+        COMPILE_DEFINITIONS HOST_IPC_SOCKET="${VSM_SERVER_IPC_SOCKET_PATH}")
+
+## Link libraries ##############################################################
+FIND_PACKAGE(Boost COMPONENTS system filesystem)
+PKG_CHECK_MODULES(LIB_DEPS REQUIRED gio-2.0 libsystemd-daemon libcap-ng)
+INCLUDE_DIRECTORIES(SYSTEM ${LIB_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(${COMMON_FOLDER})
+INCLUDE_DIRECTORIES(${LIBS_FOLDER})
+INCLUDE_DIRECTORIES(${SERVER_FOLDER})
+INCLUDE_DIRECTORIES(${CLIENT_FOLDER})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES}
+                      Config SimpleDbus)
+
+## Generate the pc file ########################################################
+CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY)
+
+
+## Install #####################################################################
+INSTALL(FILES       ${CMAKE_BINARY_DIR}/${PC_FILE}
+        DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+INSTALL(TARGETS     ${PROJECT_NAME}
+        DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        COMPONENT   RuntimeLibraries)
+
+INSTALL(FILES       vasum.h vasum_list.h
+        DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME})
similarity index 100%
rename from client/vasum.h
rename to wrapper/vasum.h
similarity index 100%
rename from client/vasum.pc.in
rename to wrapper/vasum.pc.in
similarity index 100%
rename from client/vasum_list.h
rename to wrapper/vasum_list.h
similarity index 99%
rename from client/wrapper-compat.cpp
rename to wrapper/wrapper-compatibility.cpp
index 67b34e6..d0bd082 100644 (file)
@@ -23,7 +23,7 @@
  * @brief   Vasum old API compatibility functions
  */
 
-#include "wrapper-compat.h"
+#include "wrapper-compatibility.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
similarity index 99%
rename from client/vasum-wrapper.cpp
rename to wrapper/wrapper.cpp
index 54c195e..c5eadbc 100644 (file)
 #include <algorithm>
 
 #include "config.hpp"
+#include "vasum-client-impl.hpp"
 #include "logger/logger.hpp"
 #include "logger/backend-journal.hpp"
 
-#include "wrapper-compat.h"
-#include "vasum-client-impl.hpp"
-
-#define MAX_EPOLL_EVENTS 16
+#include "wrapper-compatibility.h"
 
 struct WrappedZone
 {