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 casadi-matlab-bindings if ROBOTOLOGY_ENABLE_DYNAMICS_FULL_DEPS is ON and ROBOTOLOGY_USES_MATLAB is ON #747

Merged
merged 5 commits into from
May 20, 2021

Conversation

traversaro
Copy link
Member

@traversaro traversaro commented May 19, 2021

This PR adds the build of https://github.com/dic-iit/casadi-matlab-bindings to build the CasADi MATLAB bindings if both ROBOTOLOGY_ENABLE_DYNAMICS_FULL_DEPS and ROBOTOLOGY_USES_MATLAB are ON. The concept of the repo https://github.com/dic-iit/casadi-matlab-bindings is similar to https://github.com/robotology/yarp-matlab-bindings : a repo to commit the SWIG-generated MATLAB bindings files, to avoid to require the user to install the SWIG fork required to generate it.

This will permit to all users to use CasADi linked with all other dependencies compiled as part of the superbuild, as opposed to ABI problems that can arise when the CasADi binary is used, Furthermore, it would permit to install CasADi MATLAB bindings in conda via:

conda install -c conda-forge -c robotology casadi-matlab-bindings

Fix #719 .

@traversaro
Copy link
Member Author

traversaro commented May 19, 2021

@traversaro
Copy link
Member Author

traversaro commented May 20, 2021

Today I tested, and (at least on Windows with conda's CasADi) this does work as expected:

>> import casadi.*
>> x = MX.sym('x')

x = 

x
>> y = SX.sym('y',5)
Z = SX.sym('Z',4,2)

y = 

[y_0, y_1, y_2, y_3, y_4]

Z = 


[[Z_0, Z_4], 
 [Z_1, Z_5], 
 [Z_2, Z_6], 
 [Z_3, Z_7]]

Instruction for setup:

git clone https://github.com/dic-iit/casadi-matlab-bindings
cd casadi-matlab-bindings
conda create -p .\env
conda activate .\env
conda install cmake ninja vs2019_win-64 casadi
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=.\install  ..
ninja install
# Launch matlab and add .\install\mex to the PATH

env details:

(C:\src\casadi-matlab-bindings\env) C:\src\casadi-matlab-bindings>conda list
# packages in environment at C:\src\casadi-matlab-bindings\env:
#
# Name                    Version                   Build  Channel
ca-certificates           2020.12.5            h5b45459_0    conda-forge
casadi                    3.5.5            py39h765a1bd_3    conda-forge
certifi                   2020.12.5        py39hcbf5309_1    conda-forge
cmake                     3.20.2               h39d44d4_1    conda-forge
intel-openmp              2021.2.0           h57928b3_616    conda-forge
ipopt                     3.13.4               hf6be2e5_0    conda-forge
libblas                   3.9.0                     9_mkl    conda-forge
libcblas                  3.9.0                     9_mkl    conda-forge
libflang                  5.0.0           h6538335_20180525    conda-forge
liblapack                 3.9.0                     9_mkl    conda-forge
llvm-meta                 5.0.0                         0    conda-forge
metis                     5.1.0             h0e60522_1006    conda-forge
mkl                       2021.2.0           hb70f87d_389    conda-forge
mumps-seq                 5.2.1               hb3f9cae_10    conda-forge
ninja                     1.10.2               h5362a0b_0    conda-forge
numpy                     1.20.2           py39h6635163_0    conda-forge
openmp                    5.0.0                    vc14_1    conda-forge
openssl                   1.1.1k               h8ffe710_0    conda-forge
pip                       21.1.1             pyhd8ed1ab_0    conda-forge
python                    3.9.4           h7840368_0_cpython    conda-forge
python_abi                3.9                      1_cp39    conda-forge
setuptools                49.6.0           py39hcbf5309_3    conda-forge
sqlite                    3.35.5               h8ffe710_0    conda-forge
tbb                       2021.2.0             h2d74725_0    conda-forge
tzdata                    2021a                he74cb21_0    conda-forge
vc                        14.2                 hb210afc_4    conda-forge
vs2015_runtime            14.28.29325          h5e1d092_4    conda-forge
vs2019_win-64             19.28.29325          hed2d97d_4    conda-forge
vswhere                   2.8.4                h57928b3_0    conda-forge
wheel                     0.36.2             pyhd3deb0d_0    conda-forge
wincertstore              0.2             py39hcbf5309_1006    conda-forge

@traversaro
Copy link
Member Author

traversaro commented May 20, 2021

Given @Giulero and @GiulioRomualdi approval and my tests, I think we can merge.

@traversaro traversaro merged commit a808bec into master May 20, 2021
@traversaro traversaro deleted the fix/719 branch May 20, 2021 08:00
Nicogene pushed a commit to Nicogene/robotology-superbuild that referenced this pull request Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package CasADi MATLAB bindings
3 participants