summaryrefslogtreecommitdiff
path: root/src/navigation/map-viewer/CMakeLists.txt
blob: 1caaf0d7d54e3d6a524f71726e202bc5f19ac30b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
###########################################################################
# @licence app begin@
# SPDX-License-Identifier: MPL-2.0
#
# Component Name: navigation
#
# Author: Philippe Colliot
#
# Copyright (C) 2014, PCA Peugeot Citroën
# 
# License:
# This Source Code Form is subject to the terms of the
# Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
# this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# @licence end@
###########################################################################
project(navigation)
cmake_minimum_required(VERSION 2.8)

message(STATUS "map-viewer")

include(FindPkgConfig)

pkg_search_module(DBUS_CPP_GLIB dbus-c++-glib-1)
pkg_search_module(DBUS_CPP dbus-c++-1)
pkg_search_module(GLIB glib-2.0)

include_directories(${GLIB_INCLUDE_DIRS})
include_directories(${DBUS_CPP_INCLUDE_DIRS})
include_directories(${DBUS_CPP_GLIB_INCLUDE_DIRS})

include(${PRELOAD_CACHE_FOR_PLUGINS})

include_directories(${NAVIT_DIR})
include_directories(.)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

include_directories(${NAVIT_CONFIG_H_DIR}) # this one contains config.h that is generated

include_directories(${NAVIGATION_COMMON_DIR})

find_program(XSLTPROC xsltproc REQUIRED)

# Generate the config file for navit/mapviewer
if(NOT ${YOCTO_CONFIG})
    if (WITH_PLUGIN_MIGRATION)
        execute_process(
            OUTPUT_FILE ${NAVIT_BIN_DIR}/navit_genivi_mapviewer.xml
            COMMAND ${XSLTPROC} ${CMAKE_CURRENT_SOURCE_DIR}/navit_genivi_mapviewer_capi.xsl ${navit_SOURCE_DIR}/navit/navit_shipped.xml
        )
    else()
        execute_process(
            OUTPUT_FILE ${NAVIT_BIN_DIR}/navit_genivi_mapviewer.xml
            COMMAND ${XSLTPROC} ${CMAKE_CURRENT_SOURCE_DIR}/navit_genivi_mapviewer.xsl ${navit_SOURCE_DIR}/navit/navit_shipped.xml
        )
    endif()
else()
    if (WITH_PLUGIN_MIGRATION)
        execute_process(
            OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/navit_genivi_mapviewer.xml
            COMMAND ${XSLTPROC} ${CMAKE_CURRENT_SOURCE_DIR}/navit_genivi_mapviewer_capi.xsl ${NAVIT_CMAKE_DIR}/../navit/navit_shipped.xml
        )
    else()
        execute_process(
            OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/navit_genivi_mapviewer.xml
            COMMAND ${XSLTPROC} ${CMAKE_CURRENT_SOURCE_DIR}/navit_genivi_mapviewer.xsl ${NAVIT_CMAKE_DIR}/../navit/navit_shipped.xml
        )
    endif()
endif()

add_definitions(-DPLUGIN=1)
if(WITH_DEBUG)
    add_definitions("-DDEBUG_ENABLED=1")
endif()

# Suppress dev warnings
if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
	set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
endif()

# Add sub directories for the plugins

set(PLUGIN_LDFLAGS ${DBUS_CPP_LDFLAGS} ${DBUS_CPP_GLIB_LDFLAGS} ${GLIB_LDFLAGS})
set(PLUGIN_LIBRARIES ${DBUS_CPP_LIBRARY_DIRS} ${GLIB_LIBRARY_DIRS} ${DBUS_CPP_GLIB_LIBRARY_DIRS})

if (WITH_PLUGIN_MIGRATION)
    # DBus Path
    if(DBUS_LIB_PATH)
      set(DBUS_INCLUDE_DIRS ${DBUS_LIB_PATH}/include/dbus-1.0 ${DBUS_LIB_PATH}/lib/dbus-1.0/include)
      set(DBUS_LIBDIR ${DBUS_LIB_PATH}/lib)
      set(DBUS_LIBRARIES ${DBUS_LIB_PATH}/lib/libdbus-1.so)
    else()
      message(FATAL_ERROR "Please specify the path to your patched DBus library using -DDBUS_LIB_PATH=yourPath")
    endif()

    # Packages
    find_package(CommonAPI)
    find_package(CommonAPI-DBus)

    #pkg_check_modules(DBUS "dbus-1 >= 1.8.4") // #to be fixed, it doesn't work so the paths are set manually (see above)
    pkg_check_modules(COMMONAPI "CommonAPI >= 3.1.5")
    pkg_check_modules(COMMONAPI_DBUS "CommonAPI-DBus >= 3.1.5")
    pkg_check_modules(GOBJECT gobject-2.0)
    pkg_check_modules(GLIB REQUIRED glib-2.0)
    pkg_check_modules(DBUS_CPP_GLIB dbus-c++-glib-1)

    set(FRANCA_DIR "${API_DIR}/franca")
    add_subdirectory(configuration-server-plugin)
    add_subdirectory(mapviewercontrol-server-plugin)
    add_subdirectory(session-server-plugin)
else()
    add_subdirectory(configuration-plugin)
    add_subdirectory(mapviewercontrol-plugin)
    add_subdirectory(session-plugin)
endif()