ARC-OPT / wbc

C++ library for optimization-based control of redundant robots
https://arc-opt.github.io/Documentation/
BSD 3-Clause "New" or "Revised" License
38 stars 14 forks source link

Fix CMake setup to propagate dependencies. #37

Closed skasperski closed 2 years ago

skasperski commented 2 years ago

@dmronga @pierrewillenbrockdfki This also has the changed from #36, but does it for all other dependencies as well.

skasperski commented 2 years ago

On a general note:

  1. Global settings like 'link_libraries' and 'include_directories' should be avoided. Always use the target_xxx versions.
  2. Both 'link_directories' and 'target_link_directories' are mostly unnecessary, as CMake uses full pathes.
  3. Library linking should be PUBLIC, unless you are 100 % sure that includes never appear in public headers.
dmronga commented 2 years ago

Thx for the PR, I will take a look next week, after my holiday....

dmronga commented 2 years ago

Hi,

in my local rock installation (and also in a clean VM) this fails with

[ 1%] Linking CXX shared library libwbc-tools.so /usr/bin/ld: cannot find -lpkgcfg_lib_urdfdom_-NOTFOUND collect2: error: ld returned 1 exit status src/tools/CMakeFiles/wbc-tools.dir/build.make:179: recipe for target 'src/tools/libwbc-tools.so.0.2' failed make[2]: *** [src/tools/libwbc-tools.so.0.2] Error 1 CMakeFiles/Makefile2:912: recipe for target 'src/tools/CMakeFiles/wbc-tools.dir/all' failed make[1]: *** [src/tools/CMakeFiles/wbc-tools.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2

I am using Ubuntu18.04 and rock debian packages master-20.06.

Any suggestions on this @skasperski ? Is it a problem of my rock installation? liburdfdom is there under -L/opt/rock/master-20.06/rock-master-20.06-control-urdfdom/lib and pkg-config is able to find it.

skasperski commented 2 years ago

@dmronga What does pkg-config --libs urdfdom give on your system?

skasperski commented 2 years ago

I think the relevant question is who wrote -lpkgcfg_lib_urdfdom_-NOTFOUND into the linking library. As urdfdom is brought in by kdl_parser, you might also want to check pkg-config --libs kdl_parser.

dmronga commented 2 years ago

pkg-config --libs urdfdom gives: -L/opt/rock/master-20.06/rock-master-20.06-control-urdfdom/lib -L/opt/rock/master-20.06/rock-master-20.06-base-console-bridge/lib -L/opt/rock/master-20.06/rock-master-20.06-base-logging/lib -lurdfdom_sensor -lurdfdom_model_state -lurdfdom_model -lurdfdom_world -l -lbase-logging

pkg-config --libs kdl_parser gives -L/opt/rock/master-20.06/rock-master-20.06-control-kdl-parser/lib -L/opt/rock/master-20.06/rock-master-20.06-control-urdfdom/lib -L/opt/rock/master-20.06/rock-master-20.06-control-kdl/lib/pkgconfig/../../lib -L/opt/rock/master-20.06/rock-master-20.06-base-console-bridge/lib -L/opt/rock/master-20.06/rock-master-20.06-base-types/lib -L/opt/rock/master-20.06/rock-master-20.06-base-logging/lib -lkdl_parser -lorocos-kdl -lbase-types -ltinyxml -lurdfdom_sensor -lurdfdom_model_state -lurdfdom_model -lurdfdom_world -l -lbase-logging -lsdformat -lignition-math4

skasperski commented 2 years ago

@dmronga I updated the remaining cmake files, but now this PR is required before it can be merged:

https://git.hb.dfki.de/dfki-mechanics/hyrodyn/rbdl/-/merge_requests/12

I have no means of testing the python-bindings and I don't understand most of it. I can just verify that it compiles, you should probably do some more testing before you merge.