• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1############################################################################
2#
3# Copyright (C) 2013 DENSO CORPORATION
4# Copyright 2014 BMW Car IT GmbH
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(ivi-controller)
24
25find_package(PkgConfig REQUIRED)
26pkg_check_modules(WAYLAND_SERVER wayland-server>=1.13.0 REQUIRED)
27pkg_check_modules(WESTON weston>=5.0.0 REQUIRED)
28pkg_check_modules(PIXMAN pixman-1 REQUIRED)
29
30find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
31
32add_custom_command(
33    OUTPUT  ivi-wm-server-protocol.h
34    COMMAND ${WAYLAND_SCANNER_EXECUTABLE} server-header
35            < ${CMAKE_SOURCE_DIR}/protocol/ivi-wm.xml
36            > ${CMAKE_CURRENT_BINARY_DIR}/ivi-wm-server-protocol.h
37    DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-wm.xml
38)
39
40add_custom_command(
41    OUTPUT  ivi-wm-protocol.c
42    COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code
43            < ${CMAKE_SOURCE_DIR}/protocol/ivi-wm.xml
44            > ${CMAKE_CURRENT_BINARY_DIR}/ivi-wm-protocol.c
45    DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-wm.xml
46)
47
48INCLUDE (CheckFunctionExists)
49
50CHECK_FUNCTION_EXISTS(posix_fallocate HAVE_POSIX_FALLOCATE)
51
52configure_file(src/config.h.cmake config.h)
53
54include_directories(
55    src
56    ${CMAKE_CURRENT_BINARY_DIR}
57    ${WAYLAND_SERVER_INCLUDE_DIRS}
58    ${WESTON_INCLUDE_DIRS}
59    ${PIXMAN_INCLUDE_DIRS}
60)
61
62link_directories(
63    ${WAYLAND_SERVER_LIBRARY_DIRS}
64    ${PIXMAN_LIBRARY_DIRS}
65)
66
67
68add_library(${PROJECT_NAME} MODULE
69    src/ivi-controller.c
70    ivi-wm-protocol.c
71    ivi-wm-server-protocol.h
72)
73
74set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
75
76add_dependencies(${PROJECT_NAME}
77    ${WAYLAND_SERVER_LIBRARIES}
78    ${PIXMAN_LIBRARIES}
79)
80
81set(LIBS
82    ${LIBS}
83    ${WAYLAND_SERVER_LIBRARIES}
84)
85
86set(CMAKE_C_LDFLAGS "-module -avoid-version")
87
88target_link_libraries(${PROJECT_NAME} ${LIBS})
89
90install (
91    TARGETS             ${PROJECT_NAME}
92    LIBRARY DESTINATION lib${LIB_SUFFIX}/weston
93)
94