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 SET(_LIB_VERSION_ "${VERSION}")
31 SET(_LIB_SOVERSION_ "0")
32 SET(PC_FILE "${PROJECT_NAME}.pc")
34 ## Set the default ELF image symbol visibility to hidden. Using this feature
35 ## can very substantially improve linking and load times of shared object
36 ## libraries, produce more optimized code, provide near-perfect API export
37 ## and prevent symbol clashes
38 ADD_DEFINITIONS(-fvisibility=hidden)
39 ADD_DEFINITIONS(-D__STDC_FORMAT_MACROS)
41 ADD_LIBRARY(${PROJECT_NAME} SHARED ${wrapper_SRCS})
42 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
43 SOVERSION ${_LIB_SOVERSION_}
44 VERSION ${_LIB_VERSION_}
45 COMPILE_DEFINITIONS HOST_IPC_SOCKET="${VSM_SERVER_IPC_SOCKET_PATH}")
47 ADD_DEPENDENCIES(${PROJECT_NAME} Common Config Ipc)
49 ## Link libraries ##############################################################
50 FIND_PACKAGE(Boost COMPONENTS system filesystem)
51 PKG_CHECK_MODULES(LIB_DEPS REQUIRED gio-2.0)
52 INCLUDE_DIRECTORIES(SYSTEM ${LIB_DEPS_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${JSON_C_INCLUDE_DIRS})
53 INCLUDE_DIRECTORIES(${COMMON_FOLDER})
54 INCLUDE_DIRECTORIES(${LIBS_FOLDER})
55 INCLUDE_DIRECTORIES(${SERVER_FOLDER})
56 INCLUDE_DIRECTORIES(${CLIENT_FOLDER})
58 TARGET_LINK_LIBRARIES(${PROJECT_NAME} Common ${LIB_DEPS_LIBRARIES} ${Boost_LIBRARIES} Config Ipc)
60 TARGET_LINK_LIBRARIES(${PROJECT_NAME} SimpleDbus)
61 ENDIF(NOT WITHOUT_DBUS)
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 ${LIB_INSTALL_DIR}
73 COMPONENT RuntimeLibraries)
75 INSTALL(FILES vasum.h vasum_list.h
76 DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME})