Skip to content

Commit

Permalink
Using flann own import file generation
Browse files Browse the repository at this point in the history
Tweak for version >= 1.9.2 so that it
works for the multi-build type package
i.e. with the Release or Debug in the path
Test package links against flann::flann
  • Loading branch information
bldrvnlw committed Jan 29, 2024
1 parent d166e3e commit 35a7827
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,17 @@ def _fixup_code(self):
# CPACK options""",
)
else:
tools.replace_in_file(
"flann/cmake/flann_utils.cmake",
"set(FLANN_LIB_INSTALL_DIR \"lib${LIB_SUFFIX}\")",
"set(FLANN_LIB_INSTALL_DIR \"lib${LIB_SUFFIX}/$<CONFIG>\")"
)
tools.replace_in_file(
"flann/src/cpp/CMakeLists.txt",
"RUNTIME DESTINATION bin",
"RUNTIME DESTINATION bin/$<CONFIG>"
)

# Version is wrong in flann 1.8.5
if self.version == "1.8.5":
Expand Down Expand Up @@ -206,6 +217,7 @@ def _pkg_bin(self, build_type):
src_dir = f"{self.build_folder}/lib/{build_type}"
dst_lib = f"lib/{build_type}"
dst_bin = f"bin/{build_type}"
self.copy("*flann_cpp_s.lib", src=src_dir, dst=dst_lib, keep_path=False)
self.copy("*flann.lib", src=src_dir, dst=dst_lib, keep_path=False)
self.copy("*.dll", src=src_dir, dst=dst_bin, keep_path=False)
self.copy("*.so", src=src_dir, dst=dst_lib, keep_path=False)
Expand Down
2 changes: 1 addition & 1 deletion test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ if (APPLE)
endif()

#hdf5 and lz4 supplied by CMakeDeps
target_link_libraries(example flann hdf5::hdf5_cpp lz4::lz4 OpenMP::OpenMP_CXX)
target_link_libraries(example flann::flann hdf5::hdf5_cpp lz4::lz4 OpenMP::OpenMP_CXX)

0 comments on commit 35a7827

Please sign in to comment.