• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(ilmInput)
24
25find_package(Threads)
26find_package(PkgConfig REQUIRED)
27pkg_check_modules(WAYLAND_CLIENT wayland-client REQUIRED)
28
29GET_TARGET_PROPERTY(ILM_CONTROL_INCLUDE_DIRS ilmControl INCLUDE_DIRECTORIES)
30
31find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
32
33add_custom_command(
34    OUTPUT  ivi-input-client-protocol.h
35    COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
36            < ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml
37            > ${CMAKE_CURRENT_BINARY_DIR}/ivi-input-client-protocol.h
38    DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml
39)
40
41add_custom_command(
42    OUTPUT  ivi-input-protocol.c
43    COMMAND ${WAYLAND_SCANNER_EXECUTABLE} code
44            < ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml
45            > ${CMAKE_CURRENT_BINARY_DIR}/ivi-input-protocol.c
46    DEPENDS ${CMAKE_SOURCE_DIR}/protocol/ivi-input.xml
47)
48
49include_directories(
50    include
51    ${CMAKE_CURRENT_BINARY_DIR}
52    ${ILM_CONTROL_INCLUDE_DIRS}
53    ${WAYLAND_CLIENT_INCLUDE_DIR}
54)
55
56link_directories(
57    ${WAYLAND_CLIENT_LIBRARY_DIRS}
58)
59
60add_library(${PROJECT_NAME} SHARED
61    src/ilm_input.c
62    ivi-input-client-protocol.h
63    ivi-input-protocol.c
64)
65
66add_dependencies(${PROJECT_NAME}
67    ilmControl
68    ${WAYLAND_CLIENT_LIBRARIES}
69)
70
71set(LIBS
72    ${LIBS}
73    ilmControl
74    rt
75    dl
76    ${CMAKE_THREAD_LIBS_INIT}
77    ${WAYLAND_CLIENT_LIBRARIES}
78)
79
80target_link_libraries(${PROJECT_NAME} ${LIBS})
81
82install (
83    TARGETS             ${PROJECT_NAME}
84    LIBRARY DESTINATION lib${LIB_SUFFIX}
85)
86
87install (
88    FILES       ${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmInput/include/ilm_input.h
89    DESTINATION include/ilm
90)
91
92SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${ILM_API_VERSION} SOVERSION ${ILM_API_VERSION})
93
94
95#=============================================================================================
96# generate documentation for ilmInput API
97#=============================================================================================
98
99add_custom_target(ilm-input-doc
100                  COMMAND cat ${CMAKE_SOURCE_DIR}/doc/Doxyfile.template
101                          | sed 's/___DOC_NAME___/ilmInput API/'
102                          | sed 's/___DOC_VERSION___/${ILM_API_VERSION}/'
103                          | sed 's!___INPUT_FILE___!${CMAKE_SOURCE_DIR}/ivi-layermanagement-api/ilmCommon/include/ilm_common.h ${CMAKE_CURRENT_SOURCE_DIR}/include/ilm_input.h!'
104                          | sed 's/___OUTPUT_DIR___/ilm-input-doc/'
105                          | doxygen -
106                  COMMAND make --silent -C ilm-input-doc/latex
107                  COMMAND cp ilm-input-doc/latex/refman.pdf
108                             ${CMAKE_BINARY_DIR}/ilm-input-api-${ILM_API_VERSION}.pdf
109                  COMMENT "Generating ilm-input-api-${ILM_API_VERSION}.pdf"
110)
111
112#=============================================================================================
113# generate pkg-config file for ilmInput API
114#=============================================================================================
115
116configure_file(
117    "${CMAKE_CURRENT_SOURCE_DIR}/ilmInput.pc.in"
118    "${CMAKE_CURRENT_BINARY_DIR}/ilmInput.pc"
119    @ONLY
120)
121
122install(
123    FILES "${CMAKE_CURRENT_BINARY_DIR}/ilmInput.pc"
124    DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
125)
126