ilmControl: control_thread variables are const
[profile/ivi/wayland-ivi-extension.git] / weston-ivi-shell / CMakeLists.txt
index 63fd35f..c1d08da 100644 (file)
@@ -1,6 +1,7 @@
 ############################################################################
 #
 # Copyright (C) 2013 DENSO CORPORATION
+# Copyright 2014 BMW Car IT GmbH
 #
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 cmake_minimum_required (VERSION 2.6)
 
 project(ivi-controller)
-project_type(CORE)
 
-find_package(Cairo REQUIRED)
-find_package(Wayland REQUIRED)
-find_package(Weston REQUIRED)
-find_package(Pixman REQUIRED)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(WAYLAND_SERVER wayland-server REQUIRED)
+pkg_check_modules(CAIRO cairo REQUIRED)
+pkg_check_modules(WESTON weston REQUIRED)
+pkg_check_modules(PIXMAN pixman-1 REQUIRED)
 
-add_custom_command(
-    OUTPUT ivi-application-server-protocol.h
-    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
-)
-
-add_custom_command(
-    OUTPUT ivi-application-protocol.c
-    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
-)
-
-add_custom_command(
-    OUTPUT ivi-controller-server-protocol.h
-    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
-)
+GET_TARGET_PROPERTY(IVI_EXTENSION_INCLUDE_DIRS ivi-extension-protocol INCLUDE_DIRECTORIES)
 
-add_custom_command(
-    OUTPUT ivi-controller-protocol.c
-    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
+include_directories(
+    include
+    ${IVI_EXTENSION_INCLUDE_DIRS}
+    ${WAYLAND_SERVER_INCLUDE_DIRS}
+    ${CAIRO_INCLUDE_DIRS}
+    ${WESTON_INCLUDE_DIRS}
+    ${PIXMAN_INCLUDE_DIRS}
+    ${WESTON_INCLUDE_DIRS}/weston
 )
 
-add_custom_target(
-    generate_wayland_protocol_codes_for_server
-    DEPENDS ivi-application-server-protocol.h ivi-application-protocol.c ivi-controller-server-protocol.h ivi-controller-protocol.c
-)
-
-include_directories(
-    "include"
-    ${WAYLAND_SERVER_INCLUDE_DIR}
-    ${CAIRO_INCLUDE_DIR}
-    ${WESTON_INCLUDE_DIR}
-    ${PIXMAN_INCLUDE_DIR}
+link_directories(
+    ${WAYLAND_SERVER_LIBRARY_DIRS}
+    ${CAIRO_LIBRARY_DIRS}
+    ${WESTON_LIBRARY_DIRS}
+    ${PIXMAN_LIBRARY_DIRS}
+    ${WESTON_LIBDIR}/weston
 )
 
 
 add_library(${PROJECT_NAME} MODULE
     src/ivi-controller.c
-    src/ivi-controller-protocol.c
 )
 
 set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
 
 add_dependencies(${PROJECT_NAME}
-    generate_wayland_protocol_codes_for_server
+    ivi-extension-protocol
     ${WAYLAND_SERVER_LIBRARIES}
     ${CAIRO_LIBRARIES}
     ${PIXMAN_LIBRARIES}
@@ -78,14 +65,15 @@ add_dependencies(${PROJECT_NAME}
 
 set(LIBS
     ${LIBS}
-    rt
-    dl
+    ivi-extension-protocol
     ${WAYLAND_SERVER_LIBRARIES}
     ${CAIRO_LIBRARIES}
     ${WESTON_LIBRARIES}
 )
 
-target_link_libraries(${PROJECT_NAME} ${LIBS} -ldl)
+set(CMAKE_C_LDFLAGS "-module -avoid-version")
+
+target_link_libraries(${PROJECT_NAME} ${LIBS})
 
 install (
     TARGETS             ${PROJECT_NAME}