added ambd documentation
[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 include(CMakeDependentOption)
8
9 set(PROJECT_NAME "automotive-message-broker")
10 set(PROJECT_PRETTY_NAME "Automotive Message Broker")
11 set(PROJECT_VERSION "0.13.801")
12 set(PROJECT_CODENAME "74A")
13 set(PROJECT_QUALITY "alpha")
14
15 add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
16 add_definitions(-DPROJECT_NAME="${PROJECT_NAME}")
17 add_definitions(-DPROJECT_CODENAME="${PROJECT_CODENAME}")
18 add_definitions(-DPROJECT_QUALITY="${PROJECT_QUALITY}")
19
20 set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
21 set (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_LIBRARY_ARCHITECTURE}" )
22 set (PLUGIN_INSTALL_PATH "${LIB_INSTALL_DIR}/${PROJECT_NAME}")
23 set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include")
24 set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/packages/${PROJECT_NAME}/${PROJECT_VERSION}")
25 set (PLUGIN_SEGMENT_INSTALL_PATH "/etc/ambd/plugins.d")
26
27 option(qtmainloop "Use QCoreApplication mainloop " OFF)
28 option(websocket_plugin "websocket source and sink plugins" OFF)
29 option(obd2_plugin "OBD-II plugin" OFF)
30 option(database_plugin "Database plugins" OFF)
31 option(qt_bindings "AMB Qt DBus bindings" OFF)
32 option(opencvlux_plugin "OpenCV Lux plugin" OFF)
33 option(murphy_plugin "murphy policy framework plugin" OFF)
34 option(test_plugin "Test Plugin" ON)
35 option(bluemonkey_plugin "bluemonkey plugin" OFF)
36 option(gpsnmea_plugin "gps NMEA location plugin" OFF)
37 option(openxc_plugin "OpenXC plugin" OFF)
38 option(bluetooth_plugin "bluetooth plugin" OFF)
39 option(cansim_plugin "Can simulator plugin" OFF)
40 option(cangen_plugin "Can generator plugin" OFF)
41 option(enable_icecc "Enable icecc checking, for distributed compilation" ON)
42 option(enable_docs "enable Doxygen doc generation" OFF)
43 option(usebluez5 "use bluez 5 API" OFF)
44 option(xwalk_vehicle_extension "Crosswalk vehicle extension" OFF)
45 set(XWALK_EXTENSION_PATH "/automotive-message-broker/xwalk" CACHE PATH "directory the xwalk extension will be installed to")
46
47 #turn on -fpic/-fpie:
48 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
49 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie -pie -std=c++1y")
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 find_package(Boost REQUIRED)
64
65
66 pkg_check_modules(glib REQUIRED glib-2.0 gobject-2.0)
67 pkg_check_modules(json REQUIRED json)
68
69 add_definitions(-DDBusServiceName="org.automotive.message.broker")
70
71 set(include_dirs ${libtool_INCLUDE_DIR} ${glib_INCLUDE_DIRS} ${gio_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${json_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/lib)
72 set(link_libraries -lamb ${glib_LIBRARIES} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
73
74 if(usebluez5)
75         add_definitions(-DUSE_BLUEZ5)
76
77 endif(usebluez5)
78
79 set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
80 add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
81
82 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
83 add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
84
85 # packaging stuff:
86 # Common things to every type of package
87 SET(CPACK_PACKAGE_DESCRIPTION "daemon that provides access vehicle data")
88 SET(CPACK_PACKAGE_NAME "automotive-message-broker")
89 SET(CPACK_PACKAGE_EXECUTABLES "ambd")
90 SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
91 SET(CPACK_STRIP_FILES true)
92 SET(CPACK_PACKAGE_CONTACT "tripzero.kev@gmail.com")
93 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
94
95 # Always build .tar.gz and .sh files
96 SET(CPACK_GENERATOR "STGZ;TGZ;TBZ2")
97
98 add_subdirectory(lib)
99 add_subdirectory(plugins)
100 add_subdirectory(ambd)
101 add_subdirectory(docs)
102 add_subdirectory(tests)
103 add_subdirectory(tools)
104 add_subdirectory(examples)
105 add_subdirectory(xwalk)
106 add_subdirectory(packaging.in)