Skip to content

Commit

Permalink
Add support for building gz-sim-yarp-plugins against gz-sim9
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro committed Oct 2, 2024
1 parent 8ce978c commit 6550510
Show file tree
Hide file tree
Showing 4 changed files with 3,167 additions and 71 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/test-pixi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
pixi-test:
name: '[pixi:${{ matrix.os }}]'
name: '[pixi:${{ matrix.os }}:env:${{ matrix.pixi_env }}]'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -17,6 +17,10 @@ jobs:
# Disabled until https://github.com/robotology/gz-sim-yarp-plugins/issues/205 is fixed
# windows-2019
]
pixi_env: [
default,
ionic
]

steps:
- uses: actions/checkout@v4
Expand All @@ -39,4 +43,4 @@ jobs:
run: pixi info

- name: Run tests
run: pixi run test
run: pixi run -e ${{ matrix.pixi_env }} test
32 changes: 27 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,37 @@ project(gz-sim-yarp-plugins
LANGUAGES CXX C
VERSION 0.3.0)

find_package(gz-cmake3 REQUIRED)
find_package(YARP REQUIRED COMPONENTS robotinterface os)
find_package(YCM REQUIRED)

gz_find_package(gz-plugin2 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin2_VERSION_MAJOR})
# Initial value of GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION is empty, and then is set to 8 or 9 depending if gz-sim8 or gz-sim9 are available
set(GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION_DOCS "Version of gz-sim used to compile gz-sim-yarp-plugins (either 8 or 9)")
set(GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION "" CACHE STRING ${GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION_DOCS})

# If GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION is not set, try to guess a suitable value
# based on the gz-sim version that can be found in the system
if(GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION STREQUAL "")
find_package(gz-sim8 QUIET)
if(gz-sim8_FOUND)
set(GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION "8" CACHE STRING ${GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION_DOCS} FORCE)
else()
find_package(gz-sim9 REQUIRED)
set(GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION "9" CACHE STRING ${GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION_DOCS} FORCE)
endif()
endif()

gz_find_package(gz-sim8 REQUIRED)
set(GZ_SIM_VER ${gz-sim8_VERSION_MAJOR})
if(GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION STREQUAL "8")
set(GZ_SIM_VER ${gz-sim8_VERSION_MAJOR})
find_package(gz-plugin2 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin2_VERSION_MAJOR})
elseif(GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION STREQUAL "9")
find_package(gz-sim9 REQUIRED)
set(GZ_SIM_VER ${gz-sim9_VERSION_MAJOR})
find_package(gz-plugin3 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin3_VERSION_MAJOR})
else()
message(FATAL_ERROR "Unsupported GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION value ${GZ_SIM_YARP_PLUGINS_USED_GZ_SIM_VERSION}, only 8 or 9 are supported.")
endif()

option(GZ_SIM_YARP_PLUGINS_BUILD_TOOLS "If enabled, build command line helper tools" ON)

Expand Down
Loading

0 comments on commit 6550510

Please sign in to comment.