Skip to content

Commit b1ff53f

Browse files
authored
Add build compatibility for ROS2. (#106)
Co-authored-by: Joshua Whitley <[email protected]>
1 parent aff82ee commit b1ff53f

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

CMakeLists.txt

+29-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,18 @@ set(CMAKE_BUILD_TYPE "Release")
1818
find_package(PCL REQUIRED)
1919
find_package(Eigen3 REQUIRED)
2020

21+
if(DEFINED ENV{ROS_VERSION})
22+
set(ROS_VERSION $ENV{ROS_VERSION})
23+
endif()
24+
2125
if(NOT BUILD_PYTHON_BINDINGS)
22-
find_package(catkin)
26+
if(${ROS_VERSION})
27+
if(${ROS_VERSION} EQUAL 1)
28+
find_package(catkin)
29+
elseif (${ROS_VERSION} EQUAL 2)
30+
find_package(ament_cmake)
31+
endif()
32+
endif()
2333
endif()
2434

2535
find_package(OpenMP)
@@ -151,10 +161,28 @@ if(BUILD_test)
151161
endif()
152162

153163
if(catkin_FOUND)
164+
###################################
165+
## catkin specific configuration ##
166+
###################################
154167
install(TARGETS ${PROJECT_NAME}
155168
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})
156169

157170
install(DIRECTORY include/
158171
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}
159172
FILES_MATCHING PATTERN "*.hpp")
173+
elseif (ament_cmake_FOUND)
174+
##################################
175+
## ament specific configuration ##
176+
##################################
177+
ament_export_include_directories(include)
178+
ament_export_libraries(fast_gicp)
179+
ament_package()
180+
181+
install(TARGETS ${PROJECT_NAME}
182+
LIBRARY DESTINATION lib)
183+
184+
install(
185+
DIRECTORY "include/"
186+
DESTINATION include
187+
)
160188
endif()

package.xml

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
<?xml version="1.0"?>
2-
<package format="2">
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
34
<name>fast_gicp</name>
45
<version>0.0.0</version>
56
<description>A collection of fast point cloud registration implementations</description>
67

78
<maintainer email="[email protected]">k.koide</maintainer>
89

910
<license>BSD</license>
11+
<url type="website">https://github.com/SMRT-AIST/fast_gicp</url>
12+
<url type="repository">https://github.com/SMRT-AIST/fast_gicp</url>
13+
<url type="bugtracker">https://github.com/SMRT-AIST/fast_gicp/issues</url>
14+
15+
<buildtool_depend condition="$ROS_VERSION == 1">catkin</buildtool_depend>
16+
<buildtool_depend condition="$ROS_VERSION == 2">ament_cmake</buildtool_depend>
17+
18+
<build_depend>ros_environment</build_depend>
19+
20+
<depend>libpcl-all-dev</depend>
21+
<depend>eigen</depend>
1022

11-
<buildtool_depend>catkin</buildtool_depend>
1223
<export>
24+
<build_type condition="$ROS_VERSION == 1">catkin</build_type>
25+
<build_type condition="$ROS_VERSION == 2">ament_cmake</build_type>
1326
</export>
1427
</package>

0 commit comments

Comments
 (0)