d8cfb88906884884b4c9a253067a2bdc2ed70c1e
[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(tpms_plugin "TPMS plugin " OFF)
21 option(obd2_plugin "OBD-II plugin" ON)
22 option(database_plugin "Database plugins" OFF)
23 option(qt_bindings "AMB Qt DBus bindings" OFF)
24 option(opencvlux_plugin "OpenCV Lux plugin" OFF)
25 option(gpsd_plugin "gpsd location plugin" OFF)
26 option(murphy_plugin "murphy policy framework plugin" OFF)
27
28 if(opencvlux_plugin)
29    message(STATUS "OpenCV Lux plugin enabled")
30
31 endif(opencvlux_plugin)
32
33 include (CMakeForceCompiler)
34 option(ENABLE_ICECC "Enable icecc checking, for distributed compilation" ON)
35
36 if (ENABLE_ICECC)
37    find_program(ICECC /usr/lib/icecc/bin/c++)
38     if (ICECC)
39         message(STATUS "icecc will be used for distributed compiling")
40         cmake_force_cxx_compiler(${ICECC} icecc)
41     else(ICECC)
42         message(STATUS "Not using icecc")
43     endif(ICECC)
44 endif(ENABLE_ICECC)
45
46 find_library(libtool_LIBRARY ltdl DOC "Libtool libraries")
47 find_path(libtool_INCLUDE_DIR ltdl.h DOC "Libtool headers")
48
49 if(libtool_LIBRARY)
50      message(STATUS "libtool found")
51 else(libtool_LIBRARY)
52      message(FATAL_ERROR "libtool missing.  please install libtool")
53 endif(libtool_LIBRARY)
54
55 find_package(Boost REQUIRED)
56
57
58 pkg_check_modules(glib REQUIRED glib-2.0 gobject-2.0)
59 pkg_check_modules(json REQUIRED json)
60
61
62 add_definitions(-std=c++0x)
63 add_definitions(-DDBusServiceName="org.automotive.message.broker")
64
65 set(include_dirs ${libtool_INCLUDE_DIR} ${glib_INCLUDE_DIRS} ${gio_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${json_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/lib)
66 set(link_libraries -lamb ${libtool_LIBRARY} ${glib_LIBRARIES} ${json_LIBRARIES} -L${CMAKE_CURRENT_BINARY_DIR}/lib)
67
68 if(use_qtcore)
69         message(STATUS "using Qt mainloop")
70
71         find_package( Qt4 REQUIRED )
72
73         include(${QT_USE_FILE})
74         set(include_dirs ${include_dirs} ${QT_INCLUDE_DIRS})
75         set(link_libraries ${link_libraries} ${QT_LIBRARIES})
76
77         add_definitions(-DUSE_QT_CORE)
78         add_definitions(-DQT_NO_KEYWORDS)
79
80 endif(use_qtcore)
81
82 set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION})
83 add_custom_target(dist COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
84
85 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
86 add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
87
88 add_subdirectory(lib)
89 add_subdirectory(ambd)
90 add_subdirectory(plugins)
91 add_subdirectory(docs)
92 add_subdirectory(tests)