disable websockets by default
[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.8.9")
10
11 add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
12 add_definitions(-DPROJECT_NAME="${PROJECT_NAME}")
13
14 set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
15 set (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE STRING "Directory where lib will install")
16 set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The directory the headers are installed in")
17 set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}" CACHE PATH "The directory the docs will be installed to")
18
19 option(use_qtcore "Use QCoreApplication mainloop " OFF)
20 option(websocket_plugin "websocket source and sink plugins" OFF)
21 option(tpms_plugin "TPMS plugin " OFF)
22 option(obd2_plugin "OBD-II plugin" OFF)
23 option(database_plugin "Database plugins" OFF)
24 option(qt_bindings "AMB Qt DBus bindings" OFF)
25 option(opencvlux_plugin "OpenCV Lux plugin" OFF)
26 option(gpsd_plugin "gpsd location plugin" OFF)
27 option(murphy_plugin "murphy policy framework plugin" OFF)
28
29 if(opencvlux_plugin)
30    message(STATUS "OpenCV Lux plugin enabled")
31
32 endif(opencvlux_plugin)
33
34 include (CMakeForceCompiler)
35 option(ENABLE_ICECC "Enable icecc checking, for distributed compilation" ON)
36
37 if (ENABLE_ICECC)
38    find_program(ICECC /usr/lib/icecc/bin/c++)
39     if (ICECC)
40         message(STATUS "icecc will be used for distributed compiling")
41         cmake_force_cxx_compiler(${ICECC} icecc)
42     else(ICECC)
43         message(STATUS "Not using icecc")
44     endif(ICECC)
45 endif(ENABLE_ICECC)
46
47 find_library(libtool_LIBRARY ltdl DOC "Libtool libraries")
48 find_path(libtool_INCLUDE_DIR ltdl.h DOC "Libtool headers")
49
50 if(libtool_LIBRARY)
51      message(STATUS "libtool found")
52 else(libtool_LIBRARY)
53      message(FATAL_ERROR "libtool missing.  please install libtool")
54 endif(libtool_LIBRARY)
55
56 find_package(Boost REQUIRED)
57
58
59 pkg_check_modules(glib REQUIRED glib-2.0 gobject-2.0)
60 pkg_check_modules(json REQUIRED json)
61
62
63 add_definitions(-std=c++0x)
64 add_definitions(-DDBusServiceName="org.automotive.message.broker")
65
66 set(include_dirs ${libtool_INCLUDE_DIR} ${glib_INCLUDE_DIRS} ${gio_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${json_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/lib)
67 set(link_libraries -lamb ${libtool_LIBRARY} ${glib_LIBRARIES} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
68
69 if(use_qtcore)
70         message(STATUS "using Qt mainloop")
71
72         find_package( Qt4 REQUIRED )
73
74         include(${QT_USE_FILE})
75         set(include_dirs ${include_dirs} ${QT_INCLUDE_DIRS})
76         set(link_libraries ${link_libraries} ${QT_LIBRARIES})
77
78         add_definitions(-DUSE_QT_CORE)
79         add_definitions(-DQT_NO_KEYWORDS)
80
81 endif(use_qtcore)
82
83 set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
84 add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
85
86 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
87 add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
88
89 # packaging stuff:
90 # Common things to every type of package
91 SET(CPACK_PACKAGE_DESCRIPTION "daemon to access vehicle data")
92 SET(CPACK_PACKAGE_NAME "automotive-message-broker")
93 SET(CPACK_PACKAGE_EXECUTABLES "ambd")
94 SET(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
95 SET(CPACK_STRIP_FILES true)
96 SET(CPACK_PACKAGE_CONTACT "tripzero.kev@gmail.com")
97 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
98
99
100 # Always build .tar.gz and .sh files
101 SET(CPACK_GENERATOR "STGZ;TGZ")
102
103 SET(CPACK_GENERATOR "${CPACK_GENERATOR};DEB")
104 SET(CPACK_DEBIAN_PACKAGE_DEPENDS "gpsd (>=2.0), libopencv, libjson0, libltdl7")
105 SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
106
107 INCLUDE(CPack)
108
109 add_subdirectory(lib)
110 add_subdirectory(ambd)
111 add_subdirectory(plugins)
112 add_subdirectory(docs)
113 add_subdirectory(tests)