1############################################################################ 2# 3# Copyright 2014 BMW Car IT GmbH 4# 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17# 18############################################################################ 19 20cmake_minimum_required (VERSION 2.6) 21 22project (ivi-application) 23 24find_package(PkgConfig REQUIRED) 25pkg_check_modules(WAYLAND_CLIENT wayland-client>=1.13.0 REQUIRED) 26pkg_check_modules(WAYLAND_SERVER wayland-server>=1.13.0 REQUIRED) 27 28find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner) 29 30add_custom_command( 31 OUTPUT ivi-application-client-protocol.h 32 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header 33 < ${CMAKE_SOURCE_DIR}/protocol/ivi-application.xml 34 > ${CMAKE_CURRENT_BINARY_DIR}/ivi-application-client-protocol.h 35 DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-application.xml 36) 37 38add_custom_command( 39 OUTPUT ivi-application-protocol.c 40 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code 41 < ${CMAKE_SOURCE_DIR}/protocol/ivi-application.xml 42 > ${CMAKE_CURRENT_BINARY_DIR}/ivi-application-protocol.c 43 DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-application.xml 44) 45 46 47include_directories( 48 ${CMAKE_CURRENT_BINARY_DIR} 49 ${WAYLAND_CLIENT_INCLUDE_DIRS} 50 ${WAYLAND_SERVER_INCLUDE_DIRS} 51) 52 53link_directories( 54 ${WAYLAND_CLIENT_LIBRARY_DIRS} 55 ${WAYLAND_SERVER_LIBRARY_DIRS} 56) 57 58add_library(${PROJECT_NAME} SHARED 59 ${CMAKE_CURRENT_BINARY_DIR}/ivi-application-client-protocol.h 60 ${CMAKE_CURRENT_BINARY_DIR}/ivi-application-protocol.c 61) 62 63set_target_properties(${PROJECT_NAME} PROPERTIES 64 COMPILE_FLAGS "-fPIC") 65 66install( 67 TARGETS ${PROJECT_NAME} 68 LIBRARY DESTINATION lib${LIB_SUFFIX} 69) 70 71install( 72 FILES ${CMAKE_CURRENT_BINARY_DIR}/ivi-application-client-protocol.h 73 DESTINATION include/ilm 74) 75 76install( 77 FILES ${CMAKE_SOURCE_DIR}/protocol/ivi-application.xml 78 DESTINATION share/wayland-protocols/stable/ivi-application 79) 80 81SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${ILM_API_VERSION} SOVERSION ${ILM_API_VERSION}) 82 83#============================================================================================= 84# generate pkg-config file for ivi-application API 85#============================================================================================= 86 87configure_file( 88 "${CMAKE_CURRENT_SOURCE_DIR}/ivi-application.pc.in" 89 "${CMAKE_CURRENT_BINARY_DIR}/ivi-application.pc" 90 @ONLY 91) 92 93install( 94 FILES "${CMAKE_CURRENT_BINARY_DIR}/ivi-application.pc" 95 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" 96) 97