mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-04 03:09:07 +08:00
[FLANN] Allow to be build as shared lib (#16724)
* Allow FLANN to be build as shared lib * Fix openmvg linking to FLANN * Fix pcl linking to FLANN
This commit is contained in:
parent
7234002d11
commit
2462a956c8
@ -1,10 +0,0 @@
|
||||
Source: flann
|
||||
Version: 2019-04-07
|
||||
Port-Version: 1
|
||||
Homepage: https://github.com/mariusmuja/flann
|
||||
Build-Depends: lz4
|
||||
Description: Fast Library for Approximate Nearest Neighbors
|
||||
|
||||
Feature: hdf5
|
||||
Build-Depends: hdf5
|
||||
Description: Build with hdf5
|
@ -1,90 +1,64 @@
|
||||
From c111a280591aa542914ca845c0be6099a94315ad Mon Sep 17 00:00:00 2001
|
||||
From: Lars Glud <larshg@gmail.com>
|
||||
Date: Tue, 16 Mar 2021 10:40:06 +0100
|
||||
Subject: [PATCH] fix build error
|
||||
|
||||
---
|
||||
CMakeLists.txt | 8 ++-
|
||||
cmake/Config.cmake.in | 5 ++
|
||||
src/cpp/CMakeLists.txt | 149 ++++++++++++++++++++++++-----------------
|
||||
3 files changed, 96 insertions(+), 66 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index f4b94d2..7ff331a 100644
|
||||
index f4b94d2..33b2c26 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -146,8 +146,7 @@ if (BUILD_CUDA_LIB)
|
||||
@@ -1,4 +1,4 @@
|
||||
-cmake_minimum_required(VERSION 2.6)
|
||||
+cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
@@ -49,6 +49,8 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
|
||||
# set output path for tests
|
||||
set(TEST_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/test)
|
||||
|
||||
+option(BUILD_DYNAMIC "Build shared version of libs" ON)
|
||||
+option(BUILD_STATIC "Build static version of libs" ON)
|
||||
option(BUILD_C_BINDINGS "Build C bindings" ON)
|
||||
option(BUILD_PYTHON_BINDINGS "Build Python bindings" ON)
|
||||
option(BUILD_MATLAB_BINDINGS "Build Matlab bindings" ON)
|
||||
@@ -146,8 +148,8 @@ if (BUILD_CUDA_LIB)
|
||||
endif(CUDA_FOUND)
|
||||
endif(BUILD_CUDA_LIB)
|
||||
|
||||
-find_package(PkgConfig REQUIRED)
|
||||
-pkg_check_modules(LZ4 REQUIRED liblz4)
|
||||
+find_package(lz4 REQUIRED)
|
||||
+find_package(PkgConfig)
|
||||
+find_package(lz4 CONFIG REQUIRED)
|
||||
|
||||
#set the C/C++ include path to the "include" directory
|
||||
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/src/cpp)
|
||||
diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in
|
||||
index 6b95a71..778aec4 100644
|
||||
index 6b95a71..e8bb3f7 100644
|
||||
--- a/cmake/Config.cmake.in
|
||||
+++ b/cmake/Config.cmake.in
|
||||
@@ -3,3 +3,5 @@
|
||||
@@ -1,5 +1,10 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
+# Get definition of 'find_dependency' macro
|
||||
+include(CMakeFindDependencyMacro)
|
||||
+# Find lz4. This will create 'lz4::lz4' target
|
||||
+find_dependency(lz4)
|
||||
+
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
|
||||
check_required_components("flann")
|
||||
|
||||
+include(CMakeFindDependencyMacro)
|
||||
+find_dependency(lz4)
|
||||
\ No newline at end of file
|
||||
diff --git a/cmake/flann_utils.cmake b/cmake/flann_utils.cmake
|
||||
index afe4742..8aef8e0 100644
|
||||
--- a/cmake/flann_utils.cmake
|
||||
+++ b/cmake/flann_utils.cmake
|
||||
@@ -1,8 +1,7 @@
|
||||
macro(GET_OS_INFO)
|
||||
string(REGEX MATCH "Linux" OS_IS_LINUX ${CMAKE_SYSTEM_NAME})
|
||||
- set(FLANN_LIB_INSTALL_DIR "lib${LIB_SUFFIX}")
|
||||
- set(FLANN_INCLUDE_INSTALL_DIR
|
||||
- "include/${PROJECT_NAME_LOWER}-${FLANN_MAJOR_VERSION}.${FLANN_MINOR_VERSION}")
|
||||
+ set(FLANN_LIB_INSTALL_DIR "lib")
|
||||
+ set(FLANN_INCLUDE_INSTALL_DIR "include")
|
||||
endmacro(GET_OS_INFO)
|
||||
|
||||
|
||||
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
|
||||
index 3f4655a..bc1d758 100644
|
||||
--- a/examples/CMakeLists.txt
|
||||
+++ b/examples/CMakeLists.txt
|
||||
@@ -1,9 +1,10 @@
|
||||
add_custom_target(examples ALL)
|
||||
|
||||
+find_package(lz4 REQUIRED)
|
||||
|
||||
if (BUILD_C_BINDINGS)
|
||||
add_executable(flann_example_c flann_example.c)
|
||||
- target_link_libraries(flann_example_c -Wl,--push-state,--no-as-needed ${LZ4_LIBRARIES} -Wl,--pop-state)
|
||||
+ target_link_libraries(flann_example_c lz4::lz4)
|
||||
target_link_libraries(flann_example_c flann)
|
||||
set_target_properties(flann_example_c PROPERTIES COMPILE_FLAGS -std=c99)
|
||||
|
||||
@@ -15,7 +16,7 @@ if (HDF5_FOUND)
|
||||
include_directories(${HDF5_INCLUDE_DIR})
|
||||
|
||||
add_executable(flann_example_cpp flann_example.cpp)
|
||||
- target_link_libraries(flann_example_cpp -Wl,--push-state,--no-as-needed ${LZ4_LIBRARIES} -Wl,--pop-state)
|
||||
+ target_link_libraries(flann_example_cpp lz4::lz4)
|
||||
target_link_libraries(flann_example_cpp ${HDF5_LIBRARIES} flann_cpp)
|
||||
if (HDF5_IS_PARALLEL)
|
||||
target_link_libraries(flann_example_cpp ${MPI_LIBRARIES})
|
||||
@@ -27,7 +28,7 @@ if (HDF5_FOUND)
|
||||
|
||||
if (USE_MPI AND HDF5_IS_PARALLEL)
|
||||
add_executable(flann_example_mpi flann_example_mpi.cpp)
|
||||
- target_link_libraries(flann_example_mpi -Wl,--push-state,--no-as-needed ${LZ4_LIBRARIES} -Wl,--pop-state)
|
||||
+ target_link_libraries(flann_example_mpi lz4::lz4)
|
||||
target_link_libraries(flann_example_mpi flann_cpp ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${Boost_LIBRARIES})
|
||||
|
||||
add_dependencies(examples flann_example_mpi)
|
||||
diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
|
||||
index b421abb..78f9a64 100644
|
||||
index b421abb..474cd7e 100644
|
||||
--- a/src/cpp/CMakeLists.txt
|
||||
+++ b/src/cpp/CMakeLists.txt
|
||||
@@ -1,6 +1,6 @@
|
||||
#include_directories(${CMAKE_SOURCE_DIR}/include algorithms ext util nn .)
|
||||
|
||||
-add_definitions(-D_FLANN_VERSION=${FLANN_VERSION})
|
||||
+add_definitions(-D_FLANN_VERSION=${FLANN_VERSION} -std=c++11)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/flann/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/flann/config.h)
|
||||
|
||||
@@ -8,12 +8,11 @@ file(GLOB_RECURSE C_SOURCES flann.cpp)
|
||||
@@ -8,13 +8,7 @@ file(GLOB_RECURSE C_SOURCES flann.cpp)
|
||||
file(GLOB_RECURSE CPP_SOURCES flann_cpp.cpp)
|
||||
file(GLOB_RECURSE CU_SOURCES *.cu)
|
||||
|
||||
@ -94,30 +68,49 @@ index b421abb..78f9a64 100644
|
||||
- set_target_properties(flann_cpp_s PROPERTIES COMPILE_FLAGS -fPIC)
|
||||
-endif()
|
||||
-set_property(TARGET flann_cpp_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC FLANN_USE_CUDA)
|
||||
+find_package(lz4 REQUIRED)
|
||||
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
+add_library(flann_cpp STATIC ${CPP_SOURCES})
|
||||
+target_link_libraries(flann_cpp PRIVATE lz4::lz4)
|
||||
+set_property(TARGET flann_cpp PROPERTY COMPILE_DEFINITIONS FLANN_STATIC)
|
||||
|
||||
-
|
||||
+#Set flags if we build CUDA versions
|
||||
if (BUILD_CUDA_LIB)
|
||||
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-DFLANN_USE_CUDA")
|
||||
@@ -25,45 +24,9 @@ if (BUILD_CUDA_LIB)
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
@@ -25,75 +19,93 @@ if (BUILD_CUDA_LIB)
|
||||
else()
|
||||
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};" )
|
||||
endif()
|
||||
- cuda_add_library(flann_cuda_s STATIC ${CU_SOURCES})
|
||||
- set_property(TARGET flann_cuda_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC)
|
||||
-endif()
|
||||
-
|
||||
endif()
|
||||
|
||||
-if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
|
||||
- add_library(flann_cpp SHARED "")
|
||||
- set_target_properties(flann_cpp PROPERTIES LINKER_LANGUAGE CXX)
|
||||
- target_link_libraries(flann_cpp -Wl,-whole-archive flann_cpp_s -Wl,-no-whole-archive)
|
||||
-
|
||||
+if(BUILD_STATIC)
|
||||
+ add_library(flann_cpp_s STATIC ${CPP_SOURCES})
|
||||
+ target_link_libraries(flann_cpp_s PUBLIC lz4::lz4)
|
||||
+ set_property(TARGET flann_cpp_s PROPERTY OUTPUT_NAME flann_cpp)
|
||||
+ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
||||
+ set_target_properties(flann_cpp_s PROPERTIES COMPILE_FLAGS -fPIC)
|
||||
+ endif()
|
||||
+
|
||||
+ if (BUILD_CUDA_LIB)
|
||||
+ cuda_add_library(flann_cuda_s STATIC ${CU_SOURCES})
|
||||
+ target_link_libraries(flann_cuda_s lz4::lz4)
|
||||
+ set_property(TARGET flann_cuda_s PROPERTY OUTPUT_NAME flann_cuda)
|
||||
+ set_property(TARGET flann_cpp_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC FLANN_USE_CUDA)
|
||||
+ endif()
|
||||
+endif()
|
||||
|
||||
- if (BUILD_CUDA_LIB)
|
||||
- cuda_add_library(flann_cuda SHARED "")
|
||||
- set_target_properties(flann_cuda PROPERTIES LINKER_LANGUAGE CXX)
|
||||
+if(BUILD_DYNAMIC)
|
||||
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
|
||||
+ add_library(flann_cpp SHARED ${CPP_SOURCES})
|
||||
+ set_target_properties(flann_cpp PROPERTIES LINKER_LANGUAGE CXX)
|
||||
+ target_link_libraries(flann_cpp PUBLIC lz4::lz4)
|
||||
+ if (BUILD_CUDA_LIB)
|
||||
+ cuda_add_library(flann_cuda SHARED ${CU_SOURCES})
|
||||
set_target_properties(flann_cuda PROPERTIES LINKER_LANGUAGE CXX)
|
||||
- target_link_libraries(flann_cuda -Wl,-whole-archive flann_cuda_s -Wl,-no-whole-archive)
|
||||
- set_property(TARGET flann_cpp_s PROPERTY COMPILE_DEFINITIONS FLANN_USE_CUDA)
|
||||
- # target_link_libraries(flann_cuda cudpp_x86_64)
|
||||
@ -129,7 +122,7 @@ index b421abb..78f9a64 100644
|
||||
- set_target_properties(flann_cpp PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS YES)
|
||||
- if (BUILD_CUDA_LIB)
|
||||
- cuda_add_library(flann_cuda SHARED ${CPP_SOURCES})
|
||||
- set_property(TARGET flann_cpp PROPERTY COMPILE_DEFINITIONS FLANN_USE_CUDA)
|
||||
set_property(TARGET flann_cpp PROPERTY COMPILE_DEFINITIONS FLANN_USE_CUDA)
|
||||
- endif()
|
||||
-endif()
|
||||
-
|
||||
@ -145,64 +138,139 @@ index b421abb..78f9a64 100644
|
||||
- SOVERSION ${FLANN_SOVERSION}
|
||||
- DEFINE_SYMBOL FLANN_EXPORTS
|
||||
- )
|
||||
+ cuda_add_library(flann_cuda STATIC ${CU_SOURCES})
|
||||
+ set_property(TARGET flann_cuda PROPERTY COMPILE_DEFINITIONS FLANN_STATIC)
|
||||
+ set_property(TARGET flann_cpp PROPERTY COMPILE_DEFINITIONS FLANN_USE_CUDA)
|
||||
+ endif()
|
||||
+ else()
|
||||
+ add_library(flann_cpp SHARED ${CPP_SOURCES})
|
||||
+ target_link_libraries(flann_cpp PUBLIC lz4::lz4)
|
||||
+ # export lz4 headers, so that MSVC to creates flann_cpp.lib
|
||||
+ set_target_properties(flann_cpp PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS YES)
|
||||
+ if (BUILD_CUDA_LIB)
|
||||
+ cuda_add_library(flann_cuda SHARED ${CU_SOURCES})
|
||||
+ target_link_libraries(flann_cuda lz4::lz4)
|
||||
+ set_property(TARGET flann_cpp PROPERTY COMPILE_DEFINITIONS FLANN_USE_CUDA)
|
||||
+ endif()
|
||||
+ endif()
|
||||
+
|
||||
+ set_target_properties(flann_cpp PROPERTIES
|
||||
+ VERSION ${FLANN_VERSION}
|
||||
+ SOVERSION ${FLANN_SOVERSION}
|
||||
+ DEFINE_SYMBOL FLANN_EXPORTS
|
||||
+ )
|
||||
+
|
||||
+ if (BUILD_CUDA_LIB)
|
||||
+ set_target_properties(flann_cuda PROPERTIES
|
||||
+ VERSION ${FLANN_VERSION}
|
||||
+ SOVERSION ${FLANN_SOVERSION}
|
||||
+ DEFINE_SYMBOL FLANN_EXPORTS
|
||||
+ )
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
-
|
||||
if (USE_MPI AND HDF5_IS_PARALLEL)
|
||||
- add_executable(flann_mpi_server flann/mpi/flann_mpi_server.cpp)
|
||||
- target_link_libraries(flann_mpi_server flann_cpp ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${Boost_LIBRARIES})
|
||||
+ if(BUILD_DYNAMIC)
|
||||
+ add_executable(flann_mpi_server flann/mpi/flann_mpi_server.cpp)
|
||||
+ target_link_libraries(flann_mpi_server flann_cpp ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${Boost_LIBRARIES})
|
||||
|
||||
@@ -80,6 +43,7 @@ endif()
|
||||
- add_executable(flann_mpi_client flann/mpi/flann_mpi_client.cpp)
|
||||
- target_link_libraries(flann_mpi_client flann_cpp ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${Boost_LIBRARIES})
|
||||
+ add_executable(flann_mpi_client flann/mpi/flann_mpi_client.cpp)
|
||||
+ target_link_libraries(flann_mpi_client flann_cpp ${HDF5_LIBRARIES} ${MPI_LIBRARIES} ${Boost_LIBRARIES})
|
||||
|
||||
- install (TARGETS flann_mpi_client flann_mpi_server
|
||||
- DESTINATION bin)
|
||||
+ install (TARGETS flann_mpi_client flann_mpi_server
|
||||
+ DESTINATION bin)
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
-
|
||||
if (BUILD_C_BINDINGS)
|
||||
+ if (0)
|
||||
+ if(BUILD_STATIC)
|
||||
add_library(flann_s STATIC ${C_SOURCES})
|
||||
target_link_libraries(flann_s -Wl,--push-state,--no-as-needed ${LZ4_LIBRARIES} -Wl,--pop-state)
|
||||
- target_link_libraries(flann_s -Wl,--push-state,--no-as-needed ${LZ4_LIBRARIES} -Wl,--pop-state)
|
||||
+ target_link_libraries(flann_s PUBLIC lz4::lz4)
|
||||
+ set_property(TARGET flann_s PROPERTY OUTPUT_NAME flann)
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
||||
@@ -105,6 +69,10 @@ if (BUILD_C_BINDINGS)
|
||||
set_target_properties(flann_s PROPERTIES COMPILE_FLAGS -fPIC)
|
||||
endif()
|
||||
set_property(TARGET flann_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC)
|
||||
-
|
||||
+ endif()
|
||||
+
|
||||
+ if(BUILD_DYNAMIC)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
|
||||
- add_library(flann SHARED "")
|
||||
+ add_library(flann SHARED ${C_SOURCES})
|
||||
+ target_link_libraries(flann PUBLIC lz4::lz4)
|
||||
set_target_properties(flann PROPERTIES LINKER_LANGUAGE CXX)
|
||||
- target_link_libraries(flann -Wl,-whole-archive flann_s -Wl,-no-whole-archive)
|
||||
else()
|
||||
add_library(flann SHARED ${C_SOURCES})
|
||||
- target_link_libraries(flann -Wl,--push-state,--no-as-needed ${LZ4_LIBRARIES} -Wl,--pop-state)
|
||||
+ target_link_libraries(flann PUBLIC lz4::lz4)
|
||||
|
||||
if(MINGW AND OPENMP_FOUND)
|
||||
target_link_libraries(flann gomp)
|
||||
@@ -105,20 +117,31 @@ if (BUILD_C_BINDINGS)
|
||||
SOVERSION ${FLANN_SOVERSION}
|
||||
DEFINE_SYMBOL FLANN_EXPORTS
|
||||
)
|
||||
+ endif()
|
||||
+ add_library(flann STATIC ${C_SOURCES})
|
||||
+ target_link_libraries(flann PRIVATE lz4::lz4)
|
||||
+ set_property(TARGET flann PROPERTY COMPILE_DEFINITIONS FLANN_STATIC)
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
@@ -118,9 +86,9 @@ endif(WIN32)
|
||||
-if (BUILD_C_BINDINGS AND BUILD_MATLAB_BINDINGS)
|
||||
- install (
|
||||
- TARGETS flann
|
||||
- RUNTIME DESTINATION share/flann/matlab
|
||||
- )
|
||||
-endif()
|
||||
+ if (BUILD_C_BINDINGS AND BUILD_MATLAB_BINDINGS)
|
||||
+ install (
|
||||
+ TARGETS flann
|
||||
+ RUNTIME DESTINATION share/flann/matlab
|
||||
+ )
|
||||
+ endif()
|
||||
endif(WIN32)
|
||||
|
||||
+if(BUILD_STATIC)
|
||||
+ list(APPEND FLANN_TARGETS_CPP "flann_cpp_s")
|
||||
+ list(APPEND FLANN_TARGETS_C "flann_s")
|
||||
+ list(APPEND FLANN_TARGETS_CUDA "flann_cuda_s")
|
||||
+endif()
|
||||
+if(BUILD_DYNAMIC)
|
||||
+ list(APPEND FLANN_TARGETS_CPP "flann_cpp")
|
||||
+ list(APPEND FLANN_TARGETS_C "flann")
|
||||
+ list(APPEND FLANN_TARGETS_CUDA "flann_cuda")
|
||||
+endif()
|
||||
|
||||
install (
|
||||
- TARGETS flann_cpp flann_cpp_s
|
||||
+ TARGETS flann_cpp
|
||||
+ TARGETS ${FLANN_TARGETS_CPP}
|
||||
EXPORT ${targets_export_name}
|
||||
- INCLUDES DESTINATION include
|
||||
+ INCLUDES DESTINATION ${FLANN_INCLUDE_INSTALL_DIR}
|
||||
INCLUDES DESTINATION include
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION ${FLANN_LIB_INSTALL_DIR}
|
||||
ARCHIVE DESTINATION ${FLANN_LIB_INSTALL_DIR}
|
||||
@@ -128,9 +96,9 @@ install (
|
||||
@@ -128,7 +151,7 @@ install (
|
||||
|
||||
if (BUILD_CUDA_LIB)
|
||||
install (
|
||||
- TARGETS flann_cuda flann_cuda_s
|
||||
+ TARGETS flann_cuda
|
||||
+ TARGETS ${FLANN_TARGETS_CUDA}
|
||||
EXPORT ${targets_export_name}
|
||||
- INCLUDES DESTINATION include
|
||||
+ INCLUDES DESTINATION ${FLANN_INCLUDE_INSTALL_DIR}
|
||||
INCLUDES DESTINATION include
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION ${FLANN_LIB_INSTALL_DIR}
|
||||
ARCHIVE DESTINATION ${FLANN_LIB_INSTALL_DIR}
|
||||
@@ -139,9 +107,9 @@ endif()
|
||||
@@ -139,7 +162,7 @@ endif()
|
||||
|
||||
if (BUILD_C_BINDINGS)
|
||||
install (
|
||||
- TARGETS flann flann_s
|
||||
+ TARGETS flann
|
||||
+ TARGETS ${FLANN_TARGETS_C}
|
||||
EXPORT ${targets_export_name}
|
||||
- INCLUDES DESTINATION include
|
||||
+ INCLUDES DESTINATION ${FLANN_INCLUDE_INSTALL_DIR}
|
||||
INCLUDES DESTINATION include
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION ${FLANN_LIB_INSTALL_DIR}
|
||||
ARCHIVE DESTINATION ${FLANN_LIB_INSTALL_DIR}
|
||||
--
|
||||
2.29.2.windows.2
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
#the port uses inside the CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS, which is discouraged by vcpkg.
|
||||
#Since it's its author choice, we should not disallow it, but unfortunately looks like it's broken, so we block it anyway...
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO mariusmuja/flann
|
||||
REPO flann-lib/flann
|
||||
REF 1d04523268c388dabf1c0865d69e1b638c8c7d9d
|
||||
SHA512 61e322222c2daa0b9677095e5ca231cba7c305ce754ad8e659eee350111c1e04351181c3af04e45ab6e5c9edea49c7b9ec6499bb0dbc080b87af36eb11c6ef7c
|
||||
HEAD_REF master
|
||||
@ -14,14 +12,22 @@ vcpkg_from_github(
|
||||
)
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
hdf5 WITH_HDF5
|
||||
FEATURES
|
||||
hdf5 WITH_HDF5
|
||||
cuda WITH_CUDA
|
||||
)
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" FLANN_BUILD_STATIC)
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" FLANN_BUILD_DYNAMIC)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
DISABLE_PARALLEL_CONFIGURE
|
||||
OPTIONS ${FEATURE_OPTIONS}
|
||||
-DBUILD_DYNAMIC=${FLANN_BUILD_DYNAMIC}
|
||||
-DBUILD_STATIC=${FLANN_BUILD_STATIC}
|
||||
-DBUILD_CUDA_LIB=${WITH_CUDA}
|
||||
-DBUILD_EXAMPLES=OFF
|
||||
-DBUILD_TESTS=OFF
|
||||
-DBUILD_DOC=OFF
|
||||
|
24
ports/flann/vcpkg.json
Normal file
24
ports/flann/vcpkg.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "flann",
|
||||
"version-date": "2019-04-07",
|
||||
"port-version": 2,
|
||||
"description": "Fast Library for Approximate Nearest Neighbors",
|
||||
"homepage": "https://github.com/mariusmuja/flann",
|
||||
"dependencies": [
|
||||
"lz4"
|
||||
],
|
||||
"features": {
|
||||
"cuda": {
|
||||
"description": "CUDA support for FLANN",
|
||||
"dependencies": [
|
||||
"cuda"
|
||||
]
|
||||
},
|
||||
"hdf5": {
|
||||
"description": "Build with hdf5",
|
||||
"dependencies": [
|
||||
"hdf5"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
Source: openmvg
|
||||
Version: 1.6
|
||||
Port-Version: 1
|
||||
Description: open Multiple View Geometry library. Basis for 3D computer vision and Structure from Motion.
|
||||
Build-Depends: coinutils, clp, osi, liblemon, flann, eigen3, ceres[suitesparse,cxsparse], cereal, libjpeg-turbo, tiff, libpng, zlib, vlfeat
|
||||
|
||||
Feature: opencv
|
||||
Build-Depends: opencv[contrib]
|
||||
Description: opencv support for openmvg
|
||||
|
||||
Feature: openmp
|
||||
Description: openmp support for openmvg
|
||||
|
||||
Feature: software
|
||||
Build-Depends: qt5-base, qt5-svg
|
||||
Description: build openMVG tools
|
@ -507,7 +507,7 @@ index 5fcd972..b21ea7b 100644
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
+find_package(flann REQUIRED)
|
||||
+find_package(flann CONFIG REQUIRED)
|
||||
|
||||
set_source_files_properties(${matching_files_cpp} PROPERTIES LANGUAGE CXX)
|
||||
add_library(openMVG_matching
|
||||
@ -520,7 +520,7 @@ index 5fcd972..b21ea7b 100644
|
||||
target_link_libraries(openMVG_matching
|
||||
PUBLIC
|
||||
- ${FLANN_LIBRARIES}
|
||||
+ flann::flann
|
||||
+ $<IF:$<TARGET_EXISTS:flann::flann_s>,flann::flann_s,flann::flann>
|
||||
)
|
||||
endif()
|
||||
set_target_properties(openMVG_matching PROPERTIES SOVERSION ${OPENMVG_VERSION_MAJOR} VERSION "${OPENMVG_VERSION_MAJOR}.${OPENMVG_VERSION_MINOR}")
|
||||
|
50
ports/openmvg/vcpkg.json
Normal file
50
ports/openmvg/vcpkg.json
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "openmvg",
|
||||
"version-string": "1.6",
|
||||
"port-version": 2,
|
||||
"description": "open Multiple View Geometry library. Basis for 3D computer vision and Structure from Motion.",
|
||||
"dependencies": [
|
||||
"cereal",
|
||||
{
|
||||
"name": "ceres",
|
||||
"features": [
|
||||
"cxsparse",
|
||||
"suitesparse"
|
||||
]
|
||||
},
|
||||
"clp",
|
||||
"coinutils",
|
||||
"eigen3",
|
||||
"flann",
|
||||
"libjpeg-turbo",
|
||||
"liblemon",
|
||||
"libpng",
|
||||
"osi",
|
||||
"tiff",
|
||||
"vlfeat",
|
||||
"zlib"
|
||||
],
|
||||
"features": {
|
||||
"opencv": {
|
||||
"description": "opencv support for openmvg",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "opencv",
|
||||
"features": [
|
||||
"contrib"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"openmp": {
|
||||
"description": "openmp support for openmvg"
|
||||
},
|
||||
"software": {
|
||||
"description": "build openMVG tools",
|
||||
"dependencies": [
|
||||
"qt5-base",
|
||||
"qt5-svg"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,19 @@
|
||||
From 8a7a883b51e18645974921b1bfe9d3b6ef3c626c Mon Sep 17 00:00:00 2001
|
||||
From: Lars Glud <larshg@gmail.com>
|
||||
Date: Fri, 19 Mar 2021 22:22:57 +0100
|
||||
Subject: [PATCH] Add gcc-version-check
|
||||
|
||||
---
|
||||
CMakeLists.txt | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 6c452ce..2c50b8d 100644
|
||||
index e5aa7f40a..1e346a316 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -303,6 +303,10 @@ set(FLANN_USE_STATIC ON)
|
||||
@@ -304,6 +304,10 @@ if(NOT PCL_SHARED_LIBS OR ((WIN32 AND NOT MINGW) AND NOT PCL_BUILD_WITH_FLANN_DY
|
||||
endif()
|
||||
find_package(FLANN 1.7.0 REQUIRED)
|
||||
find_package(lz4)
|
||||
|
||||
+if(UNIX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
||||
+ set (CMAKE_CXX_STANDARD 17)
|
||||
@ -13,3 +22,6 @@ index 6c452ce..2c50b8d 100644
|
||||
# libusb-1.0
|
||||
option(WITH_LIBUSB "Build USB RGBD-Camera drivers" TRUE)
|
||||
if(WITH_LIBUSB)
|
||||
--
|
||||
2.29.2.windows.2
|
||||
|
||||
|
@ -7,7 +7,6 @@ vcpkg_from_github(
|
||||
PATCHES
|
||||
pcl_utils.patch
|
||||
pcl_config.patch
|
||||
use_flann_targets.patch
|
||||
boost-1.70.patch
|
||||
fix-link-libpng.patch
|
||||
remove-broken-targets.patch
|
||||
@ -17,9 +16,7 @@ vcpkg_from_github(
|
||||
fix-find-qhull.patch
|
||||
)
|
||||
|
||||
file(REMOVE ${SOURCE_PATH}/cmake/Modules/FindFLANN.cmake)
|
||||
file(REMOVE ${SOURCE_PATH}/cmake/Modules/FindQhull.cmake)
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PCL_SHARED_LIBS)
|
||||
|
||||
if ("cuda" IN_LIST FEATURES AND VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
|
||||
|
@ -1,97 +0,0 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 93a6448..b24f681 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -302,10 +302,9 @@ find_package(Eigen 3.1 REQUIRED)
|
||||
include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
|
||||
|
||||
# FLANN (required)
|
||||
-if(NOT PCL_SHARED_LIBS OR ((WIN32 AND NOT MINGW) AND NOT PCL_BUILD_WITH_FLANN_DYNAMIC_LINKING_WIN32))
|
||||
- set(FLANN_USE_STATIC ON)
|
||||
-endif()
|
||||
+set(FLANN_USE_STATIC ON)
|
||||
find_package(FLANN 1.7.0 REQUIRED)
|
||||
+find_package(lz4)
|
||||
|
||||
# libusb-1.0
|
||||
option(WITH_LIBUSB "Build USB RGBD-Camera drivers" TRUE)
|
||||
diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in
|
||||
index 79077fb..042467b 100644
|
||||
--- a/PCLConfig.cmake.in
|
||||
+++ b/PCLConfig.cmake.in
|
||||
@@ -88,11 +88,6 @@ endmacro()
|
||||
|
||||
### ---[ 3rd party libraries
|
||||
macro(find_boost)
|
||||
- if(PCL_ALL_IN_ONE_INSTALLER)
|
||||
- set(BOOST_ROOT "${PCL_ROOT}/3rdParty/Boost")
|
||||
- elseif(NOT BOOST_INCLUDEDIR)
|
||||
- set(BOOST_INCLUDEDIR "@Boost_INCLUDE_DIR@")
|
||||
- endif()
|
||||
# use static Boost in Windows
|
||||
if(WIN32)
|
||||
set(Boost_USE_STATIC_LIBS @Boost_USE_STATIC_LIBS@)
|
||||
@@ -667,8 +662,8 @@ pcl_remove_duplicate_libraries(PCL_COMPONENTS PCL_LIBRARIES)
|
||||
|
||||
# Add 3rd party libraries, as user code might include our .HPP implementations
|
||||
list(APPEND PCL_LIBRARIES ${BOOST_LIBRARIES} ${QHULL_LIBRARIES} ${OPENNI_LIBRARIES} ${OPENNI2_LIBRARIES} ${ENSENSO_LIBRARIES} ${davidSDK_LIBRARIES} ${DSSDK_LIBRARIES} ${RSSDK_LIBRARIES} ${RSSDK2_LIBRARIES} ${VTK_LIBRARIES})
|
||||
-if (TARGET FLANN::FLANN)
|
||||
- list(APPEND PCL_LIBRARIES FLANN::FLANN)
|
||||
+if (TARGET flann::flann_cpp)
|
||||
+ list(APPEND PCL_LIBRARIES flann::flann_cpp)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(PCL DEFAULT_MSG PCL_LIBRARIES PCL_INCLUDE_DIRS)
|
||||
diff --git a/doc/tutorials/content/sources/vfh_recognition/CMakeLists.txt b/doc/tutorials/content/sources/vfh_recognition/CMakeLists.txt
|
||||
index 7d25d3f..18227a6 100644
|
||||
--- a/doc/tutorials/content/sources/vfh_recognition/CMakeLists.txt
|
||||
+++ b/doc/tutorials/content/sources/vfh_recognition/CMakeLists.txt
|
||||
@@ -16,7 +16,7 @@ include_directories(SYSTEM
|
||||
|
||||
add_executable(build_tree build_tree.cpp)
|
||||
target_link_libraries(build_tree ${PCL_LIBRARIES} ${Boost_LIBRARIES}
|
||||
- FLANN::FLANN ${HDF5_LIBRARIES})
|
||||
+ flann::flann_cpp ${HDF5_LIBRARIES})
|
||||
|
||||
add_executable(nearest_neighbors nearest_neighbors.cpp)
|
||||
-target_link_libraries(nearest_neighbors ${PCL_LIBRARIES} ${Boost_LIBRARIES} FLANN::FLANN ${HDF5_LIBRARIES})
|
||||
+target_link_libraries(nearest_neighbors ${PCL_LIBRARIES} ${Boost_LIBRARIES} flann::flann_cpp ${HDF5_LIBRARIES})
|
||||
diff --git a/kdtree/CMakeLists.txt b/kdtree/CMakeLists.txt
|
||||
index 826e902..f714130 100644
|
||||
--- a/kdtree/CMakeLists.txt
|
||||
+++ b/kdtree/CMakeLists.txt
|
||||
@@ -31,7 +31,7 @@ set(impl_incs
|
||||
set(LIB_NAME "pcl_${SUBSYS_NAME}")
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} SOURCES ${srcs} ${incs} ${impl_incs})
|
||||
-target_link_libraries("${LIB_NAME}" pcl_common FLANN::FLANN)
|
||||
+target_link_libraries("${LIB_NAME}" pcl_common flann::flann_cpp)
|
||||
set(EXT_DEPS flann)
|
||||
PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS} EXT_DEPS ${EXT_DEPS})
|
||||
|
||||
diff --git a/search/CMakeLists.txt b/search/CMakeLists.txt
|
||||
index 46f4632..67c5e53 100644
|
||||
--- a/search/CMakeLists.txt
|
||||
+++ b/search/CMakeLists.txt
|
||||
@@ -41,7 +41,7 @@ set(impl_incs
|
||||
set(LIB_NAME "pcl_${SUBSYS_NAME}")
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} SOURCES ${srcs} ${incs} ${impl_incs})
|
||||
-target_link_libraries("${LIB_NAME}" pcl_common FLANN::FLANN pcl_octree pcl_kdtree)
|
||||
+target_link_libraries("${LIB_NAME}" pcl_common flann::flann_cpp pcl_octree pcl_kdtree)
|
||||
list(APPEND EXT_DEPS flann)
|
||||
PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS})
|
||||
|
||||
diff --git a/test/features/CMakeLists.txt b/test/features/CMakeLists.txt
|
||||
index 9775415..bf582ac 100644
|
||||
--- a/test/features/CMakeLists.txt
|
||||
+++ b/test/features/CMakeLists.txt
|
||||
@@ -91,7 +91,7 @@ if(BUILD_io)
|
||||
ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd")
|
||||
PCL_ADD_TEST(features_narf test_narf
|
||||
FILES test_narf.cpp
|
||||
- LINK_WITH pcl_gtest pcl_features FLANN::FLANN)
|
||||
+ LINK_WITH pcl_gtest pcl_features flann::flann_cpp)
|
||||
PCL_ADD_TEST(a_ii_normals_test test_ii_normals
|
||||
FILES test_ii_normals.cpp
|
||||
LINK_WITH pcl_gtest pcl_io pcl_features
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "pcl",
|
||||
"version": "1.11.1",
|
||||
"port-version": 3,
|
||||
"port-version": 4,
|
||||
"description": "Point Cloud Library (PCL) is open source library for 2D/3D image and point cloud processing.",
|
||||
"homepage": "https://github.com/PointCloudLibrary/pcl",
|
||||
"supports": "!(arm64 & windows)",
|
||||
|
@ -1994,7 +1994,7 @@
|
||||
},
|
||||
"flann": {
|
||||
"baseline": "2019-04-07",
|
||||
"port-version": 1
|
||||
"port-version": 2
|
||||
},
|
||||
"flashlight-cpu": {
|
||||
"baseline": "0.3",
|
||||
@ -4542,7 +4542,7 @@
|
||||
},
|
||||
"openmvg": {
|
||||
"baseline": "1.6",
|
||||
"port-version": 1
|
||||
"port-version": 2
|
||||
},
|
||||
"openmvs": {
|
||||
"baseline": "1.1",
|
||||
@ -4714,7 +4714,7 @@
|
||||
},
|
||||
"pcl": {
|
||||
"baseline": "1.11.1",
|
||||
"port-version": 3
|
||||
"port-version": 4
|
||||
},
|
||||
"pcre": {
|
||||
"baseline": "8.44",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "960ba6bf0c3bb6c11b5a4a9bf413a21947927e08",
|
||||
"version-date": "2019-04-07",
|
||||
"port-version": 2
|
||||
},
|
||||
{
|
||||
"git-tree": "a5855028e07259d339cb5a39c45fe92e679aa82b",
|
||||
"version-string": "2019-04-07",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "f62103b28735c9e72b9a866e6530c52629e77295",
|
||||
"version-string": "1.6",
|
||||
"port-version": 2
|
||||
},
|
||||
{
|
||||
"git-tree": "77b221e020b37ab1119a01536d5b4fe6836af4fd",
|
||||
"version-string": "1.6",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "7d8ce8bc561fa2b928b9a5075c4f8659c86b5906",
|
||||
"version": "1.11.1",
|
||||
"port-version": 4
|
||||
},
|
||||
{
|
||||
"git-tree": "26e422f1ac4af5ffcce30091a069b74e204f244e",
|
||||
"version": "1.11.1",
|
||||
|
Loading…
Reference in New Issue
Block a user