-
Notifications
You must be signed in to change notification settings - Fork 405
make kiss_icp c++ package installable via cmake #408
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
base: main
Are you sure you want to change the base?
Conversation
|
@nachovizzo @benemer @tizianoGuadagnino I think I fixed the things that made the CI break in the last run. Can you please re-run them? |
|
oh... right! I added an error case if installing is not possible with non-system-wide dependencies. |
|
@Pyrestone, we get a build error on cpp API on 20.04 ;( |
|
Damn, CMake really insists that the installation is missing dependencies, even if it's never going to be run 🤦♂️ A CI test which actually checks that the lib can be built, exported and included when building cpp/include_example would probably be a good follow-up addition, since the added functionality is essentially switched off now in the current CI build process... |
|
Hey @Pyrestone, first of all, thank you for your contribution! Now the CI passes :) We need more time to review this PR, because we are currently busy with other parts of the project. Also, I know that @tizianoGuadagnino also wanted to look into this or even started working on it in #330, so I guess he is the one who can provide the first feedback. |
|
Hi @benemer, any feedback on this PR ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a brief look and added a few comments. There are a few todos before we can merge this:
- Resolve merge conflicts
- Further testing with ROS 2
- Additional reviews from at least @nachovizzo and @tizianoGuadagnino
Optional:
4. Add CI step to test installation
Unfortunately, I will not have much time soon to do this, so any help is appreciated here.
Thanks again for the PR and sorry for the delay!
| target_include_directories(kiss_icp_core PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> | ||
| $<INSTALL_INTERFACE:include>) | ||
| target_link_libraries(kiss_icp_core PUBLIC Eigen3::Eigen tsl::robin_map Sophus::Sophus) | ||
| target_link_libraries(kiss_icp_core PRIVATE TBB::tbb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to link this privately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why make it public?
It's only used internally, and private linking avoids downstream libraries needing to find / include and depend on tbb as well.
IIRC At first I tried to make every dependency private but ended up with this combination since some of the other dependencies are included in the outward-facing APIs. But tbb is only used in internal utilities, so it's safe to not expect code using the kiss-icp library to need to know about tbb.
| add_subdirectory(src) | ||
|
|
||
| if(INSTALL_KISS_ICP_CPP) | ||
| install(EXPORT kiss_icpTargets FILE kiss_icpTargets.cmake NAMESPACE kiss_icp:: DESTINATION "share/cmake/kiss_icp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why installing to share/cmake? Isn't lib/cmake more common?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I just copied the way the dependencies (e.g. tsl::robin-map) did it.
I'm not a cmake expert, so this was just cargo cult convention and trial&error until cmake finds it. Once I'm back from vacation I can take a look if using lib instead of share works as well.
|
|
||
| configure_package_config_file( | ||
| ${CMAKE_CURRENT_LIST_DIR}/cmake/Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/kiss_icpConfig.cmake" | ||
| INSTALL_DESTINATION "share/cmake/kiss_icp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, maybe change to lib
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this file can be improved, because we currently have contradicting options. For example, I can set DOWNLOAD_MISSING_DEPS to ON and at the same time have, for example, USE_SYSTEM_EIGEN3 to ON as well.
Can we move the logic of checking whether all dependencies are system-wide installed by checking that all USE_SYSTEM_${DEPENDENCY} are set to ON? If they are supposed to be installed, but the target cannot be found, we can disable the installation. Or am I missing anything here?
The calls to find_external_dependency also contain a lot of boilerplate print messages, which I would remove, or at least move to the function.
Hi there!
Cool project!
I saw this was an open task in #330 a while ago, and since I wanted to use KISS-ICP in another project, I re-structured the C++ project so that it is able to be installed via CMake, and then found and loaded in other C++/CMake projects.
I also built a minimal working example on how to include KISS-ICP in another CMake project in the cpp/include_example directory. It's up to you if that's something you find valuable of keeping or not.
Unfortunately, I had to change the directory structure of the package slightly (using separate src/ and include/kiss_icp/ subdirectories to separate out the headers), and I'm not sure if that maybe breaks some ROS 2 components that rely on the C++ library paths. I wasn't yet able to check that, so please let me know if that breaks anything.
The python package still seems to build fine with
make install, and the python/tests/test_kiss_icp.py test still works fine.