1############################################################################ 2# 3# Copyright 2015 Codethink Ltd 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-input-controller) 23 24find_package(PkgConfig REQUIRED) 25pkg_check_modules(WAYLAND_SERVER wayland-server REQUIRED) 26pkg_check_modules(WESTON weston>=5.0.0 REQUIRED) 27pkg_check_modules(PIXMAN pixman-1 REQUIRED) 28 29GET_TARGET_PROPERTY(ILM_COMMON_INCLUDE_DIRS ilmCommon INCLUDE_DIRECTORIES) 30GET_TARGET_PROPERTY(IVI_CONTROLLER_INCLUDE_DIRS ivi-controller INCLUDE_DIRECTORIES) 31 32find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner) 33 34add_custom_command( 35 OUTPUT ivi-input-server-protocol.h 36 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} server-header 37 < ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml 38 > ${CMAKE_CURRENT_BINARY_DIR}/ivi-input-server-protocol.h 39 DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml 40) 41 42add_custom_command( 43 OUTPUT ivi-input-protocol.c 44 COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code 45 < ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml 46 > ${CMAKE_CURRENT_BINARY_DIR}/ivi-input-protocol.c 47 DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml 48) 49 50include_directories( 51 include 52 ${CMAKE_CURRENT_BINARY_DIR} 53 ${ILM_COMMON_INCLUDE_DIRS} 54 ${IVI_CONTROLLER_INCLUDE_DIRS} 55 ${WAYLAND_SERVER_INCLUDE_DIRS} 56 ${WESTON_INCLUDE_DIRS} 57 ${PIXMAN_INCLUDE_DIRS} 58) 59 60link_directories( 61 ${WAYLAND_SERVER_LIBRARY_DIRS} 62 ${WESTON_LIBRARY_DIRS} 63 ${PIXMAN_LIBRARY_DIRS} 64) 65 66 67add_library(${PROJECT_NAME} MODULE 68 src/ivi-input-controller.c 69 ivi-input-server-protocol.h 70 ivi-input-protocol.c 71) 72 73set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") 74 75add_dependencies(${PROJECT_NAME} 76 ilmCommon 77 ${WAYLAND_SERVER_LIBRARIES} 78 ${WESTON_LIBRARIES} 79 ${PIXMAN_LIBRARIES} 80) 81 82set(LIBS 83 ${LIBS} 84 ${WAYLAND_SERVER_LIBRARIES} 85 ${WESTON_LIBRARIES} 86) 87 88set(CMAKE_C_LDFLAGS "-module -avoid-version") 89 90target_link_libraries(${PROJECT_NAME} ${LIBS}) 91 92install ( 93 TARGETS ${PROJECT_NAME} 94 LIBRARY DESTINATION lib${LIB_SUFFIX}/weston 95) 96