weston-ivi-shell: Set-up to build ivi-shell
[profile/ivi/wayland-ivi-extension.git] / weston-ivi-shell / CMakeLists.txt
1 ############################################################################
2 #
3 # Copyright (C) 2013 DENSO CORPORATION
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
20 cmake_minimum_required (VERSION 2.6)
21
22 project(ivi-shell)
23 project_type(CORE)
24
25 find_package(Cairo REQUIRED)
26 find_package(Wayland REQUIRED)
27 find_package(Weston REQUIRED)
28 find_package(Pixman REQUIRED)
29
30 add_custom_command(
31     OUTPUT ivi-application-server-protocol.h
32     COMMAND ${CMAKE_INSTALL_PREFIX}/bin/wayland-scanner server-header <${CMAKE_SOURCE_DIR}/protocol/ivi-application.xml> ${CMAKE_SOURCE_DIR}/weston-ivi-shell/include/ivi-application-server-protocol.h
33 )
34
35 add_custom_command(
36     OUTPUT ivi-application-protocol.c
37     COMMAND ${CMAKE_INSTALL_PREFIX}/bin/wayland-scanner code <${CMAKE_SOURCE_DIR}/protocol/ivi-application.xml> ${CMAKE_SOURCE_DIR}/weston-ivi-shell/src/ivi-application-protocol.c
38 )
39
40 add_custom_command(
41     OUTPUT ivi-controller-server-protocol.h
42     COMMAND ${CMAKE_INSTALL_PREFIX}/bin/wayland-scanner server-header <${CMAKE_SOURCE_DIR}/protocol/ivi-controller.xml> ${CMAKE_SOURCE_DIR}/weston-ivi-shell/include/ivi-controller-server-protocol.h
43 )
44
45 add_custom_command(
46     OUTPUT ivi-controller-protocol.c
47     COMMAND ${CMAKE_INSTALL_PREFIX}/bin/wayland-scanner code <${CMAKE_SOURCE_DIR}/protocol/ivi-controller.xml> ${CMAKE_SOURCE_DIR}/weston-ivi-shell/src/ivi-controller-protocol.c
48 )
49
50 add_custom_target(
51     generate_wayland_protocol_codes_for_server
52     DEPENDS ivi-application-server-protocol.h ivi-application-protocol.c ivi-controller-server-protocol.h ivi-controller-protocol.c
53 )
54
55 include_directories(
56     "include"
57     ${WAYLAND_SERVER_INCLUDE_DIR}
58     ${CAIRO_INCLUDE_DIR}
59     ${WESTON_INCLUDE_DIR}
60     ${PIXMAN_INCLUDE_DIR}
61 )
62
63
64 add_library(${PROJECT_NAME} MODULE
65     src/ivi-shell.c
66     src/ivi-application-protocol.c
67     src/ivi-controller-protocol.c
68 )
69
70 set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
71
72 add_dependencies(${PROJECT_NAME}
73     generate_wayland_protocol_codes_for_server
74     ${WAYLAND_SERVER_LIBRARIES}
75     ${CAIRO_LIBRARIES}
76     ${PIXMAN_LIBRARIES}
77 )
78
79 set(LIBS
80     ${LIBS}
81     rt
82     dl
83     ${WAYLAND_SERVER_LIBRARIES}
84     ${CAIRO_LIBRARIES}
85 )
86
87 target_link_libraries(${PROJECT_NAME} ${LIBS} -ldl)
88
89 install (
90     TARGETS             ${PROJECT_NAME}
91     LIBRARY DESTINATION lib/weston
92 )