Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factor out basic cmake common code. #536

Merged
merged 2 commits into from
Feb 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions nav2_amcl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
cmake_minimum_required(VERSION 3.5)
project(nav2_amcl)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror -fPIC)
endif()

find_package(ament_cmake REQUIRED)
find_package(nav2_common REQUIRED)
find_package(rclcpp REQUIRED)
find_package(message_filters REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
Expand All @@ -24,6 +16,8 @@ find_package(nav2_util REQUIRED)
find_package(nav2_tasks REQUIRED)
find_package(nav2_dynamic_params REQUIRED)

nav2_package()

include_directories(
include
)
Expand Down
1 change: 1 addition & 0 deletions nav2_amcl/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<license>LGPL</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>nav2_common</build_depend>
<depend>rclcpp</depend>
<depend>tf2_geometry_msgs</depend>
<depend>geometry_msgs</depend>
Expand Down
13 changes: 4 additions & 9 deletions nav2_bringup/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
cmake_minimum_required(VERSION 3.5)
project(nav2_bringup)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()

find_package(ament_cmake REQUIRED)
find_package(nav2_common REQUIRED)
find_package(navigation2 REQUIRED)

nav2_package()

install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})

ament_package()
1 change: 1 addition & 0 deletions nav2_bringup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>nav2_common</build_depend>

<build_depend>navigation2</build_depend>
<build_depend>launch_ros</build_depend>
Expand Down
12 changes: 3 additions & 9 deletions nav2_bt_navigator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
cmake_minimum_required(VERSION 3.5)
project(nav2_bt_navigator)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror -fPIC)
endif()

find_package(ament_cmake REQUIRED)
find_package(nav2_common REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(nav2_tasks REQUIRED)
Expand All @@ -20,6 +12,8 @@ find_package(behaviortree_cpp REQUIRED)
find_package(std_srvs REQUIRED)
find_package(nav2_robot REQUIRED)

nav2_package()

include_directories(
include
)
Expand Down
1 change: 1 addition & 0 deletions nav2_bt_navigator/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>nav2_common</build_depend>

<build_depend>rclcpp</build_depend>
<build_depend>nav2_tasks</build_depend>
Expand Down
14 changes: 14 additions & 0 deletions nav2_common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.5)

project(nav2_common NONE)

find_package(ament_cmake_core REQUIRED)

ament_package(
CONFIG_EXTRAS "nav2_common-extras.cmake"
)

install(
DIRECTORY cmake
DESTINATION share/${PROJECT_NAME}
)
29 changes: 29 additions & 0 deletions nav2_common/cmake/nav2_package.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2019 Intel Corporation
#
# 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.

#
# Standard Nav2 project setup
#
# @public
#
macro(nav2_package)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror -fPIC)
endif()
endmacro()
17 changes: 17 additions & 0 deletions nav2_common/nav2_common-extras.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2019 Intel Corporation
#
# 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(AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR ":")

include("${nav2_common_DIR}/nav2_package.cmake")
17 changes: 17 additions & 0 deletions nav2_common/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>nav2_common</name>
<version>0.1.5</version>
<description>Common support functionality used throughout the navigation 2 stack</description>
<maintainer email="carl.r.delsey@intel.com">Carl Delsey</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_core</buildtool_depend>

<buildtool_export_depend>ament_cmake_core</buildtool_export_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
14 changes: 4 additions & 10 deletions nav2_costmap_2d/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
cmake_minimum_required(VERSION 3.5)
project(nav2_costmap_2d)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
#add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-fPIC)
endif()

find_package(ament_cmake REQUIRED)
find_package(nav2_common REQUIRED)
find_package(rclcpp REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(std_msgs REQUIRED)
Expand All @@ -35,6 +26,9 @@ find_package(nav2_msgs REQUIRED)
remove_definitions(-DDISABLE_LIBUSB-1.0)
find_package(Eigen3 REQUIRED)

nav2_package()
add_compile_options(-Wno-sign-compare -Wno-reorder -Wno-strict-aliasing -Wno-unused-parameter -Wno-unused-variable)

include_directories(
include
${ament_INCLUDE_DIRS}
Expand Down
1 change: 1 addition & 0 deletions nav2_costmap_2d/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<license>BSD</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>nav2_common</build_depend>

<depend>geometry_msgs</depend>
<depend>map_msgs</depend>
Expand Down
14 changes: 3 additions & 11 deletions nav2_dwb_controller/costmap_queue/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
cmake_minimum_required(VERSION 3.5)
project(costmap_queue)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
# fPIC option is required so this library can be added to shared libraries.
add_compile_options(-fPIC)
endif()

find_package(ament_cmake REQUIRED)
find_package(nav2_common REQUIRED)
find_package(nav2_costmap_2d REQUIRED)
find_package(rclcpp REQUIRED)
find_package(Boost REQUIRED COMPONENTS system thread)

nav2_package()

include_directories(
include
${Boost_INCLUDE_DIRS}
Expand Down
1 change: 1 addition & 0 deletions nav2_dwb_controller/costmap_queue/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<license>BSD</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>nav2_common</build_depend>
<depend>nav2_costmap_2d</depend>
<depend>rclcpp</depend>
<depend>boost</depend>
Expand Down
12 changes: 3 additions & 9 deletions nav2_dwb_controller/dwb_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
cmake_minimum_required(VERSION 3.5)
project(dwb_controller)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()

find_package(ament_cmake REQUIRED)
find_package(nav2_common REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(nav2_util REQUIRED)
Expand All @@ -22,6 +14,8 @@ find_package(nav_2d_utils REQUIRED)
find_package(nav_2d_msgs REQUIRED)
find_package(Boost REQUIRED COMPONENTS system thread)

nav2_package()

include_directories(
include
${Boost_INCLUDE_DIRS}
Expand Down
1 change: 1 addition & 0 deletions nav2_dwb_controller/dwb_controller/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>nav2_common</build_depend>

<depend>rclcpp</depend>
<depend>std_msgs</depend>
Expand Down
12 changes: 3 additions & 9 deletions nav2_dwb_controller/dwb_core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
cmake_minimum_required(VERSION 3.5)
project(dwb_core)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()

find_package(ament_cmake REQUIRED)
find_package(nav2_common REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
Expand All @@ -24,6 +16,8 @@ find_package(nav_2d_utils REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(tf2_ros REQUIRED)

nav2_package()

include_directories(
include
)
Expand Down
1 change: 1 addition & 0 deletions nav2_dwb_controller/dwb_core/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<license>BSD</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>nav2_common</build_depend>

<build_depend>rclcpp</build_depend>
<build_depend>std_msgs</build_depend>
Expand Down
12 changes: 3 additions & 9 deletions nav2_dwb_controller/dwb_critics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
cmake_minimum_required(VERSION 3.5)
project(dwb_critics)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()

find_package(ament_cmake REQUIRED)
find_package(nav2_common REQUIRED)
find_package(angles REQUIRED)
find_package(nav2_costmap_2d REQUIRED)
find_package(costmap_queue REQUIRED)
Expand All @@ -23,6 +15,8 @@ find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(nav2_util REQUIRED)

nav2_package()

include_directories(
include
)
Expand Down
1 change: 1 addition & 0 deletions nav2_dwb_controller/dwb_critics/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<license>BSD</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>nav2_common</build_depend>

<depend>angles</depend>
<depend>nav2_costmap_2d</depend>
Expand Down
12 changes: 3 additions & 9 deletions nav2_dwb_controller/dwb_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
cmake_minimum_required(VERSION 3.5)
project(dwb_plugins)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
endif()

find_package(ament_cmake REQUIRED)
find_package(nav2_common REQUIRED)
find_package(angles REQUIRED)
find_package(dwb_core REQUIRED)
find_package(nav_2d_msgs REQUIRED)
Expand All @@ -20,6 +12,8 @@ find_package(rclcpp REQUIRED)
find_package(nav2_util REQUIRED)
find_package(nav2_dynamic_params REQUIRED)

nav2_package()

set(dependencies
angles
dwb_core
Expand Down
1 change: 1 addition & 0 deletions nav2_dwb_controller/dwb_plugins/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<license>BSD</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>nav2_common</build_depend>

<depend>angles</depend>
<depend>dwb_core</depend>
Expand Down
Loading