-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from MOLAorg/master
Modernize cmake; make cmake compatible with git submoduling
- Loading branch information
Showing
6 changed files
with
151 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
project(libnabo-cmake-example) | ||
|
||
# This looks for the libnabo-config.cmake file, which in turns | ||
# includes libnabo-targets.cmake: | ||
find_package(libnabo REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} trivial.cpp) | ||
|
||
# This sets both the include directories and link library: | ||
target_link_libraries(${PROJECT_NAME} libnabo::nabo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// This example is in the public domain | ||
|
||
#include "nabo/nabo.h" | ||
|
||
int main() | ||
{ | ||
using namespace Nabo; | ||
using namespace Eigen; | ||
|
||
// 100 points in 3D | ||
MatrixXf M = MatrixXf::Random(3, 100); | ||
// 1 query points | ||
VectorXf q = VectorXf::Random(3); | ||
|
||
// create a kd-tree for M, note that M must stay valid during the lifetime of the kd-tree | ||
NNSearchF* nns = NNSearchF::createKDTreeLinearHeap(M); | ||
|
||
// look for the 5 nearest neighbour of a the single-point query | ||
const int K = 5; | ||
VectorXi indices(K); | ||
VectorXf dists2(K); | ||
nns->knn(q, indices, dists2, K); | ||
|
||
// cleanup kd-tree | ||
delete nns; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,6 @@ | ||
# - Config file for the libnabo package | ||
# It defines the following variables | ||
# libnabo_INCLUDE_DIRS - include directories for libnabo | ||
# libnabo_LIBRARIES - libraries to link against | ||
|
||
# Compute paths | ||
get_filename_component(libnabo_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
set(libnabo_INCLUDE_DIRS "@libnabo_include_dirs@") | ||
|
||
if(CMAKE_COMPILER_IS_GNUCC) | ||
set(libnabo_LIBRARIES @libnabo_library@ gomp) | ||
else(CMAKE_COMPILER_IS_GNUCC) | ||
set(libnabo_LIBRARIES @libnabo_library@) | ||
endif(CMAKE_COMPILER_IS_GNUCC) | ||
include(${CMAKE_CURRENT_LIST_DIR}/libnabo-targets.cmake) | ||
|
||
# This causes catkin_simple to link against these libraries | ||
set(libnabo_FOUND_CATKIN_PROJECT true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters