Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit 3f65576

Browse files
author
Carl Delsey
authored
Factor out basic cmake common code. (ros-navigation#536)
* Factor out basic cmake common code. * Fixing the package name so it can include other common things in the future.
1 parent 69d9e04 commit 3f65576

File tree

51 files changed

+179
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+179
-221
lines changed

nav2_amcl/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
cmake_minimum_required(VERSION 3.5)
22
project(nav2_amcl)
33

4-
# Default to C++14
5-
if(NOT CMAKE_CXX_STANDARD)
6-
set(CMAKE_CXX_STANDARD 14)
7-
endif()
8-
9-
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
10-
add_compile_options(-Wall -Wextra -Wpedantic -Werror -fPIC)
11-
endif()
12-
134
find_package(ament_cmake REQUIRED)
5+
find_package(nav2_common REQUIRED)
146
find_package(rclcpp REQUIRED)
157
find_package(message_filters REQUIRED)
168
find_package(tf2_geometry_msgs REQUIRED)
@@ -24,6 +16,8 @@ find_package(nav2_util REQUIRED)
2416
find_package(nav2_tasks REQUIRED)
2517
find_package(nav2_dynamic_params REQUIRED)
2618

19+
nav2_package()
20+
2721
include_directories(
2822
include
2923
)

nav2_amcl/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<license>LGPL</license>
2424

2525
<buildtool_depend>ament_cmake</buildtool_depend>
26+
<build_depend>nav2_common</build_depend>
2627
<depend>rclcpp</depend>
2728
<depend>tf2_geometry_msgs</depend>
2829
<depend>geometry_msgs</depend>

nav2_bringup/CMakeLists.txt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
cmake_minimum_required(VERSION 3.5)
22
project(nav2_bringup)
33

4-
# Default to C++14
5-
if(NOT CMAKE_CXX_STANDARD)
6-
set(CMAKE_CXX_STANDARD 14)
7-
endif()
8-
9-
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
10-
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
11-
endif()
12-
134
find_package(ament_cmake REQUIRED)
5+
find_package(nav2_common REQUIRED)
146
find_package(navigation2 REQUIRED)
7+
8+
nav2_package()
9+
1510
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
1611

1712
ament_package()

nav2_bringup/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<license>Apache License 2.0</license>
1010

1111
<buildtool_depend>ament_cmake</buildtool_depend>
12+
<build_depend>nav2_common</build_depend>
1213

1314
<build_depend>navigation2</build_depend>
1415
<build_depend>launch_ros</build_depend>

nav2_bt_navigator/CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
cmake_minimum_required(VERSION 3.5)
22
project(nav2_bt_navigator)
33

4-
# Default to C++14
5-
if(NOT CMAKE_CXX_STANDARD)
6-
set(CMAKE_CXX_STANDARD 14)
7-
endif()
8-
9-
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
10-
add_compile_options(-Wall -Wextra -Wpedantic -Werror -fPIC)
11-
endif()
12-
134
find_package(ament_cmake REQUIRED)
5+
find_package(nav2_common REQUIRED)
146
find_package(rclcpp REQUIRED)
157
find_package(std_msgs REQUIRED)
168
find_package(nav2_tasks REQUIRED)
@@ -20,6 +12,8 @@ find_package(behaviortree_cpp REQUIRED)
2012
find_package(std_srvs REQUIRED)
2113
find_package(nav2_robot REQUIRED)
2214

15+
nav2_package()
16+
2317
include_directories(
2418
include
2519
)

nav2_bt_navigator/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<license>Apache License 2.0</license>
99

1010
<buildtool_depend>ament_cmake</buildtool_depend>
11+
<build_depend>nav2_common</build_depend>
1112

1213
<build_depend>rclcpp</build_depend>
1314
<build_depend>nav2_tasks</build_depend>

nav2_common/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
3+
project(nav2_common NONE)
4+
5+
find_package(ament_cmake_core REQUIRED)
6+
7+
ament_package(
8+
CONFIG_EXTRAS "nav2_common-extras.cmake"
9+
)
10+
11+
install(
12+
DIRECTORY cmake
13+
DESTINATION share/${PROJECT_NAME}
14+
)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2019 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
#
16+
# Standard Nav2 project setup
17+
#
18+
# @public
19+
#
20+
macro(nav2_package)
21+
# Default to C++14
22+
if(NOT CMAKE_CXX_STANDARD)
23+
set(CMAKE_CXX_STANDARD 14)
24+
endif()
25+
26+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
27+
add_compile_options(-Wall -Wextra -Wpedantic -Werror -fPIC)
28+
endif()
29+
endmacro()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2019 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
set(AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR ":")
16+
17+
include("${nav2_common_DIR}/nav2_package.cmake")

nav2_common/package.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>nav2_common</name>
5+
<version>0.1.5</version>
6+
<description>Common support functionality used throughout the navigation 2 stack</description>
7+
<maintainer email="carl.r.delsey@intel.com">Carl Delsey</maintainer>
8+
<license>Apache License 2.0</license>
9+
10+
<buildtool_depend>ament_cmake_core</buildtool_depend>
11+
12+
<buildtool_export_depend>ament_cmake_core</buildtool_export_depend>
13+
14+
<export>
15+
<build_type>ament_cmake</build_type>
16+
</export>
17+
</package>

0 commit comments

Comments
 (0)