summaryrefslogtreecommitdiff
path: root/enhanced-position-service/franca/api/CMakeLists.txt
blob: c201b9e65b1e3aaf645680a7514e8c383ee8d66c (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
###########################################################################
# @licence app begin@
# SPDX-License-Identifier: MPL-2.0
#
# Component Name: EnhancedPositionService
#
# Author: Marco Residori
#
# Copyright (C) 2015, XS Embedded GmbH
# 
# Note:
# The current file is an adaptation of the example file
# http://git.projects.genivi.org/?p=ipc/common-api-tools.git;a=blob;f=CommonAPI-Examples/E01HelloWorld/CMakeLists.txt
#
# 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@
###########################################################################

cmake_minimum_required (VERSION 2.8.1)

PROJECT(EnhancedPositionService)

option(COMMONAPI_TOOL_GENERATOR
       "Absolute path to CommonAPI code generator" "")
option(COMMONAPI_DBUS_TOOL_GENERATOR
       "Absolute path to CommonAPI-DBus code generator" "")

set(COMMONAPI_FIDL_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(COMMONAPI_GEN_DIR "${CMAKE_BINARY_DIR}/enhanced-position-service/franca/api")

find_package(PkgConfig REQUIRED)

include(FindPkgConfig)

message("CMAKE_BINARY_DIR" ${CMAKE_BINARY_DIR})
message("COMMONAPI_GEN_DIR" ${COMMONAPI_GEN_DIR})
message("COMMONAPI_FIDL_DIR" ${COMMONAPI_FIDL_DIR})
message("CMAKE_CURRENT_SOURCE_DIR" ${CMAKE_CURRENT_SOURCE_DIR})

# generate code from fidl
file(GLOB FIDL_FILES "${COMMONAPI_FIDL_DIR}/*.fidl")
message("FIDL_FILES: ${FIDL_FILES}")

if (COMMONAPI_TOOL_GENERATOR)
    execute_process(WORKING_DIRECTORY ${COMMONAPI_FIDL_DIR}
                COMMAND ${COMMONAPI_TOOL_GENERATOR} -sk -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES})
    message("COMMONAPI_TOOL_GENERATOR=" ${COMMONAPI_TOOL_GENERATOR})
else ()
    message (FATAL_ERROR "Set the variable -DCOMMONAPI_TOOL_GENERATOR=<path>")
endif ()

if (COMMONAPI_DBUS_TOOL_GENERATOR)
     execute_process(WORKING_DIRECTORY ${COMMONAPI_FIDL_DIR}
                COMMAND ${COMMONAPI_DBUS_TOOL_GENERATOR} -d ${COMMONAPI_GEN_DIR} ${FIDL_FILES})
     message("COMMONAPI_DBUS_TOOL_GENERATOR=" ${COMMONAPI_DBUS_TOOL_GENERATOR})
else ()
    message (FATAL_ERROR "Set the variable -DCOMMONAPI_DBUS_TOOL_GENERATOR=<path>")
endif ()