1 project(automotive-message-broker)
2 cmake_minimum_required(VERSION 2.8)
4 set(CMAKE_BUILD_TYPE, Debug)
8 set(PROJECT_NAME "automotive-message-broker")
9 set(PROJECT_VERSION "0.12.802")
10 set(PROJECT_CODENAME "agera")
11 set(PROJECT_QUALITY "alpha")
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}")
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 (PLUGIN_INSTALL_PATH "${LIB_INSTALL_DIR}/${PROJECT_NAME}")
21 set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
22 set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/packages/${PROJECT_NAME}" CACHE PATH "The directory the docs will be installed to")
24 option(qtmainloop "Use QCoreApplication mainloop " OFF)
25 option(websocket_plugin "websocket source and sink plugins" OFF)
26 option(websocketold_plugin "old websocket sink plugin" OFF)
27 option(tpms_plugin "TPMS plugin " OFF)
28 option(obd2_plugin "OBD-II plugin" OFF)
29 option(database_plugin "Database plugins" OFF)
30 option(qt_bindings "AMB Qt DBus bindings" OFF)
31 option(opencvlux_plugin "OpenCV Lux plugin" OFF)
32 option(murphy_plugin "murphy policy framework plugin" OFF)
33 option(test_plugin "Test Plugin" ON)
34 option(bluemonkey_plugin "bluemonkey plugin" OFF)
35 option(gpsnmea_plugin "gps NMEA location plugin" OFF)
36 option(openxc_plugin "OpenXC plugin" OFF)
37 option(bluetooth_plugin "bluetooth plugin" OFF)
38 option(cansim_plugin "Can simulator plugin" OFF)
39 option(cangen_plugin "Can generator plugin" OFF)
40 option(enable_icecc "Enable icecc checking, for distributed compilation" ON)
41 option(enable_docs "enable Doxygen doc generation" OFF)
42 option(usebluez5 "use bluez 5 API" OFF)
43 option(xwalk_vehicle_extension "Crosswalk vehicle extension" OFF)
44 set(XWALK_EXTENSION_PATH "/automotive-message-broker/xwalk" CACHE PATH "directory the xwalk extension will be installed to")
47 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
48 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie -pie -std=c++11")
51 message(STATUS "OpenCV Lux plugin enabled")
53 endif(opencvlux_plugin)
55 include (CMakeForceCompiler)
58 find_program(ICECC /usr/lib/icecc/bin/g++)
60 message(STATUS "icecc will be used for distributed compiling")
61 cmake_force_cxx_compiler(${ICECC} icecc)
63 message(STATUS "Not using icecc")
67 # add a target to generate API documentation with Doxygen
69 message(STATUS "doxygen doc generation enabled")
72 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
73 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.idl.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.idl @ONLY)
74 add_custom_target(all ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs/amb COMMENT "Generating API documentation with Doxygen" VERBATIM)
75 add_custom_target(idl ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.idl WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs/dbus COMMENT "Generating DBus API documentation with Doxygen" VERBATIM)
79 find_package(Boost REQUIRED)
82 pkg_check_modules(glib REQUIRED glib-2.0 gobject-2.0)
83 pkg_check_modules(json REQUIRED json)
85 add_definitions(-DDBusServiceName="org.automotive.message.broker")
87 set(include_dirs ${libtool_INCLUDE_DIR} ${glib_INCLUDE_DIRS} ${gio_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${json_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/lib)
88 set(link_libraries -lamb ${glib_LIBRARIES} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
91 message(STATUS "using Qt mainloop")
95 message(STATUS "using Qt5")
96 set(QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS})
97 set(QT_LIBRARIES ${Qt5Core_LIBRARIES})
98 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
99 # if(CMAKE_SIZEOF_VOID_P MATCHES "8")
100 # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcmodel=large")
101 # endif(CMAKE_SIZEOF_VOID_P MATCHES "8")
102 add_definitions(${Qt5Core_DEFINITIONS})
104 message(STATUS "using Qt4")
105 find_package( Qt4 REQUIRED )
106 include(${QT_USE_FILE})
110 set(include_dirs ${include_dirs} ${QT_INCLUDE_DIRS})
111 set(link_libraries ${link_libraries} ${QT_LIBRARIES})
113 add_definitions(-DQT_NO_KEYWORDS)
114 add_definitions(-DUSE_QT_CORE)
118 add_definitions(-DUSE_BLUEZ5)
122 set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
123 add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
125 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
126 add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
129 # Common things to every type of package
130 SET(CPACK_PACKAGE_DESCRIPTION "daemon to access vehicle data")
131 SET(CPACK_PACKAGE_NAME "automotive-message-broker")
132 SET(CPACK_PACKAGE_EXECUTABLES "ambd")
133 SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
134 SET(CPACK_STRIP_FILES true)
135 SET(CPACK_PACKAGE_CONTACT "tripzero.kev@gmail.com")
136 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
139 # Always build .tar.gz and .sh files
140 SET(CPACK_GENERATOR "STGZ;TGZ")
142 SET(CPACK_GENERATOR "${CPACK_GENERATOR};DEB")
143 SET(CPACK_DEBIAN_PACKAGE_DEPENDS "gpsd (>=2.0), libopencv, libjson0, libltdl7")
144 SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
148 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/packaging.in/config.tizen.in ${CMAKE_CURRENT_BINARY_DIR}/packaging.in/config.tizen @ONLY)
150 add_subdirectory(lib)
151 add_subdirectory(ambd)
152 add_subdirectory(plugins)
153 add_subdirectory(docs)
154 add_subdirectory(tests)
155 add_subdirectory(examples)
156 add_subdirectory(xwalk)