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