~thomas-voss/location-service/fix-service-path

1 by Thomas Voß
Initial push.
1
cmake_minimum_required(VERSION 2.8)
2
3
project(ubuntu-location-service)
4
216.2.6 by Thomas Voß
Remove obsolete install files.
5
# We haven't received version information via the packaging setup.
6
# For that, we try to determine sensible values on our own, ensuring
7
# plain old invocations to cmake still work as expected.
8
if (NOT DEFINED UBUNTU_LOCATION_SERVICE_VERSION_MAJOR)
9
  find_program(LSB_RELEASE lsb_release)
10
  execute_process(
11
    COMMAND ${LSB_RELEASE} -c -s
12
    OUTPUT_VARIABLE DISTRO_CODENAME
13
    OUTPUT_STRIP_TRAILING_WHITESPACE)
14
15
  # We explicitly ignore errors and only check if we are building for vivid.
16
  # For all other cases:
17
  #   - releases other than vivid
18
  #   - other distros
19
  #   - errors
20
  # we define the version to be 2.0.0
21
  if (${DISTRO_CODENAME} STREQUAL "vivid")
22
    set(UBUNTU_LOCATION_SERVICE_VERSION_MAJOR 2)
23
    set(UBUNTU_LOCATION_SERVICE_VERSION_MINOR 0)
24
    set(UBUNTU_LOCATION_SERVICE_VERSION_PATCH 0)
25
  else ()
26
    set(UBUNTU_LOCATION_SERVICE_VERSION_MAJOR 3)
27
    set(UBUNTU_LOCATION_SERVICE_VERSION_MINOR 0)
28
    set(UBUNTU_LOCATION_SERVICE_VERSION_PATCH 0)
29
  endif()
30
endif()
31
32
message(STATUS "${CMAKE_PROJECT_NAME} ${UBUNTU_LOCATION_SERVICE_VERSION_MAJOR}.${UBUNTU_LOCATION_SERVICE_VERSION_MINOR}.${UBUNTU_LOCATION_SERVICE_VERSION_PATCH}")
1 by Thomas Voß
Initial push.
33
73.4.1 by thomas-voss
Switch to a trust-store-based implementation for the permission manager.
34
set(UBUNTU_LOCATION_SERVICE_TRUST_STORE_SERVICE_NAME "UbuntuLocationService")
35
50.2.53 by thomas-voss
Remove primary scrambling code from UMTS details.
36
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wextra -fPIC")
37
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fno-strict-aliasing -pedantic -Wextra -fPIC")
1 by Thomas Voß
Initial push.
38
39
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
40
41
include(cmake/EnableCoverageReport.cmake)
42
include(cmake/FindGFlags.cmake)
43
include(cmake/FindGLog.cmake)
44
include(cmake/PrePush.cmake)
45
include(CTest)
46
9.1.2 by Łukasz 'sil2100' Zemczak
Enable multiarch, fix libexec directories
47
include(GNUInstallDirs)
48
1 by Thomas Voß
Initial push.
49
find_package(PkgConfig)
73.1.1 by thomas-voss
Add comment in the code pointing to boost documentation for error reporting details.
50
find_package(Boost COMPONENTS filesystem system program_options)
1 by Thomas Voß
Initial push.
51
find_package(GLog)
37.1.1 by thomas-voss
Correctly link against gflags.
52
find_package(GFlags)
50.2.53 by thomas-voss
Remove primary scrambling code from UMTS details.
53
find_package(Threads)
21.1.1 by Thomas Voß
Adjust build and runtime dependency to use the hardware bits of the platform API.
54
pkg_check_modules(DBUS dbus-1 REQUIRED)
55
pkg_check_modules(DBUS_CPP dbus-cpp REQUIRED)
67.2.1 by thomas-voss
Switch to json-c for json parsing/generation purposes.
56
pkg_check_modules(JSON_C json-c REQUIRED)
73.4.1 by thomas-voss
Switch to a trust-store-based implementation for the permission manager.
57
pkg_check_modules(LIBAPPARMOR libapparmor REQUIRED)
67.2.2 by thomas-voss
Re-enable net-cpp based implementations with net-cpp being in main now.
58
pkg_check_modules(NET_CPP net-cpp REQUIRED)
50.2.16 by thomas-voss
Switch to process-cpp for cross-process testing facilities.
59
pkg_check_modules(PROCESS_CPP process-cpp REQUIRED)
50.2.1 by thomas-voss
Add engine configuration.
60
pkg_check_modules(PROPERTIES_CPP properties-cpp REQUIRED)
73.4.1 by thomas-voss
Switch to a trust-store-based implementation for the permission manager.
61
pkg_check_modules(TRUST_STORE trust-store REQUIRED)
195.15.3 by Thomas Voß
Factor out query of time since boot.
62
pkg_check_modules(UBUNTU_PLATFORM_HARDWARE_API ubuntu-platform-hardware-api)
3 by Thomas Voß
* Refactored the default configuration object.
63
#####################################################################
64
# Enable code coverage calculation with gcov/gcovr/lcov
65
# Usage:
66
#  * Switch build type to coverage (use ccmake or cmake-gui)
67
#  * Invoke make, make test, make coverage
68
#  * Find html report in subdir coveragereport
69
#  * Find xml report feasible for jenkins in coverage.xml
70
#####################################################################
71
IF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
72
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs" )
73
  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs" )
74
  SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
75
  SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
76
ENDIF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
77
9.1.1 by Łukasz 'sil2100' Zemczak
Fix the FTBFS
78
option (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS "Disable errors when local typedefs are unused" ON)
79
if (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS)
50.2.16 by thomas-voss
Switch to process-cpp for cross-process testing facilities.
80
    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-local-typedefs")
9.1.1 by Łukasz 'sil2100' Zemczak
Fix the FTBFS
81
endif (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS)
82
168.3.1 by thomas-voss
Add documentation for debugging, hacking and debugging the location service.
83
#
168.3.2 by thomas-voss
Slightly different coding convention, relying exclusively on clang-format.
84
# Code style fixer. We rely on clang-format to adjust the formatting of source code.
168.3.1 by thomas-voss
Add documentation for debugging, hacking and debugging the location service.
85
#
168.3.2 by thomas-voss
Slightly different coding convention, relying exclusively on clang-format.
86
find_program(CLANG_FORMAT_COMMAND NAMES clang-format-3.6 clang-format-3.5)
87
if (NOT CLANG_FORMAT_COMMAND)
88
  message(WARNING "Cannot find clang-format >= clang-format-3.5: formatcode target will not be available")
168.3.1 by thomas-voss
Add documentation for debugging, hacking and debugging the location service.
89
endif()
90
168.3.2 by thomas-voss
Slightly different coding convention, relying exclusively on clang-format.
91
if (CLANG_FORMAT_COMMAND)
92
  file(GLOB_RECURSE UBUNTU_LOCATION_SERVICE_INTERFACE_HEADER_FILES ${CMAKE_SOURCE_DIR}/include/*.h)
93
  file(GLOB_RECURSE UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_FILES ${CMAKE_SOURCE_DIR}/src/*.h ${CMAKE_SOURCE_DIR}/src/*.cpp)
94
  add_custom_target(formatcode ${CLANG_FORMAT_COMMAND} -i ${UBUNTU_LOCATION_SERVICE_INTERFACE_HEADER_FILES} ${UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_FILES} SOURCES _clang-format)
168.3.1 by thomas-voss
Add documentation for debugging, hacking and debugging the location service.
95
endif()
96
1 by Thomas Voß
Initial push.
97
include_directories(
195.15.4 by Thomas Voß
Add local copy of boost::endian as vivid+o only has boost 1.55.
98
  3rd-party/
99
1 by Thomas Voß
Initial push.
100
  ${Boost_INCLUDE_DIRS}
101
  ${DBUS_INCLUDE_DIRS}
50.2.16 by thomas-voss
Switch to process-cpp for cross-process testing facilities.
102
  ${DBUS_CPP_INCLUDE_DIRS}
67.2.1 by thomas-voss
Switch to json-c for json parsing/generation purposes.
103
  ${JSON_C_INCLUDE_DIRS}
73.4.1 by thomas-voss
Switch to a trust-store-based implementation for the permission manager.
104
  ${LIBAPPARMOR_INCLUDE_DIRS}
50.2.55 by thomas-voss
Add a reporter sending off harvested location data to the mozilla location service.
105
  ${NET_CPP_INCLUDE_DIRS}
50.2.1 by thomas-voss
Add engine configuration.
106
  ${PROPERTIES_CPP_INCLUDE_DIRS}
50.2.16 by thomas-voss
Switch to process-cpp for cross-process testing facilities.
107
  ${PROCESS_CPP_INCLUDE_DIRS}
73.4.1 by thomas-voss
Switch to a trust-store-based implementation for the permission manager.
108
  ${TRUST_STORE_INCLUDE_DIRS}
1 by Thomas Voß
Initial push.
109
  ${GLog_INCLUDE_DIR}
37.1.1 by thomas-voss
Correctly link against gflags.
110
  ${GFlags_INCLUDE_DIR}
50.2.41 by thomas-voss
[ Thomas Voß ]
111
112
  ${CMAKE_SOURCE_DIR}/include/location_service
113
  ${CMAKE_SOURCE_DIR}/src/location_service
73.4.1 by thomas-voss
Switch to a trust-store-based implementation for the permission manager.
114
  ${CMAKE_BINARY_DIR}/src/location_service
1 by Thomas Voß
Initial push.
115
)
116
50.2.40 by thomas-voss
Split out connectivity API for provider-integration purposes.
117
file(GLOB_RECURSE UBUNTU_LOCATION_SERVICE_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR} *.h)
118
1 by Thomas Voß
Initial push.
119
add_subdirectory(data)
120
add_subdirectory(doc)
121
add_subdirectory(examples)
122
add_subdirectory(include)
105.1.1 by thomas-voss
Make the service translateable.
123
add_subdirectory(po)
1 by Thomas Voß
Initial push.
124
add_subdirectory(src)
21.1.2 by Thomas Voß
Reenable tests again.
125
add_subdirectory(tests)
1 by Thomas Voß
Initial push.
126
3 by Thomas Voß
* Refactored the default configuration object.
127
# There's no nice way to format this. Thanks CMake.
128
add_test(LGPL-required
129
  /bin/sh -c "! grep -rl 'GNU General' ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/include"
130
)
131
4.1.3 by Thomas Voß
Minor patch.
132
enable_coverage_report(service)