lxcpp: add all required objects to lxcpp.so, add test executable 44/47044/4
authorKrzysztof Dynowski <k.dynowski@samsung.com>
Fri, 28 Aug 2015 10:52:51 +0000 (12:52 +0200)
committerKrzysztof Dynowski <k.dynowski@samsung.com>
Fri, 28 Aug 2015 13:18:45 +0000 (15:18 +0200)
[Feature]       Linking with lxcpp give unknown symbol errors
[Cause]         No requird objects in lxcpp.so
[Solution]      Add them to CMakeLists.txt, create test app
[Verification]  Build, install

Change-Id: I4dc59091ea294aa51a6201236f6fe51162459b83

common/netlink/netlink.cpp
libs/lxcpp/CMakeLists.txt
tests/unit_tests/CMakeLists.txt
tests/unit_tests/lxcpp/lxcpp-api-compile-test.cpp [new file with mode: 0644]

index dd11ef3..1d966cb 100644 (file)
@@ -23,8 +23,7 @@
  */
 
 #include "config.hpp"
-#include "netlink.hpp"
-#include "utils.hpp"
+#include "netlink/netlink.hpp"
 #include "utils/exception.hpp"
 #include "utils/make-clean.hpp"
 #include "utils/environment.hpp"
index c7bd926..b04e437 100644 (file)
@@ -23,17 +23,25 @@ MESSAGE(STATUS "")
 MESSAGE(STATUS "Generating makefile for the liblxcpp...")
 FILE(GLOB HEADERS       *.hpp)
 FILE(GLOB HEADERS_UTILS ${COMMON_FOLDER}/utils/fd-utils.hpp
-                        ${COMMON_FOLDER}/utils/exception.hpp)
+                        ${COMMON_FOLDER}/utils/exception.hpp
+                        ${COMMON_FOLDER}/utils/channel.hpp
+                        ${COMMON_FOLDER}/utils/environment.hpp
+                        ${COMMON_FOLDER}/utils/execute.hpp)
+FILE(GLOB HEADERS_NETLINK  ${COMMON_FOLDER}/netlink/*.hpp)
 FILE(GLOB SRCS          *.cpp *.hpp)
 FILE(GLOB SRCS_UTILS    ${COMMON_FOLDER}/utils/fd-utils.cpp
-                        ${COMMON_FOLDER}/utils/exception.cpp)
+                        ${COMMON_FOLDER}/utils/exception.cpp
+                        ${COMMON_FOLDER}/utils/channel.cpp
+                        ${COMMON_FOLDER}/utils/environment.cpp
+                        ${COMMON_FOLDER}/utils/execute.cpp)
+FILE(GLOB SRCS_NETLINK  ${COMMON_FOLDER}/netlink/*.cpp)
 
 SET(_LIB_VERSION_ "${VERSION}")
 SET(_LIB_SOVERSION_ "0")
 SET(PC_FILE "lib${PROJECT_NAME}.pc")
 
 ## Setup target ################################################################
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} ${SRCS_UTILS})
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} ${SRCS_UTILS} ${SRCS_NETLINK})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
     SOVERSION   ${_LIB_SOVERSION_}
     VERSION     ${_LIB_VERSION_}
@@ -60,3 +68,5 @@ INSTALL(FILES       ${HEADERS}
         DESTINATION ${INCLUDE_INSTALL_DIR}/lxcpp)
 INSTALL(FILES       ${HEADERS_UTILS}
         DESTINATION ${INCLUDE_INSTALL_DIR}/lxcpp/utils)
+INSTALL(FILES       ${HEADERS_NETLINK}
+        DESTINATION ${INCLUDE_INSTALL_DIR}/lxcpp/netlink)
index 956082d..b532336 100644 (file)
@@ -24,12 +24,13 @@ 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         socket_test_SRCS ${SOCKET_TEST_FOLDER}/*.cpp ${SOCKET_TEST_FOLDER}/*.hpp)
+FILE(GLOB         lxcpp_test_SRCS lxcpp/lxcpp-api-compile-test.cpp)
 
 FILE(GLOB         main_SRC ${SERVER_FOLDER}/main.cpp)
 LIST(REMOVE_ITEM server_SRCS ${main_SRC})
 
 # We must compile socket-test separately, exclude it from unit-test build
-LIST(REMOVE_ITEM project_SRCS ${socket_test_SRCS})
+LIST(REMOVE_ITEM project_SRCS ${socket_test_SRCS} ${lxcpp_test_SRCS})
 
 
 ## Setup target ################################################################
@@ -39,6 +40,10 @@ ADD_EXECUTABLE(${UT_SERVER_CODENAME} ${project_SRCS} ${common_SRCS} ${server_SRC
 ## A fake target to test vasum-client C API
 ADD_EXECUTABLE("vasum-client-c-api-compile-test" client/client-c-api-compile-test.c)
 
+## A fake target to test lxcpp API
+ADD_EXECUTABLE("lxcpp-api-compile-test" lxcpp/lxcpp-api-compile-test.cpp)
+TARGET_LINK_LIBRARIES("lxcpp-api-compile-test" lxcpp)
+
 IF(NOT WITHOUT_SYSTEMD)
 SET(SOCKET_TEST_CODENAME "${PROJECT_NAME}-socket-test")
 
diff --git a/tests/unit_tests/lxcpp/lxcpp-api-compile-test.cpp b/tests/unit_tests/lxcpp/lxcpp-api-compile-test.cpp
new file mode 100644 (file)
index 0000000..2e72bfb
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *  Copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License version 2.1 as published by the Free Software Foundation.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/**
+ * @file
+ * @author  Krzysztof Dynowski (k.dynowski@samsumg.com)
+ * @brief  Test compilation and linking with lxcpp library
+ */
+
+#include "lxcpp/lxcpp.hpp"
+
+using namespace lxcpp;
+
+int main(int /*argc*/, const char * /*argv*/ [])
+{
+    Container* c = createContainer();
+    delete c;
+}