robotology / idyntree

Multibody Dynamics Library designed for Free Floating Robots
BSD 3-Clause "New" or "Revised" License
177 stars 67 forks source link

Compilation of matlab bindings should use the `matlab_add_mex` CMake function #228

Open traversaro opened 8 years ago

traversaro commented 8 years ago

We had problems related to that in getting the bindings to work in Windows.

traversaro commented 8 years ago

We would avoid to manually do this like this: https://github.com/robotology/idyntree/commit/ab0ecc4e8e664da968c142586c4ba3dffd5ae1b5 .

traversaro commented 8 years ago

This could also avoid symbols clash between system libraries and matlab libraries (as this one: https://github.com/robotology/codyco-superbuild/issues/141), see this comment in FindMatlab.cmake , https://github.com/robotology/idyntree/blob/39bcd4832e00344163b163af2e8f9639def29c79/cmake/FindMatlab.cmake#L907 :

   # if we do not do that, the symbols linked from eg. boost remain weak and
   # then clash with the ones defined in the matlab process. So by default
   # the symbols are hidden.
   # This also means that for shared libraries (like MEX), the entry point
   # should be explicitly declared with default visibility, otherwise Matlab
   # cannot find the entry point.
   # Note that this is particularly meaningful if the MEX wrapper itself 
   # contains symbols that are clashing with Matlab (that are compiled in the
   # MEX file). In order to propagate the visibility options to the libraries 
   # to which the MEX file is linked against, the -Wl,--exclude-libs,ALL
  # option should also be specified.