-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55b9734
commit 3b785a0
Showing
8 changed files
with
472 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
From c1b007ac630b687bc6e52b8f1abd252c427a5fed Mon Sep 17 00:00:00 2001 | ||
From: Silvio Traversaro <[email protected]> | ||
Date: Mon, 23 Sep 2024 12:49:54 +0200 | ||
Subject: [PATCH 1/3] Fix use double leading underscore in python swig bindings | ||
library name | ||
|
||
Fix https://github.com/robotology/icub-main/issues/984 | ||
--- | ||
bindings/CMakeLists.txt | 1 - | ||
1 file changed, 1 deletion(-) | ||
|
||
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt | ||
index ea477e8f54..38d836de1c 100644 | ||
--- a/bindings/CMakeLists.txt | ||
+++ b/bindings/CMakeLists.txt | ||
@@ -58,7 +58,6 @@ if(CREATE_PYTHON) | ||
LANGUAGE python | ||
SOURCES icub.i) | ||
target_link_libraries(${SWIG_MODULE_icub_python_REAL_NAME} Python::Python ${ICUB_SWIG_LIBRARIES}) | ||
- set_target_properties(${SWIG_MODULE_icub_python_REAL_NAME} PROPERTIES OUTPUT_NAME "_icub") | ||
|
||
# installation path is determined reliably on most platforms using distutils | ||
execute_process(COMMAND ${Python_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,prefix=''))" | ||
|
||
From 1f02858bb678f7fc9de45e0ce4c890b3398caf69 Mon Sep 17 00:00:00 2001 | ||
From: Silvio Traversaro <[email protected]> | ||
Date: Fri, 20 Sep 2024 08:59:43 +0200 | ||
Subject: [PATCH 2/3] Support compiling bindings as standalone project using an | ||
external ICUB CMake package | ||
|
||
--- | ||
bindings/CMakeLists.txt | 37 +++++++++++++++++++++---------------- | ||
1 file changed, 21 insertions(+), 16 deletions(-) | ||
|
||
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt | ||
index 38d836de1c..f187f2ca90 100644 | ||
--- a/bindings/CMakeLists.txt | ||
+++ b/bindings/CMakeLists.txt | ||
@@ -2,7 +2,17 @@ | ||
# Authors: Paul Fitzpatrick | ||
# CopyPolicy: Released under the terms of the GNU GPL v2.0. | ||
|
||
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}) | ||
+# Detect if we are doing a standalone build of the bindings, using an external icub-main | ||
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) | ||
+ set(ICUB_BINDINGS_BUILD_STANDALONE TRUE) | ||
+else() | ||
+ set(ICUB_BINDINGS_BUILD_STANDALONE FALSE) | ||
+endif() | ||
+ | ||
+if(ICUB_BINDINGS_BUILD_STANDALONE) | ||
+ cmake_minimum_required(VERSION 3.16) | ||
+ project(ICUBBindings) | ||
+endif() | ||
|
||
# Find YARP for bindings-only builds | ||
find_package(YARP COMPONENTS conf os sig dev math gsl REQUIRED) | ||
@@ -11,10 +21,9 @@ foreach(_component conf os sig dev math gsl) | ||
include_directories(${YARP_${_component}_INCLUDE_DIRS}) | ||
endforeach() | ||
|
||
-# Work-around for missing paths to OpenCV libraries | ||
-find_package(OpenCV) | ||
-if(OpenCV_FOUND) | ||
- link_directories(${OpenCV_LINK_DIRECTORIES} ${OPENCV_LINK_DIRECTORIES}) | ||
+# Find ICUB for bindings-only builds | ||
+if(ICUB_BINDINGS_BUILD_STANDALONE) | ||
+ find_package(ICUB REQUIRED) | ||
endif() | ||
|
||
set(ICUB_SWIG_LIBRARIES ctrlLib | ||
|
||
@@ -58,6 +59,7 @@ if(CREATE_PYTHON) | ||
LANGUAGE python | ||
SOURCES icub.i) | ||
target_link_libraries(${SWIG_MODULE_icub_python_REAL_NAME} Python::Python ${ICUB_SWIG_LIBRARIES}) | ||
+ set_target_properties(${SWIG_MODULE_icub_python_REAL_NAME} PROPERTIES SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE) | ||
|
||
# installation path is determined reliably on most platforms using distutils | ||
execute_process(COMMAND ${Python_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,prefix=''))" | ||
@@ -101,7 +103,9 @@ if(CREATE_RUBY) | ||
target_link_libraries(${SWIG_MODULE_icub_ruby_REAL_NAME} ${RUBY_LIBRARY} ${ICUB_SWIG_LIBRARIES}) | ||
target_include_directories(${SWIG_MODULE_icub_ruby_REAL_NAME} SYSTEM PRIVATE ${RUBY_INCLUDE_PATH}) | ||
set_target_properties(${SWIG_MODULE_icub_ruby_REAL_NAME} PROPERTIES OUTPUT_NAME "icub" | ||
- LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/ruby") | ||
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/ruby" | ||
+ SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE) | ||
+ | ||
endif() | ||
|
||
if(CREATE_JAVA) | ||
@@ -119,6 +123,7 @@ if(CREATE_JAVA) | ||
if(APPLE) | ||
set_target_properties(${SWIG_MODULE_icub_java_REAL_NAME} PROPERTIES SUFFIX ".jnilib") | ||
endif(APPLE) | ||
+ set_target_properties(${SWIG_MODULE_icub_python_REAL_NAME} PROPERTIES SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE) | ||
endif() | ||
|
||
if(CREATE_CSHARP) | ||
@@ -128,7 +133,7 @@ if(CREATE_CSHARP) | ||
SOURCES icub.i) | ||
|
||
target_link_libraries(${SWIG_MODULE_icub_csharp_REAL_NAME} ${SWIG_ICUB_LIBRARIES}) | ||
- set_target_properties(${SWIG_MODULE_icub_csharp_REAL_NAME} PROPERTIES OUTPUT_NAME "icub" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/csharp") | ||
+ set_target_properties(${SWIG_MODULE_icub_csharp_REAL_NAME} PROPERTIES OUTPUT_NAME "icub" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/csharp" SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE) | ||
endif() | ||
|
||
if(CREATE_LUA) | ||
@@ -139,5 +144,5 @@ if(CREATE_LUA) | ||
LANGUAGE lua | ||
SOURCES icub.i) | ||
target_link_libraries(${SWIG_MODULE_icub_lua_REAL_NAME} ${LUA_LIBRARY} ${ICUB_SWIG_LIBRARIES}) | ||
- set_target_properties(${SWIG_MODULE_icub_lua_REAL_NAME} PROPERTIES OUTPUT_NAME "icub" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua") | ||
+ set_target_properties(${SWIG_MODULE_icub_lua_REAL_NAME} PROPERTIES OUTPUT_NAME "icub" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/lua" SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE) | ||
endif() | ||
|
||
From 8eac01933c0df534a5c0eff51c409f7fc99808cb Mon Sep 17 00:00:00 2001 | ||
From: Silvio Traversaro <[email protected]> | ||
Date: Mon, 23 Sep 2024 12:51:02 +0200 | ||
Subject: [PATCH 3/3] Remove references to iDyn in bindings | ||
|
||
--- | ||
bindings/CMakeLists.txt | 1 - | ||
bindings/icub.i | 16 ---------------- | ||
2 files changed, 17 deletions(-) | ||
|
||
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt | ||
index f187f2ca90..9d47b06b79 100644 | ||
--- a/bindings/CMakeLists.txt | ||
+++ b/bindings/CMakeLists.txt | ||
@@ -27,7 +27,6 @@ if(ICUB_BINDINGS_BUILD_STANDALONE) | ||
endif() | ||
|
||
set(ICUB_SWIG_LIBRARIES ctrlLib | ||
- iDyn | ||
iKin | ||
skinDynLib | ||
optimization) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if_(is_set("COMSPEC")).then_([ | ||
sys.list_append("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "Library\\share\\iCub")) | ||
]).else_([ | ||
sys.list_append("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "share/iCub")) | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
mkdir build | ||
cd build | ||
|
||
cmake %CMAKE_ARGS% ^ | ||
-G "Ninja" ^ | ||
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ | ||
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ | ||
-DCMAKE_BUILD_TYPE=Release ^ | ||
-DBUILD_SHARED_LIBS=ON ^ | ||
-DENABLE_icubmod_cartesiancontrollerserver:BOOL=ON ^ | ||
-DENABLE_icubmod_cartesiancontrollerclient:BOOL=ON ^ | ||
-DENABLE_icubmod_gazecontrollerclient:BOOL=ON ^ | ||
-DENABLE_icubmod_skinWrapper:BOOL=ON ^ | ||
-DENABLE_icubmod_dragonfly2:BOOL=OFF ^ | ||
-DENABLE_icubmod_sharedcan:BOOL=ON ^ | ||
-DENABLE_icubmod_bcbBattery:BOOL=ON ^ | ||
-DENABLE_icubmod_canmotioncontrol:BOOL=ON ^ | ||
-DENABLE_icubmod_canBusAnalogSensor:BOOL=ON ^ | ||
-DENABLE_icubmod_canBusInertialMTB:BOOL=ON ^ | ||
-DENABLE_icubmod_canBusSkin:BOOL=ON ^ | ||
-DENABLE_icubmod_canBusFtSensor:BOOL=ON ^ | ||
-DENABLE_icubmod_canBusVirtualAnalogSensor:BOOL=ON ^ | ||
-DENABLE_icubmod_cfw2can:BOOL=OFF ^ | ||
-DENABLE_icubmod_ecan:BOOL=OFF ^ | ||
-DENABLE_icubmod_embObjBattery:BOOL=ON ^ | ||
-DENABLE_icubmod_embObjFTsensor:BOOL=ON ^ | ||
-DENABLE_icubmod_embObjMultipleFTsensors:BOOL=ON ^ | ||
-DENABLE_icubmod_embObjIMU:BOOL=ON ^ | ||
-DENABLE_icubmod_embObjMais:BOOL=ON ^ | ||
-DENABLE_icubmod_embObjMotionControl:BOOL=ON ^ | ||
-DENABLE_icubmod_embObjSkin:BOOL=ON ^ | ||
-DENABLE_icubmod_parametricCalibrator:BOOL=ON ^ | ||
-DENABLE_icubmod_parametricCalibratorEth:BOOL=ON ^ | ||
-DENABLE_icubmod_embObjPOS:BOOL=ON ^ | ||
-DENABLE_icubmod_xsensmtx:BOOL=OFF ^ | ||
-DENABLE_icubmod_socketcan:BOOL=OFF ^ | ||
-DICUB_USE_icub_firmware_shared:BOOL=ON ^ | ||
-DICUB_COMPILE_BINDINGS:BOOL=OFF ^ | ||
%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% | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
cd bindings | ||
rmdir /s /q build | ||
mkdir build | ||
cd build | ||
|
||
cmake %CMAKE_ARGS% -G "Ninja" ^ | ||
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^ | ||
-DCMAKE_BUILD_TYPE=Release ^ | ||
-DBUILD_SHARED_LIBS:BOOL=ON ^ | ||
-DPython_EXECUTABLE:PATH=%PYTHON% ^ | ||
-DCREATE_PYTHON:BOOL=ON ^ | ||
-DCREATE_RUBY:BOOL=OFF ^ | ||
-DCREATE_JAVA:BOOL=OFF ^ | ||
-DCREATE_CSHARP:BOOL=OFF ^ | ||
-DCMAKE_INSTALL_PYTHONDIR:PATH=%SP_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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/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 | ||
|
||
if [[ "${target_platform}" == linux-* ]]; then | ||
export ICUB_MAIN_ON_LINUX=ON | ||
else | ||
export ICUB_MAIN_ON_LINUX=OFF | ||
fi | ||
|
||
cmake ${CMAKE_ARGS} -GNinja .. \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DBUILD_SHARED_LIBS:BOOL=ON \ | ||
-DBUILD_TESTING:BOOL=ON \ | ||
-DENABLE_icubmod_cartesiancontrollerserver:BOOL=ON \ | ||
-DENABLE_icubmod_cartesiancontrollerclient:BOOL=ON \ | ||
-DENABLE_icubmod_gazecontrollerclient:BOOL=ON \ | ||
-DENABLE_icubmod_skinWrapper:BOOL=ON \ | ||
-DENABLE_icubmod_dragonfly2:BOOL=${ICUB_MAIN_ON_LINUX} \ | ||
-DENABLE_icubmod_sharedcan:BOOL=ON \ | ||
-DENABLE_icubmod_bcbBattery:BOOL=ON \ | ||
-DENABLE_icubmod_canmotioncontrol:BOOL=ON \ | ||
-DENABLE_icubmod_canBusAnalogSensor:BOOL=ON \ | ||
-DENABLE_icubmod_canBusInertialMTB:BOOL=ON \ | ||
-DENABLE_icubmod_canBusSkin:BOOL=ON \ | ||
-DENABLE_icubmod_canBusFtSensor:BOOL=ON \ | ||
-DENABLE_icubmod_canBusVirtualAnalogSensor:BOOL=ON \ | ||
-DENABLE_icubmod_cfw2can:BOOL=OFF \ | ||
-DENABLE_icubmod_ecan:BOOL=OFF \ | ||
-DENABLE_icubmod_embObjBattery:BOOL=ON \ | ||
-DENABLE_icubmod_embObjFTsensor:BOOL=ON \ | ||
-DENABLE_icubmod_embObjMultipleFTsensors:BOOL=ON \ | ||
-DENABLE_icubmod_embObjIMU:BOOL=ON \ | ||
-DENABLE_icubmod_embObjMais:BOOL=ON \ | ||
-DENABLE_icubmod_embObjMotionControl:BOOL=ON \ | ||
-DENABLE_icubmod_embObjSkin:BOOL=ON \ | ||
-DENABLE_icubmod_parametricCalibrator:BOOL=ON \ | ||
-DENABLE_icubmod_parametricCalibratorEth:BOOL=ON \ | ||
-DENABLE_icubmod_embObjPOS:BOOL=ON \ | ||
-DENABLE_icubmod_xsensmtx:BOOL=ON \ | ||
-DENABLE_icubmod_socketcan:BOOL=${ICUB_MAIN_ON_LINUX} \ | ||
-DICUB_USE_icub_firmware_shared:BOOL=ON \ | ||
-DICUB_COMPILE_BINDINGS:BOOL=OFF \ | ||
.. | ||
|
||
cmake --build . --config Release | ||
|
||
if [[ ("${CONDA_BUILD_CROSS_COMPILATION:-}" != "1" || "${CROSSCOMPILING_EMULATOR}" != "") ]]; then | ||
ctest --output-on-failure -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/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 | ||
|
||
cd ${SRC_DIR}/bindings | ||
|
||
rm -rf build | ||
mkdir build | ||
cd build | ||
|
||
cmake ${CMAKE_ARGS} -GNinja .. \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DBUILD_SHARED_LIBS:BOOL=ON \ | ||
-DPython_EXECUTABLE:PATH=$PYTHON \ | ||
-DCREATE_PYTHON:BOOL=ON \ | ||
-DCREATE_RUBY:BOOL=OFF \ | ||
-DCREATE_JAVA:BOOL=OFF \ | ||
-DCREATE_CSHARP:BOOL=OFF \ | ||
-DCMAKE_INSTALL_PYTHONDIR:PATH=${SP_DIR} | ||
|
||
ninja -v | ||
cmake --build . --config Release --target install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if_(is_set("COMSPEC")).then_([ | ||
sys.list_remove("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "Library\\share\\iCub")) | ||
]).else_([ | ||
sys.list_remove("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "share/iCub")) | ||
]) |
Oops, something went wrong.