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

Cross-compiling mc_rtc dependencies for an RTOS #201

Closed
magnusmusngi opened this issue Oct 27, 2021 · 5 comments
Closed

Cross-compiling mc_rtc dependencies for an RTOS #201

magnusmusngi opened this issue Oct 27, 2021 · 5 comments

Comments

@magnusmusngi
Copy link

Hi,

I'm currently in the process of porting mc_rtc into an RTOS. I was already able to cross-compile dependencies (let's call it level-1 dependency) that only relies on the standard C++ libraries, and now I am working on cross-compiling mc_rtc dependencies (let's call it level-2 dependency) that are dependent on level-1 dependencies and headers (e.g. eigen).

I noticed that for these level-2 dependencies, they use either add_project_dependency() or find_package() in their CMakeLists.txt to add their dependencies. And since I am now using cross-compiled dependencies, and header files, I need to change the way these dependencies are added in the CMakeLists.txt file. Also, I can't seem to find out the targets in the CMakeLists files. Is there any guide or advice that I could use to proceed with the process?

Additionally, does the "cmake/*.cmake" files that are included (using the include(cmake/*.cmake) line in the CMakeLists.txt file need to be modified?

Thank you

@gergondet
Copy link
Member

Hi @magnusmusngi

they use either add_project_dependency() or find_package() in their CMakeLists.txt to add their dependencies

The first is a wrapper around find_package(). The difference is that it will add the package in the generate *Config.cmake file.

And since I am now using cross-compiled dependencies, and header files, I need to change the way these dependencies are added in the CMakeLists.txt file.

I am not very familiar with cross-compiling but I think you need a CMake toolchain that will take care of setting the search path correctly (e.g. as explained here). As long as CMake is not looking for dependencies on the host system you should be good to go and you should not need to modify the CMakeLists or the installed config files.

Also, I can't seem to find out the targets in the CMakeLists files

I am not sure I fully understand your question here but:

  • CMake targets are added via add_library add_executable and so-on
  • they are exported when they are installed via the EXPORT keyword (e.g. here)
  • the information about the targets are in the ${PROJECT_NAME}Targets.cmake file that is installed by CMake and per-build-type information is available in ${PROJECT_NAME}Targets-${BUILD_TYPE}.cmake (the first file defines the imported targets and the second file sets per build type options)

@magnusmusngi
Copy link
Author

Thanks, @gergondet. I will try these suggestions. I already have a CMake toolchain file, but I only used it to set the compiler. Having to change the search path only in the toolchain file would be great as I don't have to modify each of the CMakeLists.txt for each of the dependency.

Thank you

@magnusmusngi
Copy link
Author

magnusmusngi commented Sep 25, 2023

Hi @gergondet,

I am now considering using an mc_rtc version that supports ROS2, and again, I am planning to port this into an RTOS. In terms of the dependencies, are they still the same as the ones listed in https://jrl-umi3218.github.io/mc_rtc/tutorials/introduction/installation-build-no-script.html?

Thank you

@gergondet
Copy link
Member

Hi @magnusmusngi

This documentation is a little out-dated.

hpp-spline has been replaced with ndcurves

It's also missing:

@magnusmusngi
Copy link
Author

Thank you, @gergondet

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

No branches or pull requests

2 participants