Skip to content

Commit

Permalink
Remove use of google_library and google_test. (cartographer-project#234)
Browse files Browse the repository at this point in the history
* Fixes Dockerfile.indigo copying.
  • Loading branch information
damonkohler authored Dec 20, 2016
1 parent 0b4fa3d commit 58069b0
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 229 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ cache:
- /home/travis/docker/

env:
matrix:
- ROS_RELEASE=indigo DOCKER_CACHE_FILE=/home/travis/docker/indigo-cache.tar.gz
- ROS_RELEASE=kinetic DOCKER_CACHE_FILE=/home/travis/docker/kinetic-cache.tar.gz
- ROS_RELEASE=indigo DOCKER_CACHE_FILE=/home/travis/docker/indigo-cache.tar.gz
- ROS_RELEASE=kinetic DOCKER_CACHE_FILE=/home/travis/docker/kinetic-cache.tar.gz

before_install: scripts/load_docker_cache.sh

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.indigo
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ RUN cartographer_ros/scripts/install.sh --pkg ceres-solver
RUN cartographer_ros/scripts/install.sh --pkg cartographer && \
cartographer_ros/scripts/install.sh --pkg cartographer --make-args test

COPY cartographer_ros_msgs catkin_ws/src/cartographer_ros/
COPY cartographer_ros_msgs catkin_ws/src/cartographer_ros/cartographer_ros_msgs/
RUN cartographer_ros/scripts/install.sh --pkg cartographer_ros_msgs && \
cartographer_ros/scripts/install.sh --pkg cartographer_ros_msgs \
--catkin-make-args run_tests && \
cartographer_ros/scripts/catkin_test_results.sh build_isolated/cartographer_ros_msgs

COPY cartographer_ros catkin_ws/src/cartographer_ros/
COPY cartographer_ros catkin_ws/src/cartographer_ros/cartographer_ros/
RUN cartographer_ros/scripts/install.sh --pkg cartographer_ros && \
cartographer_ros/scripts/install.sh --pkg cartographer_ros \
--catkin-make-args run_tests && \
cartographer_ros/scripts/catkin_test_results.sh build_isolated/cartographer_ros

COPY cartographer_rviz catkin_ws/src/cartographer_ros/
COPY cartographer_rviz catkin_ws/src/cartographer_ros/cartographer_rviz/
RUN cartographer_ros/scripts/install.sh --pkg cartographer_rviz && \
cartographer_ros/scripts/install.sh --pkg cartographer_rviz \
--catkin-make-args run_tests && \
Expand Down
104 changes: 99 additions & 5 deletions cartographer_ros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 2.8.12) # Ships with Ubuntu 14.04 (Trusty)

project(cartographer_ros)

Expand Down Expand Up @@ -44,6 +44,7 @@ find_package(catkin REQUIRED COMPONENTS ${PACKAGE_DEPENDENCIES})
include(FindPkgConfig)
pkg_search_module(YAMLCPP REQUIRED yaml-cpp>=0.5.1)

find_package(LuaGoogle REQUIRED)
find_package(PCL REQUIRED COMPONENTS common io)
find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED COMPONENTS system iostreams)
Expand All @@ -59,10 +60,18 @@ include_directories(
${urdfdom_headers_INCLUDE_DIRS}
)

# Override Catkin's GTest configuration to use GMock.
set(GTEST_FOUND TRUE)
set(GTEST_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS})
set(GTEST_LIBRARIES ${GMOCK_LIBRARIES})

catkin_package(
CATKIN_DEPENDS
${PACKAGE_DEPENDENCIES}
DEPENDS
# TODO(damonkohler): This should be here but causes Catkin to abort because
# protobuf specifies a library '-lpthread' instead of just 'pthread'.
# CARTOGRAPHER
YAMLCPP
PCL
EIGEN3
Expand All @@ -72,14 +81,86 @@ catkin_package(
LIBRARIES ${PROJECT_NAME}
)

SET(ALL_LIBRARIES "" CACHE INTERNAL "ALL_LIBRARIES")

file(GLOB_RECURSE ALL_SRCS "*.cc" "*.h")
file(GLOB_RECURSE ALL_TESTS "*_test.cc")
file(GLOB_RECURSE ALL_EXECUTABLES "*_main.cc")
list(REMOVE_ITEM ALL_SRCS ${ALL_TESTS})
list(REMOVE_ITEM ALL_SRCS ${ALL_EXECUTABLES})
add_library(${PROJECT_NAME} ${ALL_SRCS})
add_subdirectory("cartographer_ros")

google_combined_library(${PROJECT_NAME}
SRCS "${ALL_LIBRARIES}"
target_include_directories(${PROJECT_NAME} PUBLIC ${CARTOGRAPHER_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${CARTOGRAPHER_LIBRARIES})

# YAML
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC "${YAMLCPP_INCLUDE_DIRS}")
target_link_libraries(${PROJECT_NAME} PUBLIC ${YAMLCPP_LIBRARIES})

# Lua
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${LUA_INCLUDE_DIR})

# PCL
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
"${PCL_INCLUDE_DIRS}")
target_link_libraries(${PROJECT_NAME} PUBLIC ${PCL_LIBRARIES})
foreach(DEFINITION ${PCL_DEFINITIONS})
set(TARGET_COMPILE_FLAGS "${TARGET_COMPILE_FLAGS} ${DEFINITION}")
endforeach()

# Eigen
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
"${EIGEN3_INCLUDE_DIR}")

# Boost
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
"${Boost_INCLUDE_DIRS}")
target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES})

# Catkin
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${catkin_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${catkin_LIBRARIES})
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
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)

set(TARGET_COMPILE_FLAGS "${TARGET_COMPILE_FLAGS} ${GOOG_CXX_FLAGS}")
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_FLAGS ${TARGET_COMPILE_FLAGS})

if (CATKIN_ENABLE_TESTING)
catkin_add_gtest(configuration_files_test "cartographer_ros/configuration_files_test.cc")
# catkin_add_gtest uses a plain (i.e. no PUBLIC/PRIVATE/INTERFACE) call to
# target_link_libraries. That forces us to do the same.
target_include_directories(configuration_files_test SYSTEM PUBLIC ${LUA_INCLUDE_DIR})
target_link_libraries(configuration_files_test ${LUA_LIBRARIES})
target_include_directories(configuration_files_test SYSTEM PUBLIC ${catkin_INCLUDE_DIRS})
target_link_libraries(configuration_files_test ${catkin_LIBRARIES})
add_dependencies(configuration_files_test ${catkin_EXPORTED_TARGETS})
target_include_directories(configuration_files_test SYSTEM PUBLIC ${CARTOGRAPHER_INCLUDE_DIRS})
target_link_libraries(configuration_files_test ${CARTOGRAPHER_LIBRARIES})
target_link_libraries(configuration_files_test ${PROJECT_NAME})
set_target_properties(configuration_files_test PROPERTIES COMPILE_FLAGS ${TARGET_COMPILE_FLAGS})

catkin_add_gtest(time_conversion_test "cartographer_ros/time_conversion_test.cc")
# catkin_add_gtest uses a plain (i.e. no PUBLIC/PRIVATE/INTERFACE) call to
# target_link_libraries. That forces us to do the same.
target_include_directories(time_conversion_test SYSTEM PUBLIC ${LUA_INCLUDE_DIR})
target_link_libraries(time_conversion_test ${LUA_LIBRARIES})
target_include_directories(time_conversion_test SYSTEM PUBLIC ${catkin_INCLUDE_DIRS})
target_link_libraries(time_conversion_test ${catkin_LIBRARIES})
add_dependencies(time_conversion_test ${catkin_EXPORTED_TARGETS})
target_include_directories(time_conversion_test SYSTEM PUBLIC ${CARTOGRAPHER_INCLUDE_DIRS})
target_link_libraries(time_conversion_test ${CARTOGRAPHER_LIBRARIES})
target_link_libraries(time_conversion_test ${PROJECT_NAME})
set_target_properties(time_conversion_test PROPERTIES COMPILE_FLAGS ${TARGET_COMPILE_FLAGS})
endif()

install(DIRECTORY launch urdf configuration_files
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
Expand All @@ -93,3 +174,16 @@ install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
)

# Install source headers.
file(GLOB_RECURSE hdrs "*.h")
foreach(HDR ${hdrs})
file(RELATIVE_PATH REL_FIL ${CMAKE_SOURCE_DIR} ${HDR})
get_filename_component(INSTALL_DIR ${REL_FIL} DIRECTORY)
install(
FILES
${HDR}
DESTINATION
include/${INSTALL_DIR}
)
endforeach()
194 changes: 13 additions & 181 deletions cartographer_ros/cartographer_ros/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,186 +1,25 @@
google_library(assets_writer
USES_CARTOGRAPHER
SRCS
assets_writer.cc
HDRS
assets_writer.h
DEPENDS
map_writer
node_options
occupancy_grid
)

google_library(bag_reader
USES_CARTOGRAPHER
USES_GLOG
SRCS
bag_reader.cc
HDRS
bag_reader.h
)

google_library(map_builder_bridge
USES_CARTOGRAPHER
SRCS
map_builder_bridge.cc
HDRS
map_builder_bridge.h
DEPENDS
assets_writer
msg_conversion
node_options
occupancy_grid
sensor_bridge
tf_bridge
)

google_library(map_writer
USES_GLOG
USES_YAMLCPP
SRCS
map_writer.cc
HDRS
map_writer.h
)

google_library(msg_conversion
USES_CARTOGRAPHER
USES_GLOG
USES_PCL
SRCS
msg_conversion.cc
HDRS
msg_conversion.h
DEPENDS
time_conversion
)

google_library(node
USES_CARTOGRAPHER
USES_EIGEN
USES_GLOG
SRCS
node.cc
HDRS
node.h
DEPENDS
map_builder_bridge
msg_conversion
node_options
sensor_bridge
tf_bridge
time_conversion
)

google_library(node_options
USES_CARTOGRAPHER
USES_GLOG
SRCS
node_options.cc
HDRS
node_options.h
DEPENDS
sensor_bridge
)

google_library(occupancy_grid
USES_CARTOGRAPHER
USES_GLOG
SRCS
occupancy_grid.cc
HDRS
occupancy_grid.h
DEPENDS
node_options
time_conversion
)

google_library(ros_log_sink
USES_GLOG
SRCS
ros_log_sink.cc
HDRS
ros_log_sink.h
)

google_library(sensor_bridge
USES_CARTOGRAPHER
SRCS
sensor_bridge.cc
HDRS
sensor_bridge.h
DEPENDS
msg_conversion
tf_bridge
time_conversion
)

google_library(tf_bridge
USES_CARTOGRAPHER
SRCS
tf_bridge.cc
HDRS
tf_bridge.h
DEPENDS
msg_conversion
time_conversion
)

google_library(time_conversion
USES_CARTOGRAPHER
SRCS
time_conversion.cc
HDRS
time_conversion.h
)

google_library(urdf_reader
USES_CARTOGRAPHER
SRCS
urdf_reader.cc
HDRS
urdf_reader.h
DEPENDS
msg_conversion
)

google_test(configuration_files_test
USES_CARTOGRAPHER
SRCS
configuration_files_test.cc
DEPENDS
node_options
)

google_test(time_conversion_test
USES_CARTOGRAPHER
SRCS
time_conversion_test.cc
DEPENDS
time_conversion
)
# Copyright 2016 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.

google_binary(cartographer_assets_writer
USES_CARTOGRAPHER
USES_GFLAGS
USES_GLOG
SRCS
assets_writer_main.cc
DEPENDS
bag_reader
msg_conversion
time_conversion
urdf_reader
)

google_binary(cartographer_node
USES_CARTOGRAPHER
USES_GFLAGS
SRCS
node_main.cc
DEPENDS
node
ros_log_sink
)

install(TARGETS cartographer_node
Expand All @@ -196,15 +35,8 @@ install(TARGETS cartographer_assets_writer
)

google_binary(cartographer_offline_node
USES_CARTOGRAPHER
USES_GFLAGS
SRCS
offline_node_main.cc
DEPENDS
bag_reader
node
ros_log_sink
urdf_reader
)

install(TARGETS cartographer_offline_node
Expand Down
Loading

0 comments on commit 58069b0

Please sign in to comment.