gaschler 2018-02-19 15:54:10 +01:00 committed by GitHub
parent 64bc194609
commit 3211e75957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 1 deletions

View File

@ -22,6 +22,7 @@ set(CARTOGRAPHER_PATCH_VERSION 0)
set(CARTOGRAPHER_VERSION ${CARTOGRAPHER_MAJOR_VERSION}.${CARTOGRAPHER_MINOR_VERSION}.${CARTOGRAPHER_PATCH_VERSION})
set(CARTOGRAPHER_SOVERSION ${CARTOGRAPHER_MAJOR_VERSION}.${CARTOGRAPHER_MINOR_VERSION})
option(BUILD_GRPC "build Cartographer gRPC support" false)
option(BUILD_PROMETHEUS "build Prometheus monitoring support" false)
include("${PROJECT_SOURCE_DIR}/cmake/functions.cmake")
google_initialize_cartographer_project()
@ -153,6 +154,10 @@ if(${BUILD_GRPC})
SRCS
cartographer_grpc/map_builder_server_main.cc
)
target_link_libraries(cartographer_grpc_server PUBLIC grpc++)
if(${BUILD_PROMETHEUS})
target_link_libraries(cartographer_grpc_server PUBLIC prometheus-cpp)
endif()
endif()
foreach(ABS_FIL ${ALL_TESTS})
@ -165,6 +170,9 @@ foreach(ABS_FIL ${ALL_TESTS})
if(${BUILD_GRPC})
target_link_libraries("${TEST_TARGET_NAME}" PUBLIC grpc++)
endif()
if(${BUILD_PROMETHEUS})
target_link_libraries(${PROJECT_NAME} PUBLIC prometheus-cpp)
endif()
endforeach()
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
@ -199,6 +207,10 @@ target_link_libraries(${PROJECT_NAME} PUBLIC ${PROTOBUF_LIBRARY} pthread)
if(${BUILD_GRPC})
target_link_libraries(${PROJECT_NAME} PUBLIC grpc++)
endif()
if(${BUILD_PROMETHEUS})
target_link_libraries(${PROJECT_NAME} PUBLIC prometheus-cpp)
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_PROMETHEUS=1)
endif()
# Add the binary directory first, so that port.h is included after it has
# been generated.

View File

@ -21,5 +21,7 @@ COPY scripts/install_proto3.sh cartographer/scripts/
RUN cartographer/scripts/install_proto3.sh && rm -rf protobuf
COPY scripts/install_grpc.sh cartographer/scripts/
RUN cartographer/scripts/install_grpc.sh && rm -rf grpc
COPY scripts/install_prometheus_cpp.sh cartographer/scripts/
RUN cartographer/scripts/install_prometheus_cpp.sh && rm -rf prometheus-cpp
COPY . cartographer
RUN cartographer/scripts/install_cartographer_cmake_with_grpc.sh && rm -rf cartographer

View File

@ -21,7 +21,7 @@ set -o verbose
cd cartographer
mkdir build
cd build
cmake .. -DBUILD_GRPC=ON -G Ninja
cmake .. -DBUILD_GRPC=ON -DBUILD_PROMETHEUS=ON -G Ninja
ninja
CTEST_OUTPUT_ON_FAILURE=1 ninja test
sudo ninja install

View File

@ -0,0 +1,30 @@
#!/bin/sh
# Copyright 2018 The Cartographer Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o verbose
VERSION="v0.2"
# Digest: a5d981dab82ad6b90f78141eb189694d69c3fe0f
git clone --branch ${VERSION} --depth 1 https://github.com/jupp0r/prometheus-cpp.git
cd prometheus-cpp
git submodule update --init
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
sudo make install