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 bipedal-locomotion-framework #20432

Merged
merged 1 commit into from
Oct 28, 2022
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
25 changes: 25 additions & 0 deletions recipes/bipedal-locomotion-framework/563.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 9f5f573138e5165c68c58bec35047688e18a3e06 Mon Sep 17 00:00:00 2001
From: Silvio Traversaro <[email protected]>
Date: Wed, 14 Sep 2022 15:14:36 +0200
Subject: [PATCH] Do not redefine NEW_LINE in Python bindings CMake

---
bindings/CMakeLists.txt | 5 -----
1 file changed, 5 deletions(-)

diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
index 63e3642b4..5d8e285f4 100644
--- a/bindings/CMakeLists.txt
+++ b/bindings/CMakeLists.txt
@@ -45,11 +45,6 @@ if(FRAMEWORK_COMPILE_PYTHON_BINDINGS)
mark_as_advanced(BLF_PYTHON_PIP_METADATA_INSTALLER)
if(BLF_PYTHON_PIP_METADATA_INSTALL)
get_filename_component(PYTHON_METADATA_PARENT_DIR ${PYTHON_INSTDIR} DIRECTORY)
- if(WIN32)
- set(NEW_LINE "\n\r")
- else()
- set(NEW_LINE "\n")
- endif()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/METADATA "")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Metadata-Version: 2.1${NEW_LINE}")
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/METADATA "Name: bipedal_locomotion_framework${NEW_LINE}")
79 changes: 79 additions & 0 deletions recipes/bipedal-locomotion-framework/564.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
From 99d6999545c6407ef2abc00a2553be73b2636c98 Mon Sep 17 00:00:00 2001
From: Silvio Traversaro <[email protected]>
Date: Wed, 14 Sep 2022 16:14:49 +0200
Subject: [PATCH] Support standalone compilation of Python bindings

---
bindings/CMakeLists.txt | 59 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)

diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
index 63e3642b4..c72be536f 100644
--- a/bindings/CMakeLists.txt
+++ b/bindings/CMakeLists.txt
@@ -2,6 +2,65 @@
# This software may be modified and distributed under the terms of the
# BSD-3-Clause license.

+# Detect if we are doing a standalone build of the bindings, using an external iDynTree
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ set(FRAMEWORK_PYTHON_BINDINGS_BUILD_STANDALONE ON)
+ set(FRAMEWORK_COMPILE_PYTHON_BINDINGS ON)
+else()
+ set(FRAMEWORK_PYTHON_BINDINGS_BUILD_STANDALONE FALSE)
+endif()
+
+if(FRAMEWORK_PYTHON_BINDINGS_BUILD_STANDALONE)
+ cmake_minimum_required(VERSION 3.16)
+ project(BipedalLocomotionFrameworkBindings)
+ find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
+ find_package(pybind11 REQUIRED)
+ find_package(BipedalLocomotionFramework REQUIRED)
+ get_filename_component(CMAKE_CURRENT_PARENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
+ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_PARENT_SOURCE_DIR}/cmake)
+ include(AddBipedalLocomotionPythonModule)
+ if(TARGET BipedalLocomotionFramework::SystemYarpImplementation AND TARGET BipedalLocomotionFramework::ParametersHandlerYarpImplementation)
+ set(FRAMEWORK_COMPILE_YarpImplementation ON)
+ endif()
+ if(TARGET BipedalLocomotionFramework::ParametersHandlerTomlImplementation)
+ set(FRAMEWORK_COMPILE_TomlImplementation ON)
+ endif()
+ if(TARGET BipedalLocomotion::System)
+ set(FRAMEWORK_COMPILE_System ON)
+ endif()
+ if(TARGET BipedalLocomotion::Contacts)
+ set(FRAMEWORK_COMPILE_Contact ON)
+ endif()
+ if(TARGET BipedalLocomotion::Planners)
+ set(FRAMEWORK_COMPILE_Planners ON)
+ endif()
+ if(TARGET BipedalLocomotion::Unicycle)
+ set(FRAMEWORK_COMPILE_Unicycle ON)
+ endif()
+ if(TARGET BipedalLocomotion::FloatingBaseEstimators)
+ set(FRAMEWORK_COMPILE_FloatingBaseEstimators ON)
+ endif()
+ if(TARGET BipedalLocomotion::IK)
+ set(FRAMEWORK_COMPILE_IK ON)
+ endif()
+ if(TARGET BipedalLocomotion::TSID)
+ set(FRAMEWORK_COMPILE_TSID ON)
+ endif()
+ if(TARGET BipedalLocomotion::ManifConversions)
+ set(FRAMEWORK_COMPILE_ManifConversions ON)
+ set(FRAMEWORK_USE_manif ON)
+ endif()
+ if(TARGET BipedalLocomotion::YarpUtilities)
+ set(FRAMEWORK_COMPILE_YarpUtilities ON)
+ endif()
+ if(TARGET BipedalLocomotion::ContinuousDynamicalSystem)
+ set(FRAMEWORK_COMPILE_ContinuousDynamicalSystem ON)
+ endif()
+ if(TARGET BipedalLocomotion::RobotInterface)
+ set(FRAMEWORK_COMPILE_RobotInterface ON)
+ endif()
+endif()
+
if(FRAMEWORK_COMPILE_PYTHON_BINDINGS)

set(NEW_LINE "\n")
34 changes: 34 additions & 0 deletions recipes/bipedal-locomotion-framework/bld_cxx.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
mkdir build
cd build

cmake -G "Ninja" ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DCMAKE_BUILD_TYPE=Release ^
-DBUILD_TESTING:BOOL=ON ^
-DBUILD_SHARED_LIBS:BOOL=ON ^
-DFRAMEWORK_USE_YARP:BOOL=ON ^
-DFRAMEWORK_USE_OsqpEigen:BOOL=ON ^
-DFRAMEWORK_USE_matioCpp:BOOL=ON ^
-DFRAMEWORK_USE_manif:BOOL=ON ^
-DFRAMEWORK_USE_Qhull:BOOL=ON ^
-DFRAMEWORK_USE_cppad:BOOL=ON ^
-DFRAMEWORK_USE_casadi:BOOL=ON ^
-DFRAMEWORK_USE_LieGroupControllers:BOOL=ON ^
-DFRAMEWORK_USE_UnicyclePlanner:BOOL=ON ^
-DFRAMEWORK_COMPILE_PYTHON_BINDINGS:BOOL=OFF ^
%SRC_DIR%
if errorlevel 1 exit 1

type CMakeCache.txt

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

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

:: Test.
ctest --output-on-failure -C Release
if errorlevel 1 exit 1
21 changes: 21 additions & 0 deletions recipes/bipedal-locomotion-framework/bld_py.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cd bindings
rmdir /s /q build
mkdir build
cd build

cmake -G "Ninja" ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DCMAKE_BUILD_TYPE=Release ^
-DBUILD_SHARED_LIBS:BOOL=ON ^
-DPython3_EXECUTABLE:PATH=%PYTHON% ^
-DFRAMEWORK_DETECT_ACTIVE_PYTHON_SITEPACKAGES:BOOL=ON ^
..
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
31 changes: 31 additions & 0 deletions recipes/bipedal-locomotion-framework/build_cxx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

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

mkdir build
cd build

cmake ${CMAKE_ARGS} -GNinja .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING:BOOL=ON \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DFRAMEWORK_USE_YARP:BOOL=ON \
-DFRAMEWORK_USE_OsqpEigen:BOOL=ON \
-DFRAMEWORK_USE_matioCpp:BOOL=ON \
-DFRAMEWORK_USE_manif:BOOL=ON \
-DFRAMEWORK_USE_Qhull:BOOL=ON \
-DFRAMEWORK_USE_cppad:BOOL=ON \
-DFRAMEWORK_USE_casadi:BOOL=ON \
-DFRAMEWORK_USE_LieGroupControllers:BOOL=ON \
-DFRAMEWORK_USE_UnicyclePlanner:BOOL=ON \
-DFRAMEWORK_COMPILE_PYTHON_BINDINGS:BOOL=OFF

cat CMakeCache.txt

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

ctest --output-on-failure -C Release
23 changes: 23 additions & 0 deletions recipes/bipedal-locomotion-framework/build_py.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

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

CXXFLAGS="${CXXFLAGS} -DPYBIND11_DETAILED_ERROR_MESSAGES"

cd ${SRC_DIR}/bindings

rm -rf build
mkdir build
cd build

cmake ${CMAKE_ARGS} -GNinja .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DPython3_EXECUTABLE:PATH=$PYTHON \
-DFRAMEWORK_DETECT_ACTIVE_PYTHON_SITEPACKAGES:BOOL=ON

ninja -v
cmake --build . --config Release --target install
3 changes: 3 additions & 0 deletions recipes/bipedal-locomotion-framework/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Workaround for https://github.com/conda-forge/staged-recipes/pull/20432#issuecomment-1274243030
openssl:
- 1.1.1
150 changes: 150 additions & 0 deletions recipes/bipedal-locomotion-framework/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{% set name = "bipedal-locomotion-framework" %}
{% set namecxx = "libbipedal-locomotion-framework" %}
{% set namepython = "bipedal-locomotion-framework-python" %}
{% set version = "0.9.0" %}

package:
name: {{ name }}
version: {{ version }}

source:
url: https://github.com/ami-iit/bipedal-locomotion-framework/archive/refs/tags/v{{ version }}.tar.gz
sha256: b297b4e83e5008cf3461eecd1ecc306fc789867c18c1bfb3ed4568140f0956bb
patches:
- 563.patch
- 564.patch

build:
number: 0

outputs:
- name: {{ namecxx }}
script: build_cxx.sh # [unix]
script: bld_cxx.bat # [win]
build:
run_exports:
- {{ pin_subpackage(namecxx, max_pin='x.x.x') }}
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- cmake
- pkg-config
- ninja
- {{ cdt('mesa-libgl-devel') }} # [linux]
- {{ cdt('mesa-dri-drivers') }} # [linux]
- {{ cdt('libselinux') }} # [linux]
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
- {{ cdt('libxext') }} # [linux]
host:
- eigen
- idyntree
- manif
- yarp-cxx
- librobometry
- fmt
- spdlog
- cppad
- manif
- nlohmann_json
- libosqp
- osqp-eigen
- libmatio-cpp
- tomlplusplus
- casadi
- qhull
- libopencv
- liblie-group-controllers
- libunicycle-footstep-planner
- librealsense # [not win]
- xorg-libxfixes # [linux]
run:
# manif and eigen are mentioned in the headers so needed when building
# against libbipedal-locomotion-framework
- manif
- eigen

test:
commands:
- test -f ${PREFIX}/include/BipedalLocomotion/System/Advanceable.h # [unix]
- test -f ${PREFIX}/lib/libBipedalLocomotionFrameworkSystem${SHLIB_EXT} # [unix]
- test -f ${PREFIX}/lib/cmake/BipedalLocomotionFramework/BipedalLocomotionFrameworkConfig.cmake # [not win]
- if not exist %PREFIX%\\Library\\include\\BipedalLocomotion\\System\\Advanceable.h exit 1 # [win]
- if not exist %PREFIX%\\Library\\lib\\BipedalLocomotionFrameworkSystem.lib exit 1 # [win]
- if not exist %PREFIX%\\Library\\bin\\BipedalLocomotionFrameworkSystem.dll exit 1 # [win]
- if not exist %PREFIX%\\Library\\CMake\\BipedalLocomotionFrameworkConfig.cmake exit 1 # [win]

- name: {{ namepython }}
script: build_py.sh # [unix]
script: bld_py.bat # [win]
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- pybind11
- pybind11-abi
- ninja
- cmake
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- pybind11 # [build_platform != target_platform]
- pybind11-abi # [build_platform != target_platform]
- {{ cdt('mesa-libgl-devel') }} # [linux]
- {{ cdt('mesa-dri-drivers') }} # [linux]
- {{ cdt('libselinux') }} # [linux]
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
- {{ cdt('libxext') }} # [linux]
host:
- {{ pin_subpackage(namecxx, exact=True) }}
- python
- pip
- pybind11
- pybind11-abi
# Workaround for https://github.com/conda-forge/staged-recipes/pull/20432#issuecomment-1274243030
- openssl=1.1.1
- liblie-group-controllers
- yarp-cxx
- idyntree
- fmt
- spdlog
- xorg-libxfixes # [linux]
run:
- {{ pin_subpackage(namecxx, exact=True) }}
- python
- numpy
- manifpy
test:
commands:
- test $(pip list | grep bipedal_locomotion_framework | tr -s " " | grep $PKG_VERSION | wc -l) -eq 1 # [unix]
- pip check
requires:
- pip
imports:
- bipedal_locomotion_framework

- name: {{ name }}
build:
run_exports:
- {{ pin_subpackage(namecxx, max_pin='x.x.x') }}
requirements:
run:
- {{ pin_subpackage(namecxx, exact=True) }}
- {{ pin_subpackage(namepython, max_pin='x.x.x') }}
test:
imports:
- bipedal_locomotion_framework

about:
home: https://github.com/ami-iit/bipedal-locomotion-framework
license: BSD-3-Clause
license_file:
- LICENSE
summary: Suite of libraries for achieving bipedal locomotion on humanoid robots.


extra:
recipe-maintainers:
- traversaro
- GiulioRomualdi