reworked tests in gpsnmea
[profile/ivi/automotive-message-broker.git] / CMakeLists.txt
1 project(automotive-message-broker)
2 cmake_minimum_required(VERSION 2.8)
3
4 set(CMAKE_BUILD_TYPE, Debug)
5
6 include(FindPkgConfig)
7
8 set(PROJECT_NAME "automotive-message-broker")
9 set(PROJECT_VERSION "0.11.809")
10 set(PROJECT_CODENAME "veyron")
11 set(PROJECT_QUALITY "alpha")
12
13 add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
14 add_definitions(-DPROJECT_NAME="${PROJECT_NAME}")
15 add_definitions(-DPROJECT_CODENAME="${PROJECT_CODENAME}")
16 add_definitions(-DPROJECT_QUALITY="${PROJECT_QUALITY}")
17
18 set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
19 set (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE STRING "Directory where lib will install")
20 set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
21 set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/packages/${PROJECT_NAME}" CACHE PATH "The directory the docs will be installed to")
22
23 option(qtmainloop "Use QCoreApplication mainloop " OFF)
24 option(websocket_plugin "websocket source and sink plugins" OFF)
25 option(websocketold_plugin "old websocket sink plugin" OFF)
26 option(tpms_plugin "TPMS plugin " OFF)
27 option(obd2_plugin "OBD-II plugin" OFF)
28 option(database_plugin "Database plugins" OFF)
29 option(qt_bindings "AMB Qt DBus bindings" OFF)
30 option(opencvlux_plugin "OpenCV Lux plugin" OFF)
31 option(murphy_plugin "murphy policy framework plugin" OFF)
32 option(test_plugin "Test Plugin" ON)
33 option(bluemonkey_plugin "bluemonkey irc plugin" OFF)
34 option(gpsnmea_plugin "gps NMEA location plugin" OFF)
35 option(openxc_plugin "OpenXC plugin" OFF)
36 option(obdlinkcan_plugin "ObdLink mx CAN plugin" OFF)
37 option(cansim_plugin "Can simulator plugin" OFF)
38 option(cangen_plugin "Can generator plugin" OFF)
39 option(enable_icecc "Enable icecc checking, for distributed compilation" ON)
40 option(enable_docs "enable Doxygen doc generation" OFF)
41
42 #turn on -fpic/-fpie:
43 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
44 list(APPEND CMAKE_CXX_FLAGS "-fpie -pie -std=c++11")
45
46 if(opencvlux_plugin)
47    message(STATUS "OpenCV Lux plugin enabled")
48
49 endif(opencvlux_plugin)
50
51 include (CMakeForceCompiler)
52
53 if (enable_icecc)
54    find_program(ICECC /usr/lib/icecc/bin/g++)
55     if (ICECC)
56         message(STATUS "icecc will be used for distributed compiling")
57         cmake_force_cxx_compiler(${ICECC} icecc)
58     else(ICECC)
59         message(STATUS "Not using icecc")
60     endif(ICECC)
61 endif(enable_icecc)
62
63 # add a target to generate API documentation with Doxygen
64 if(enable_docs)
65 message(STATUS "doxygen doc generation enabled")
66 find_package(Doxygen)
67 if(DOXYGEN_FOUND)
68         configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
69         add_custom_target(all ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs COMMENT "Generating API documentation with Doxygen" VERBATIM)
70 endif(DOXYGEN_FOUND)
71 endif(enable_docs)
72
73 find_library(libtool_LIBRARY ltdl DOC "Libtool libraries")
74 find_path(libtool_INCLUDE_DIR ltdl.h DOC "Libtool headers")
75
76 if(libtool_LIBRARY)
77      message(STATUS "libltdl / libtool found")
78 else(libtool_LIBRARY)
79      message(FATAL_ERROR "libltdl / libtool missing.  please install libltdl / libtool")
80 endif(libtool_LIBRARY)
81
82 find_package(Boost REQUIRED)
83
84
85 pkg_check_modules(glib REQUIRED glib-2.0 gobject-2.0)
86 pkg_check_modules(json REQUIRED json)
87
88 add_definitions(-DDBusServiceName="org.automotive.message.broker")
89
90 set(include_dirs ${libtool_INCLUDE_DIR} ${glib_INCLUDE_DIRS} ${gio_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${json_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/lib)
91 set(link_libraries -lamb ${libtool_LIBRARY} ${glib_LIBRARIES} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
92
93 if(qtmainloop)
94         message(STATUS "using Qt mainloop")
95
96         find_package(Qt5Core)
97         if(Qt5Core_FOUND)
98                 message(STATUS "using Qt5")
99                 set(QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS})
100                 set(QT_LIBRARIES ${Qt5Core_LIBRARIES})
101                 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
102         #       if(CMAKE_SIZEOF_VOID_P MATCHES "8")
103         #               set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcmodel=large")
104         #       endif(CMAKE_SIZEOF_VOID_P MATCHES "8")
105                 add_definitions(${Qt5Core_DEFINITIONS})
106         else(Qt5Core_FOUND)
107                 message(STATUS "using Qt4")
108                 find_package( Qt4 REQUIRED )
109                 include(${QT_USE_FILE})
110
111         endif(Qt5Core_FOUND)
112
113         set(include_dirs ${include_dirs} ${QT_INCLUDE_DIRS})
114         set(link_libraries ${link_libraries} ${QT_LIBRARIES})
115
116         add_definitions(-DQT_NO_KEYWORDS)
117         add_definitions(-DUSE_QT_CORE)
118 endif(qtmainloop)
119
120 set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
121 add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
122
123 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
124 add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
125
126 # packaging stuff:
127 # Common things to every type of package
128 SET(CPACK_PACKAGE_DESCRIPTION "daemon to access vehicle data")
129 SET(CPACK_PACKAGE_NAME "automotive-message-broker")
130 SET(CPACK_PACKAGE_EXECUTABLES "ambd")
131 SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
132 SET(CPACK_STRIP_FILES true)
133 SET(CPACK_PACKAGE_CONTACT "tripzero.kev@gmail.com")
134 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
135
136
137 # Always build .tar.gz and .sh files
138 SET(CPACK_GENERATOR "STGZ;TGZ")
139
140 SET(CPACK_GENERATOR "${CPACK_GENERATOR};DEB")
141 SET(CPACK_DEBIAN_PACKAGE_DEPENDS "gpsd (>=2.0), libopencv, libjson0, libltdl7")
142 SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
143
144 INCLUDE(CPack)
145
146 add_subdirectory(lib)
147 add_subdirectory(ambd)
148 add_subdirectory(plugins)
149 add_subdirectory(docs)
150 add_subdirectory(tests)
151 add_subdirectory(examples)