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

Add recipe for ergocub-software #26175

Merged
merged 1 commit into from
Apr 29, 2024
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
27 changes: 27 additions & 0 deletions recipes/ergocub-software/activate.msh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
if_(is_set("COMSPEC")).then_([
sys.list_append("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "Library\\share\\ergoCub")),
sys.list_append("ROS_PACKAGE_PATH", path.join(env("CONDA_PREFIX"), "Library\\share")),
sys.list_append("AMENT_PREFIX_PATH", path.join(env("CONDA_PREFIX"), "Library")),
]).else_([
sys.list_append("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "share/ergoCub")),
sys.list_append("ROS_PACKAGE_PATH", path.join(env("CONDA_PREFIX"), "share")),
sys.list_append("AMENT_PREFIX_PATH", env("CONDA_PREFIX")),
])

# For some reason setting two times the same variable inside the same if does not work in command prompt
# As a workaround, we move each GAZEBO_MODEL_PATH and GZ_SIM_RESOURCE_PATH set to a separate if
if_(is_set("COMSPEC")).then_([
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share\\ergoCub\\robots")),
sys.list_append("GZ_SIM_RESOURCE_PATH", path.join(env("CONDA_PREFIX"), "Library\\share\\ergoCub\\robots"))
]).else_([
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share/ergoCub/robots")),
sys.list_append("GZ_SIM_RESOURCE_PATH", path.join(env("CONDA_PREFIX"), "share/ergoCub/robots"))
])

if_(is_set("COMSPEC")).then_([
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share")),
sys.list_append("GZ_SIM_RESOURCE_PATH", path.join(env("CONDA_PREFIX"), "Library\\share"))
]).else_([
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share")),
sys.list_append("GZ_SIM_RESOURCE_PATH", path.join(env("CONDA_PREFIX"), "share"))
])
46 changes: 46 additions & 0 deletions recipes/ergocub-software/bld_cxx.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
mkdir build
cd build

cmake ^
-G "Ninja" ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
-DCMAKE_BUILD_TYPE=Release ^
-DBUILD_SHARED_LIBS=ON ^
-DCOMPILE_ergoCubEmotions:BOOL=ON ^
%SRC_DIR%
if errorlevel 1 exit 1

:: Build.
cmake --build . --config Release
if errorlevel 1 exit 1

:: Install.
cmake --build . --config Release --target install
if errorlevel 1 exit 1

setlocal EnableDelayedExpansion
:: Generate and copy the [de]activate scripts to %PREFIX%\etc\conda\[de]activate.d.
:: This will allow them to be run on environment activation.
for %%F in (activate deactivate) DO (
multisheller %RECIPE_DIR%\%%F.msh --output .\%%F

if not exist %PREFIX%\etc\conda\%%F.d mkdir %PREFIX%\etc\conda\%%F.d
copy %%F.bat %PREFIX%\etc\conda\%%F.d\%PKG_NAME%_%%F.bat
if %errorlevel% neq 0 exit /b %errorlevel%

copy %%F.sh %PREFIX%\etc\conda\%%F.d\%PKG_NAME%_%%F.sh
if %errorlevel% neq 0 exit /b %errorlevel%

copy %%F.bash %PREFIX%\etc\conda\%%F.d\%PKG_NAME%_%%F.bash
if %errorlevel% neq 0 exit /b %errorlevel%

copy %%F.ps1 %PREFIX%\etc\conda\%%F.d\%PKG_NAME%_%%F.ps1
if %errorlevel% neq 0 exit /b %errorlevel%

copy %%F.xsh %PREFIX%\etc\conda\%%F.d\%PKG_NAME%_%%F.xsh
if %errorlevel% neq 0 exit /b %errorlevel%

copy %%F.zsh %PREFIX%\etc\conda\%%F.d\%PKG_NAME%_%%F.zsh
if %errorlevel% neq 0 exit /b %errorlevel%
)
38 changes: 38 additions & 0 deletions recipes/ergocub-software/build_cxx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh

rm -rf build
mkdir build
cd build

if [[ "${target_platform}" == osx-* ]]; then
# See https://conda-forge.org/docs/maintainer/knowledge_base.html#newer-c-features-with-old-sdk
CXXFLAGS="${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY"
fi

cmake ${CMAKE_ARGS} -GNinja .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DBUILD_TESTING:BOOL=ON \
-DCOMPILE_ergoCubEmotions:BOOL=ON \
..

cmake --build . --config Release

if [[ ("${CONDA_BUILD_CROSS_COMPILATION:-}" != "1" || "${CROSSCOMPILING_EMULATOR}" != "") ]]; then
ctest --output-on-failure --repeat until-pass:5 -C Release
fi

cmake --build . --config Release --target install

# Generate and copy the [de]activate scripts to $PREFIX/etc/conda/[de]activate.d.
# This will allow them to be run on environment activation.
for CHANGE in "activate" "deactivate"
do
multisheller ${RECIPE_DIR}/${CHANGE}.msh --output ./${CHANGE}
mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d"
cp "${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.sh"
cp "${CHANGE}.bash" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.bash"
cp "${CHANGE}.xsh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.xsh"
cp "${CHANGE}.zsh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.zsh"
cp "${CHANGE}.ps1" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.ps1"
done
27 changes: 27 additions & 0 deletions recipes/ergocub-software/deactivate.msh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
if_(is_set("COMSPEC")).then_([
sys.list_remove("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "Library\\share\\ergoCub")),
sys.list_remove("ROS_PACKAGE_PATH", path.join(env("CONDA_PREFIX"), "Library\\share")),
sys.list_remove("AMENT_PREFIX_PATH", path.join(env("CONDA_PREFIX"), "Library")),
]).else_([
sys.list_remove("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "share/ergoCub")),
sys.list_remove("ROS_PACKAGE_PATH", path.join(env("CONDA_PREFIX"), "share")),
sys.list_remove("AMENT_PREFIX_PATH", env("CONDA_PREFIX")),
])

# For some reason setting two times the same variable inside the same if does not work in command prompt
# As a workaround, we move each GAZEBO_MODEL_PATH and GZ_SIM_RESOURCE_PATH set to a separate if
if_(is_set("COMSPEC")).then_([
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share\\ergoCub\\robots")),
sys.list_remove("GZ_SIM_RESOURCE_PATH", path.join(env("CONDA_PREFIX"), "Library\\share\\ergoCub\\robots"))
]).else_([
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share/ergoCub/robots")),
sys.list_remove("GZ_SIM_RESOURCE_PATH", path.join(env("CONDA_PREFIX"), "share/ergoCub/robots"))
])

if_(is_set("COMSPEC")).then_([
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share")),
sys.list_remove("GZ_SIM_RESOURCE_PATH", path.join(env("CONDA_PREFIX"), "Library\\share"))
]).else_([
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share")),
sys.list_remove("GZ_SIM_RESOURCE_PATH", path.join(env("CONDA_PREFIX"), "share"))
])
63 changes: 63 additions & 0 deletions recipes/ergocub-software/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{% set version = "0.7.3" %}

package:
name: ergocub-software-split
version: {{ version }}

source:
- url: https://github.com/icub-tech-iit/ergocub-software/archive/refs/tags/v{{ version }}.tar.gz
sha256: 346d3301da028dfe9e9d31bda259b39c8f6189a69d8bc713389ff0a0e42c02bb

build:
number: 0

outputs:
- name: libergocub-software
script: build_cxx.sh # [unix]
script: bld_cxx.bat # [win]
build:
run_exports:
- {{ pin_subpackage("libergocub-software", max_pin='x.x.x') }}
ignore_run_exports_from:
# idyntree is just used for tests
- idyntree
requirements:
build:
- {{ compiler('c') }}
- {{ stdlib("c") }}
- {{ compiler('cxx') }}
- cmake
- pkg-config
- ninja
- multisheller
host:
- ycm-cmake-modules
- libyarp
- libopencv
- idyntree

test:
commands:
- test -f ${PREFIX}/lib/yarp/yarp_couplingXCubHandMk5.so # [unix]
- if not exist %LIBRARY_LIB%\\yarp\\yarp_couplingXCubHandMk5.dll exit 1 # [win]

- name: ergocub-software
requirements:
run:
- {{ pin_subpackage("libergocub-software", exact=True) }}
test:
commands:
- test -f ${PREFIX}/lib/yarp/yarp_couplingXCubHandMk5.so # [unix]
- if not exist %LIBRARY_LIB%\\yarp\\yarp_couplingXCubHandMk5.dll exit 1 # [win]


about:
home: https://github.com/icub-tech-iit/ergocub-software
license: BSD-3-Clause
license_file: LICENSE
summary: 'Software required to simulate and run the ergoCub humanoid robot.'

extra:
feedstock-name: ergocub-software
recipe-maintainers:
- traversaro