[websocket] fixed getRanged requests
[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.800")
12 set(PROJECT_CODENAME "")
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}")
25
26 option(qtmainloop "Use QCoreApplication mainloop " OFF)
27 option(websocket_plugin "websocket source and sink plugins" 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")
45
46 #turn on -fpic/-fpie:
47 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
48 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie -pie -std=c++1y")
49
50 include (CMakeForceCompiler)
51
52 if (enable_icecc)
53          find_program(ICECC /usr/lib/icecc/bin/g++)
54                 if (ICECC)
55                                 message(STATUS "icecc will be used for distributed compiling")
56                                 cmake_force_cxx_compiler(${ICECC} icecc)
57                 else(ICECC)
58                                 message(STATUS "Not using icecc")
59                 endif(ICECC)
60 endif(enable_icecc)
61
62 find_package(Boost REQUIRED)
63
64
65 pkg_check_modules(glib REQUIRED glib-2.0 gobject-2.0)
66 pkg_check_modules(json REQUIRED json)
67
68 add_definitions(-DDBusServiceName="org.automotive.message.broker")
69
70 set(include_dirs ${libtool_INCLUDE_DIR} ${glib_INCLUDE_DIRS} ${gio_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${json_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/lib)
71 set(link_libraries -lamb ${glib_LIBRARIES} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
72
73 if(usebluez5)
74         add_definitions(-DUSE_BLUEZ5)
75
76 endif(usebluez5)
77
78 set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
79 add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
80
81 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
82 add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
83
84 # packaging stuff:
85 # Common things to every type of package
86 SET(CPACK_PACKAGE_DESCRIPTION "daemon that provides access vehicle data")
87 SET(CPACK_PACKAGE_NAME "automotive-message-broker")
88 SET(CPACK_PACKAGE_EXECUTABLES "ambd")
89 SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
90 SET(CPACK_STRIP_FILES true)
91 SET(CPACK_PACKAGE_CONTACT "tripzero.kev@gmail.com")
92 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
93
94 # Always build .tar.gz and .sh files
95 SET(CPACK_GENERATOR "STGZ;TGZ;TBZ2")
96
97 add_subdirectory(lib)
98 add_subdirectory(plugins)
99 add_subdirectory(ambd)
100 add_subdirectory(docs)
101 add_subdirectory(tests)
102 add_subdirectory(tools)
103 add_subdirectory(examples)
104 add_subdirectory(xwalk)
105 add_subdirectory(packaging.in)