summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 9bd545bcd1374fdd8151a66b712529c77fad05fa (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
cmake_minimum_required(VERSION 2.8.11)

INCLUDE(FindPkgConfig)

set(PROJECT_NAME "agl-service-navigation")
set(PROJECT_PRETTY_NAME "AFM binding for navigation service")
set(PROJECT_DESCRIPTION "Binding for AGL Navigation API")
set(PROJECT_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include)
set(PROJECT_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
set(PROJECT_API_VERSION 0.1.0)
set(PROJECT_URL "https://wiki.automotivelinux.org/eg-navi")

# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  message(STATUS "Setting build type to 'Release' as none was specified.")
  set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
endif()

project(navi_binder)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC ")

set(CMAKE_INCLUDE_CURRENT_DIR ON)

pkg_check_modules(DBUSCXX REQUIRED dbus-c++-1)
pkg_check_modules(JSON REQUIRED json-c)
pkg_check_modules(AFBWSC REQUIRED libafbwsc)

include_directories( ${PROJECT_SOURCE_DIR}/libnavi/include ${PROJECT_SOURCE_DIR}/include ${DBUSCXX_INCLUDE_DIRS} ${JSON_INCLUDE_DIRS} ${AFBWSC_INCLUDE_DIRS} )

add_library( naviapi-agl SHARED libnavi/src/navicore.cpp libnavi/src/navicorelistener.cpp libnavi/src/BinderClient.cpp libnavi/src/JsonRequestGenerator.cpp libnavi/src/JsonResponseAnalyzer.cpp libnavi/src/RequestManage.cpp )
target_link_libraries( naviapi-agl ${JSON_LIBRARIES} ${AFBWSC_LIBRARIES} )
set_target_properties(naviapi-agl PROPERTIES VERSION 0.1.0 SOVERSION 0)

install(TARGETS naviapi-agl LIBRARY DESTINATION ${PROJECT_LIBDIR})
install(FILES ${PROJECT_SOURCE_DIR}/libnavi/include/libnavicore.hpp DESTINATION ${PROJECT_INCLUDEDIR})

add_library( NaviAPIService SHARED src/api.cpp src/analyze_request.cpp src/binder_reply.cpp src/genivi_request.cpp )

target_link_libraries( NaviAPIService ${DBUSCXX_LIBRARIES} ${JSON_LIBRARIES} ${AFBWSC_LIBRARIES} )

##########################################################################
# AGL binding
configure_file(config.xml.in config.xml)
set(BINARY_NAME "naviapi.wgt")

add_custom_command(
	OUTPUT ${BINARY_NAME}
	DEPENDS NaviAPIService
	COMMAND rm -rf package
	COMMAND mkdir -p package/root
	COMMAND mkdir -p package/root/lib
	COMMAND mv config.xml package/root/
	COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/navigation.png package/root/icon.png
	COMMAND mv libNaviAPIService.so package/root/lib
	COMMAND wgtpkg-pack -f -o package/${BINARY_NAME} package/root
)
add_custom_target(widget ALL DEPENDS ${BINARY_NAME})

#generate configure file
configure_file(libnaviapi-agl.pc.in libnaviapi-agl.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnaviapi-agl.pc
  DESTINATION
  ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)