nanoflann is a C++ header-only library for building KD-Trees, mostly optimized for 2D or 3D point clouds.
nanoflann does not require compiling or installing, just an #include <nanoflann.hpp> in your code.
See: