Skip to content

Commit

Permalink
Tools: support Gazebo Harmonic and Garden
Browse files Browse the repository at this point in the history
Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring committed Dec 18, 2023
1 parent bfba2b3 commit fa890a7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
21 changes: 19 additions & 2 deletions ardupilot_gz_gazebo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,33 @@ project(ardupilot_gz_gazebo)
# Find dependencies.
find_package(ament_cmake REQUIRED)

# --------------------------------------------------------------------------- #
# Find gz-sim and dependencies.

find_package(gz-cmake3 REQUIRED)
set(GZ_CMAKE_VER ${gz-cmake3_VERSION_MAJOR})

find_package(gz-plugin2 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin2_VERSION_MAJOR})

find_package(gz-common5 REQUIRED COMPONENTS profiler)
set(GZ_COMMON_VER ${gz-common5_VERSION_MAJOR})

find_package(gz-sim7 REQUIRED)
set(GZ_SIM_VER ${gz-sim7_VERSION_MAJOR})
# Garden (default)
if("$ENV{GZ_VERSION}" STREQUAL "garden" OR NOT DEFINED "ENV{GZ_VERSION}")
gz_find_package(gz-sim7 REQUIRED)
set(GZ_SIM_VER ${gz-sim7_VERSION_MAJOR})

message(STATUS "Compiling against Gazebo Garden")
# Harmonic
elseif("$ENV{GZ_VERSION}" STREQUAL "harmonic")
gz_find_package(gz-sim8 REQUIRED)
set(GZ_SIM_VER ${gz-sim8_VERSION_MAJOR})

message(STATUS "Compiling against Gazebo Harmonic")
else()
message(FATAL_ERROR "Unsupported GZ_VERSION: $ENV{GZ_VERSION}")
endif()

# --------------------------------------------------------------------------- #
# Build.
Expand Down
11 changes: 11 additions & 0 deletions ardupilot_gz_gazebo/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
<maintainer email="[email protected]">Rhys Mainwaring</maintainer>
<license>GPL-3.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>

<depend>gz-common5</depend>
<depend>gz-cmake3</depend>
<depend>gz-plugin2</depend>

<!-- Garden (default) -->
<depend condition="$GZ_VERSION == garden">gz-sim7</depend>
<depend condition="$GZ_VERSION == ''">gz-sim7</depend>
<!-- Harmonic -->
<depend condition="$GZ_VERSION == harmonic">gz-sim8</depend>

<test_depend>ament_lint_auto</test_depend>
<!-- <test_depend>ament_lint_common</test_depend> -->
<!-- <test_depend>ament_cmake_clang_format</test_depend> -->
Expand Down

0 comments on commit fa890a7

Please sign in to comment.