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

Fix lz4 missing from flann.pc Requires: line. #481

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ option(USE_MPI "Use MPI" OFF)

set(NVCC_COMPILER_BINDIR "" CACHE PATH "Directory where nvcc should look for C++ compiler. This is passed to nvcc through the --compiler-bindir option.")

# pkg-config dependencies to be generated into the .pc file
set(PKGCONFIG_EXTERNAL_DEPS_LIST "")

if (NOT BUILD_C_BINDINGS)
set(BUILD_PYTHON_BINDINGS OFF)
set(BUILD_MATLAB_BINDINGS OFF)
Expand All @@ -81,6 +84,7 @@ if (NOT HDF5_FOUND)
message(WARNING "hdf5 library not found, some tests will not be run")
else()
include_directories(${HDF5_INCLUDE_DIR})
list(APPEND PKGCONFIG_EXTERNAL_DEPS_LIST "hdf5")
endif()

if (USE_MPI OR HDF5_IS_PARALLEL)
Expand Down Expand Up @@ -150,6 +154,10 @@ endif(BUILD_CUDA_LIB)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LZ4 REQUIRED liblz4)
include_directories(${LZ4_INCLUDE_DIRS})
# flann is exposing lz4 headers e.g. in `util/serialization.h`
# we need lz4 to appear in `Requires` (not `Requires.private`) in the
# `.pc` file, see https://people.freedesktop.org/~dbn/pkg-config-guide.html
list(APPEND PKGCONFIG_EXTERNAL_DEPS_LIST "liblz4")

#set the C/C++ include path to the "include" directory
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/src/cpp)
Expand Down
9 changes: 9 additions & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
set(PKG_DESC "Fast Library for Approximate Nearest Neighbors")

# Compute `PKG_EXTERNAL_DEPS` string from `PKGCONFIG_EXTERNAL_DEPS_LIST`.
# Once the project has `cmake_minimum_required(VERSION 2.6)`, this
# can be replaced by `list(JOIN ...)`.
set(PKG_EXTERNAL_DEPS "")
foreach(_dep ${PKGCONFIG_EXTERNAL_DEPS_LIST})
string(APPEND PKG_EXTERNAL_DEPS " ${_dep}")
endforeach()

set(pkg_conf_file ${CMAKE_CURRENT_BINARY_DIR}/flann.pc)
configure_file(flann.pc.in ${pkg_conf_file} @ONLY)
install(FILES ${pkg_conf_file}
Expand Down
2 changes: 1 addition & 1 deletion cmake/flann.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ Name: @PROJECT_NAME@
Description: @PKG_DESC@
Version: @FLANN_VERSION@
Requires: @PKG_EXTERNAL_DEPS@
Libs: -L${libdir} @LZ4_STATIC_LDFLAGS@ -lflann -lflann_cpp
Libs: -L${libdir} -lflann -lflann_cpp
Cflags: -I${includedir}