From 02044fc86a8c192dc37cb6c2b41f8573c3e982b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Or=C5=A1uli=C4=87?= Date: Thu, 9 Feb 2017 15:58:35 +0100 Subject: [PATCH] Enable adding as a CMake subproject (#262) Add support for building libcartographer in the same project Support adding as a CMake subproject by using the PROJECT_*_DIR variables instead of the absolute CMAKE_*_DIR variables. Resolve a signed-unsigned comparison compiler warning Fix comment typo --- cartographer_ros/CMakeLists.txt | 6 +++--- cartographer_ros/cartographer_ros/assets_writer.cc | 2 +- cartographer_ros/cartographer_ros/assets_writer_main.cc | 2 +- cartographer_rviz/CMakeLists.txt | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cartographer_ros/CMakeLists.txt b/cartographer_ros/CMakeLists.txt index 890837a..9daab4a 100644 --- a/cartographer_ros/CMakeLists.txt +++ b/cartographer_ros/CMakeLists.txt @@ -122,8 +122,8 @@ add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS}) # Add the binary directory first, so that port.h is included after it has # been generated. target_include_directories(${PROJECT_NAME} PUBLIC - $ - $ + $ + $ $ ) @@ -174,7 +174,7 @@ install(TARGETS ${PROJECT_NAME} # Install source headers. file(GLOB_RECURSE HDRS "*.h") foreach(HDR ${HDRS}) - file(RELATIVE_PATH REL_FIL ${CMAKE_SOURCE_DIR} ${HDR}) + file(RELATIVE_PATH REL_FIL ${PROJECT_SOURCE_DIR} ${HDR}) get_filename_component(INSTALL_DIR ${REL_FIL} DIRECTORY) install( FILES diff --git a/cartographer_ros/cartographer_ros/assets_writer.cc b/cartographer_ros/cartographer_ros/assets_writer.cc index 66d26d9..500cd9f 100644 --- a/cartographer_ros/cartographer_ros/assets_writer.cc +++ b/cartographer_ros/cartographer_ros/assets_writer.cc @@ -34,7 +34,7 @@ namespace { namespace carto = ::cartographer; -// Writes an occupany grid. +// Writes an occupancy grid. void Write2DAssets(const std::vector<::cartographer::mapping::TrajectoryNode>& trajectory_nodes, const NodeOptions& options, const std::string& stem) { diff --git a/cartographer_ros/cartographer_ros/assets_writer_main.cc b/cartographer_ros/cartographer_ros/assets_writer_main.cc index dcd8fff..0788dab 100644 --- a/cartographer_ros/cartographer_ros/assets_writer_main.cc +++ b/cartographer_ros/cartographer_ros/assets_writer_main.cc @@ -117,7 +117,7 @@ void HandleMessage( ToPointCloudWithIntensities(message); CHECK(point_cloud.intensities.size() == point_cloud.points.size()); - for (int i = 0; i < point_cloud.points.size(); ++i) { + for (size_t i = 0; i < point_cloud.points.size(); ++i) { batch->points.push_back(sensor_to_map * point_cloud.points[i]); batch->intensities.push_back(point_cloud.intensities[i]); } diff --git a/cartographer_rviz/CMakeLists.txt b/cartographer_rviz/CMakeLists.txt index fea27eb..da1c14d 100644 --- a/cartographer_rviz/CMakeLists.txt +++ b/cartographer_rviz/CMakeLists.txt @@ -63,8 +63,8 @@ add_definitions(-DQT_NO_KEYWORDS) # Add the binary directory first, so that port.h is included after it has # been generated. target_include_directories(${PROJECT_NAME} PUBLIC - $ - $ + $ + $ $ )