1 # Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 # @file CMakeLists.txt
17 # @author Mateusz Malicki (m.malicki2@samsung.com)
22 MESSAGE(STATUS "Generating makefile for the Vasum wrapper...")
24 ## set wrapper library sources (without vasum-client.cpp)
25 FILE(GLOB wrapper_SRCS *.cpp *.hpp *.h
26 ${CLIENT_FOLDER}/vasum-client-impl.hpp ${CLIENT_FOLDER}/vasum-client-impl.cpp
27 ${CLIENT_FOLDER}/host-ipc-connection.hpp ${CLIENT_FOLDER}/host-ipc-connection.cpp
28 ${CLIENT_FOLDER}/utils.hpp ${CLIENT_FOLDER}/utils.cpp)
30 FILE(GLOB common_SRCS ${COMMON_FOLDER}/epoll/*.hpp ${COMMON_FOLDER}/epoll/*.cpp
31 ${COMMON_FOLDER}/ipc/*.hpp ${COMMON_FOLDER}/ipc/*.cpp
32 ${COMMON_FOLDER}/ipc/internals/*.hpp ${COMMON_FOLDER}/ipc/internals/*.cpp
33 ${COMMON_FOLDER}/utils/*.hpp ${COMMON_FOLDER}/utils/*.cpp
34 ${COMMON_FOLDER}/*.hpp ${COMMON_FOLDER}/*.cpp)
36 SET(_LIB_VERSION_ "${VERSION}")
37 SET(_LIB_SOVERSION_ "0")
38 SET(PC_FILE "${PROJECT_NAME}.pc")
40 ## Set the default ELF image symbol visibility to hidden. Using this feature
41 ## can very substantially improve linking and load times of shared object
42 ## libraries, produce more optimized code, provide near-perfect API export
43 ## and prevent symbol clashes
44 ADD_DEFINITIONS(-fvisibility=hidden)
46 ADD_LIBRARY(${PROJECT_NAME} SHARED ${wrapper_SRCS} ${common_SRCS})
47 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
48 SOVERSION ${_LIB_SOVERSION_}
49 VERSION ${_LIB_VERSION_}
50 COMPILE_DEFINITIONS HOST_IPC_SOCKET="${VSM_SERVER_IPC_SOCKET_PATH}")
52 ## Link libraries ##############################################################
53 FIND_PACKAGE(Boost COMPONENTS system filesystem)
54 PKG_CHECK_MODULES(LIB_DEPS REQUIRED gio-2.0 libcap-ng)
55 INCLUDE_DIRECTORIES(SYSTEM ${LIB_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
56 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
57 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
58 INCLUDE_DIRECTORIES(${SERVER_FOLDER})
59 INCLUDE_DIRECTORIES(${CLIENT_FOLDER})
60 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES}
63 ## Generate the pc file ########################################################
64 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY)
67 ## Install #####################################################################
68 INSTALL(FILES ${CMAKE_BINARY_DIR}/${PC_FILE}
69 DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
71 INSTALL(TARGETS ${PROJECT_NAME}
72 DESTINATION ${CMAKE_INSTALL_LIBDIR}
73 COMPONENT RuntimeLibraries)
75 INSTALL(FILES vasum.h vasum_list.h
76 DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME})