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

Modernize cmake; make cmake compatible with git submoduling #382

Merged
merged 11 commits into from
Sep 24, 2020

Conversation

jlblancoc
Copy link
Contributor

This PR does:

  • Use GNUInstallDirs to correctly install files in their standard directories (multiarch-compatible).
  • Add install(EXPORT ... to cmake scripts to allow better use of exported targets.
  • Add build options to allow not building parts of the projects (defaults=as it was before)
  • Automatic detection of libnabo if built as part of the same source tree (e.g. git submodules).

@ethzasl-jenkins
Copy link

Can one of the admins verify this patch?

@pomerlef
Copy link
Collaborator

pomerlef commented Jun 1, 2020

ok to test

Copy link
Contributor

@YoshuaNava YoshuaNava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlblancoc I left some comments in your PR, mostly questions.

Have you also tested that the library builds with ROS? In merged and linked devel (--no-install and --install flags when using catkin build)

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@jlblancoc
Copy link
Contributor Author

Have you also tested that the library builds with ROS? In merged and linked devel (--no-install and --install flags when using catkin build)

I tried with catkin, and it failed due to failed to find "nabo/nabo.h"... But I'm not sure it's due to these changes. Perhaps it's assumed that the user should do a "sudo make install" after building "libnabo"? I will re-check this area, anyway, another day.

@YoshuaNava
Copy link
Contributor

Hi @jlblancoc,
Thank you for addressing all the comments.

For the ones that require improvements that go beyond the scope of this PR, could you open issues? So we can actively keep track of them.

Thank you, and have a nice weekend :)

Yoshua

@jlblancoc
Copy link
Contributor Author

All done: it was tested to build both, as a standalone project, and with "catkin build".

Note that there's another related PR in the queue: norlab-ulaval/libnabo#103

@YoshuaNava
Copy link
Contributor

Nice! Thank you.


add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
if (NOT TARGET uninstall)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this require a documentation update?

@YoshuaNava
Copy link
Contributor

YoshuaNava commented Aug 22, 2020

@jlblancoc Is this PR in a state ready for merging?

@jlblancoc
Copy link
Contributor Author

jlblancoc commented Aug 26, 2020 via email

@jlblancoc
Copy link
Contributor Author

Please, test and merge norlab-ulaval/libnabo#103 first so this PR makes sure of using the updated version of libnabo too.

@pomerlef
Copy link
Collaborator

@jlblancoc so I guess we can continue on this PR. Could you update your branch?

@jlblancoc
Copy link
Contributor Author

@pomerlef After the last commit, it builds cleanly locally... let's see what happens with Jenkins.

@pomerlef
Copy link
Collaborator

ok to test

@pomerlef
Copy link
Collaborator

the branch is still out-of-date. Here is the error log:

/home/jenkins/workspace/pointmatcher@2/label/ubuntu-xenial/pointmatcher/MatchersImpl.h:41:23: fatal error: nabo/nabo.h: No such file or directory
compilation terminated.
[ 31%] Building CXX object CMakeFiles/pointmatcher.dir/pointmatcher/Registrar.cpp.o
CMakeFiles/pointmatcher.dir/build.make:158: recipe for target 'CMakeFiles/pointmatcher.dir/pointmatcher/ICP.cpp.o' failed

make[2]: *** [CMakeFiles/pointmatcher.dir/pointmatcher/ICP.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/jenkins/workspace/pointmatcher@2/label/ubuntu-xenial/pointmatcher/Registry.cpp:41:0:

/home/jenkins/workspace/pointmatcher@2/label/ubuntu-xenial/pointmatcher/MatchersImpl.h:41:23: fatal error: nabo/nabo.h: No such file or directory
compilation terminated.
CMakeFiles/pointmatcher.dir/build.make:182: recipe for target 'CMakeFiles/pointmatcher.dir/pointmatcher/Registry.cpp.o' failed

@jlblancoc
Copy link
Contributor Author

I just integrated @peci1 's fixes (thanks!) into this PR via a cherry-pick.

The order of operations to get this sorted out is:

  1. Merge Fix install-space include directories libnabo#106
  2. Then trigger another build of this PR to verify it builds in Jenkins.
  3. Merge this PR
  4. Reflect new changes in libnabo. #404 can be closed since its changes are already applied on top of this PR.

@pomerlef
Copy link
Collaborator

ok to test

@pomerlef
Copy link
Collaborator

@jlblancoc could you bring your branch to master so I can merge?

@jlblancoc
Copy link
Contributor Author

jlblancoc commented Sep 23, 2020 via email

@jlblancoc
Copy link
Contributor Author

rebase done.
Let's wait for Jenkins...

@iabaldwin
Copy link

Builds nicely again - thanks @jlblancoc @pomerlef

@pomerlef pomerlef merged commit 0ee8c21 into norlab-ulaval:master Sep 24, 2020
@peci1
Copy link
Contributor

peci1 commented Sep 24, 2020

Not yet there...

$ cat devel/lib/pkgconfig/libpointmatcher.pc 
prefix=/media/data/subt/mapper/devel
exec_prefix=/media/data/subt/mapper/devel
libdir=${prefix}/lib
includedir=${prefix}/include

Name: libpointmatcher
Description: See https://github.com/ethz-asl/libpointmatcher
Version: 1.3.1
Libs: -L${libdir}  /media/data/subt/mapper/devel/lib/$<TARGET_FILE:libpointmatcher> -l$<TARGET_FILE:yaml-cpp-pm>
Cflags: -I${includedir}/
$ cat devel/share/libpointmatcher/cmake/libpointmatcherConfig.cmake 
# - Config file for the libpointmatcher package
# It defines the following variables
#  libpointmatcher_INCLUDE_DIRS - include directories for pointmatcher
#  libpointmatcher_LIBRARIES    - libraries to link against

include(CMakeFindDependencyMacro)
find_dependency(libnabo REQUIRED)

# Compute paths
get_filename_component(POINTMATCHER_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(libpointmatcher_INCLUDE_DIRS "/media/data/subt/mapper/devel/include;/usr/include/eigen3")
set(LIBPOINTMATCHER_INCLUDE_DIRS "/media/data/subt/mapper/devel/include;/usr/include/eigen3")
set(pointmatcher_INCLUDE_DIRS "/media/data/subt/mapper/devel/include;/usr/include/eigen3")
set(POINTMATCHER_INCLUDE_DIRS "/media/data/subt/mapper/devel/include;/usr/include/eigen3")

set(libpointmatcher_LIBRARIES "/media/data/subt/mapper/devel/lib/$<TARGET_FILE:libpointmatcher>;$<TARGET_FILE:yaml-cpp-pm>")
set(LIBPOINTMATCHER_LIBRARIES "/media/data/subt/mapper/devel/lib/$<TARGET_FILE:libpointmatcher>;$<TARGET_FILE:yaml-cpp-pm>")
set(pointmatcher_LIBRARIES "/media/data/subt/mapper/devel/lib/$<TARGET_FILE:libpointmatcher>;$<TARGET_FILE:yaml-cpp-pm>")
set(POINTMATCHER_LIBRARIES "/media/data/subt/mapper/devel/lib/$<TARGET_FILE:libpointmatcher>;$<TARGET_FILE:yaml-cpp-pm>")

# This causes catkin simple to link against these libraries
set(libpointmatcher_FOUND_CATKIN_PROJECT true)
set(LIBPOINTMATCHER_FOUND_CATKIN_PROJECT true)
set(pointmatcher_FOUND_CATKIN_PROJECT true)
set(POINTMATCHER_FOUND_CATKIN_PROJECT true)
Errors     << libpointmatcher_ros:check /media/data/subt/mapper/logs/libpointmatcher_ros/build.check.038.log                                                                
/media/data/subt/mapper/devel/lib/$<TARGET_FILE:libpointmatcher>;$<TARGET_FILE:yaml-cpp-pm>
CMake Error at /media/data/subt/mapper/src/ethzasl_icp_mapping/libpointmatcher_ros/CMakeLists.txt:62 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_FILE:libpointmatcher>

  No target "libpointmatcher"


CMake Error at /media/data/subt/mapper/src/ethzasl_icp_mapping/libpointmatcher_ros/CMakeLists.txt:62 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_FILE:yaml-cpp-pm>

  No target "yaml-cpp-pm"


make: *** [cmake_check_build_system] Error 1

We need to find a way for the generator expressions to actually get evaluated.

@peci1
Copy link
Contributor

peci1 commented Sep 24, 2020

See #407.

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.

6 participants