norlab-ulaval / libnabo

A fast K Nearest Neighbor library for low-dimensional spaces
http://norlab-ulaval.github.io/libnabo/
BSD 3-Clause "New" or "Revised" License
431 stars 142 forks source link

Modernize cmake; make cmake compatible with git submoduling #103

Closed jlblancoc closed 3 years ago

jlblancoc commented 4 years ago

This PR does:

ethzasl-jenkins commented 4 years ago

Can one of the admins verify this patch?

pomerlef commented 4 years ago

ok to test

jlblancoc commented 3 years ago

(TODO: write a test of use with find_package(libnabo))

jlblancoc commented 3 years ago

Updates:

https://github.com/ethz-asl/libnabo/blob/7d998e64e12bda8fac497c3af75b55673d47ab40/examples/libnabo-cmake-example/CMakeLists.txt#L1-L11

YoshuaNava commented 3 years ago

LGTM.

YoshuaNava commented 3 years ago

Two last comments:

jlblancoc commented 3 years ago

On which platform did you test the changes?

Ubutu 20.04 and 18.04 (amd64).

YoshuaNava commented 3 years ago

Oki.

All good from my side, let's wait for details on the pipeline.

YoshuaNava commented 3 years ago

Updates:

  • Updated README.
  • Added a new cmake-usage example of how easy it's now to integrate the library since it uses cmake "exported targets":

https://github.com/ethz-asl/libnabo/blob/7d998e64e12bda8fac497c3af75b55673d47ab40/examples/libnabo-cmake-example/CMakeLists.txt#L1-L11

Thank you for taking the time to do this, it's very cool :+1:

pomerlef commented 3 years ago

It's not specific to a given build, they all have the following errors:

In file included from /home/jenkins/workspace/libnabo/compiler/clang/label/ubuntu-trusty/nabo/nabo_private.h:35:0,
                 from /home/jenkins/workspace/libnabo/compiler/clang/label/ubuntu-trusty/nabo/kdtree_cpu.cpp:32:

/home/jenkins/workspace/libnabo/compiler/clang/label/ubuntu-trusty/nabo/nabo.h:35:22: fatal error: Eigen/Core: No such file or directory
 #include "Eigen/Core"
                      ^
compilation terminated.
In file included from /home/jenkins/workspace/libnabo/compiler/clang/label/ubuntu-trusty/nabo/nabo_private.h:35:0,
                 from /home/jenkins/workspace/libnabo/compiler/clang/label/ubuntu-trusty/nabo/brute_force_cpu.cpp:32:

/home/jenkins/workspace/libnabo/compiler/clang/label/ubuntu-trusty/nabo/nabo.h:35:22: fatal error: Eigen/Core: No such file or directory
 #include "Eigen/Core"
                      ^
compilation terminated.
In file included from /home/jenkins/workspace/libnabo/compiler/clang/label/ubuntu-trusty/nabo/nabo.cpp:32:0:

/home/jenkins/workspace/libnabo/compiler/clang/label/ubuntu-trusty/nabo/nabo.h:35:22: fatal error: Eigen/Core: No such file or directory
 #include "Eigen/Core"
                      ^
compilation terminated.
pomerlef commented 3 years ago

ok to test

pomerlef commented 3 years ago

Same errors

jlblancoc commented 3 years ago

Same errors

I'll try to reproduce it... I think it may be related to the outdated version of Eigen in trusty.

jlblancoc commented 3 years ago

Ok, there was a missing cmake command that made the python module to fail to build.

It's fixed now, please verify and merge at your convenience.

pomerlef commented 3 years ago

Alright, I'm not sure how to handle:

default Expected — Waiting for status to be reported

Can someone from ETH how this repo was set up?

michaelpantic commented 3 years ago

Alright, I'm not sure how to handle:

default Expected — Waiting for status to be reported

Can someone from ETH how this repo was set up?

I had a look, there seems to be old build hooks in the config. Removed unreachable URLS. Let's see if it works again.

michaelpantic commented 3 years ago

@pomerlef fixed. Seems to have been a reference to a status check that does not exist anymore.

pomerlef commented 3 years ago

@michaelpantic thanks for the investigation!

peci1 commented 3 years ago

What am I doing wrong? I'm unable to compile libpointmatcher, and neither can I compile the cmake example in libnabo:

$ cd src/libnabo/examples/libnabo-cmake-example/build
$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /media/data/subt/mapper/src/libnabo/examples/libnabo-cmake-example/build
$ make
Scanning dependencies of target libnabo-cmake-example
[ 50%] Building CXX object CMakeFiles/libnabo-cmake-example.dir/trivial.cpp.o
/media/data/subt/mapper/src/libnabo/examples/libnabo-cmake-example/trivial.cpp:3:10: fatal error: nabo/nabo.h: Directory or file does not exist
 #include "nabo/nabo.h"
          ^~~~~~~~~~~~~
compilation terminated.

Looking at libnabo-targets-release.cmake , there's not a word about include directories:

#----------------------------------------------------------------
# Generated CMake target import file for configuration "Release".
#----------------------------------------------------------------

# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)

# Import target "libnabo::nabo" for configuration "Release"
set_property(TARGET libnabo::nabo APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(libnabo::nabo PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE "gomp"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libnabo.a"
  )

list(APPEND _IMPORT_CHECK_TARGETS libnabo::nabo )
list(APPEND _IMPORT_CHECK_FILES_FOR_libnabo::nabo "${_IMPORT_PREFIX}/lib/libnabo.a" )

# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
peci1 commented 3 years ago

This change to the generated libnabo-targets-release.cmake helps building both the example and libpointmatcher:

set_target_properties(libnabo::nabo PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE "gomp"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libnabo.a"
+  INTERFACE_INCLUDE_DIRECTORIES "/media/data/subt/mapper/devel/include;/usr/include/eigen3"
  )
jlblancoc commented 3 years ago

Can you please update to the latest version? It works straight away for me... and the automatically generated targets file has:

set_target_properties(libnabo::nabo PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "/usr/include/eigen3;/home/jlblanco/code/libnabo"
)
peci1 commented 3 years ago

Let's continue in #106. I am using up-to-date master version.