1############################################################################ 2# 3# Copyright 2010-2014 BMW Car IT GmbH 4# Copyright (C) 2013 DENSO CORPORATION 5# 6# 7# Licensed under the Apache License, Version 2.0 (the "License"); 8# you may not use this file except in compliance with the License. 9# You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, software 14# distributed under the License is distributed on an "AS IS" BASIS, 15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16# See the License for the specific language governing permissions and 17# limitations under the License. 18# 19############################################################################ 20 21cmake_minimum_required (VERSION 2.6) 22 23project(ilmControl) 24 25find_package(Threads) 26find_package(PkgConfig REQUIRED) 27pkg_check_modules(WAYLAND_CLIENT wayland-client REQUIRED) 28 29GET_TARGET_PROPERTY(ILM_COMMON_INCLUDE_DIRS ilmCommon INCLUDE_DIRECTORIES) 30 31find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner) 32 33add_custom_command( 34 OUTPUT ivi-wm-client-protocol.h 35 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header 36 < ${CMAKE_SOURCE_DIR}/protocol/ivi-wm.xml 37 > ${CMAKE_CURRENT_BINARY_DIR}/ivi-wm-client-protocol.h 38 DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-wm.xml 39) 40 41add_custom_command( 42 OUTPUT ivi-wm-protocol.c 43 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code 44 < ${CMAKE_SOURCE_DIR}/protocol/ivi-wm.xml 45 > ${CMAKE_CURRENT_BINARY_DIR}/ivi-wm-protocol.c 46 DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-wm.xml 47) 48 49add_custom_command( 50 OUTPUT ivi-input-client-protocol.h 51 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header 52 < ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml 53 > ${CMAKE_CURRENT_BINARY_DIR}/ivi-input-client-protocol.h 54 DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml 55) 56 57add_custom_command( 58 OUTPUT ivi-input-protocol.c 59 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code 60 < ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml 61 > ${CMAKE_CURRENT_BINARY_DIR}/ivi-input-protocol.c 62 DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml 63) 64 65include_directories( 66 include 67 ${ILM_COMMON_INCLUDE_DIRS} 68 ${WAYLAND_CLIENT_INCLUDE_DIR} 69 ${CMAKE_CURRENT_BINARY_DIR} 70) 71 72link_directories( 73 ${WAYLAND_CLIENT_LIBRARY_DIRS} 74) 75 76add_library(${PROJECT_NAME} SHARED 77 src/ilm_control_wayland_platform.c 78 src/bitmap.c 79 src/writepng.c 80 ivi-wm-client-protocol.h 81 ivi-wm-protocol.c 82 ivi-input-client-protocol.h 83 ivi-input-protocol.c 84) 85 86add_dependencies(${PROJECT_NAME} 87 ${WAYLAND_CLIENT_LIBRARIES} 88) 89 90set(LIBS 91 ${LIBS} 92 rt 93 dl 94 png 95 ${CMAKE_THREAD_LIBS_INIT} 96 ${WAYLAND_CLIENT_LIBRARIES} 97) 98 99target_link_libraries(${PROJECT_NAME} ${LIBS}) 100 101install ( 102 TARGETS ${PROJECT_NAME} 103 LIBRARY DESTINATION lib${LIB_SUFFIX} 104) 105 106install ( 107 FILES ${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmControl/include/ilm_control.h 108 DESTINATION include/ilm 109) 110 111SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${ILM_API_VERSION} SOVERSION ${ILM_API_VERSION}) 112 113 114#============================================================================================= 115# generate documentation for ilmControl API 116#============================================================================================= 117 118add_custom_target(ilm-control-doc 119 COMMAND cat ${CMAKE_SOURCE_DIR}/doc/Doxyfile.template 120 | sed 's/___DOC_NAME___/ilmControl API/' 121 | sed 's/___DOC_VERSION___/${ILM_API_VERSION}/' 122 | sed 's!___INPUT_FILE___!${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmCommon/include/ilm_common.h ${CMAKE_CURRENT_SOURCE_DIR}/include/ilm_control.h!' 123 | sed 's/___OUTPUT_DIR___/ilm-control-doc/' 124 | doxygen - 125 COMMAND make --silent -C ilm-control-doc/latex 126 COMMAND cp ilm-control-doc/latex/refman.pdf 127 ${CMAKE_BINARY_DIR}/ilm-control-api-${ILM_API_VERSION}.pdf 128 COMMENT "Generating ilm-control-api-${ILM_API_VERSION}.pdf" 129) 130 131#============================================================================================= 132# generate pkg-config file for ilmControl API 133#============================================================================================= 134 135configure_file( 136 "${CMAKE_CURRENT_SOURCE_DIR}/ilmControl.pc.in" 137 "${CMAKE_CURRENT_BINARY_DIR}/ilmControl.pc" 138 @ONLY 139) 140 141install( 142 FILES "${CMAKE_CURRENT_BINARY_DIR}/ilmControl.pc" 143 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" 144) 145