mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 05:21:49 +08:00
25f628e05f
* [flann]Upgrade version to 1.9.1 and fix build error. * [flann]apply new patches. * [flann]Regenerate patches. * [flann]Combine all patches.
209 lines
7.7 KiB
Diff
209 lines
7.7 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index f4b94d2..7ff331a 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -146,8 +146,7 @@ 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)
|
|
|
|
#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
|
|
--- a/cmake/Config.cmake.in
|
|
+++ b/cmake/Config.cmake.in
|
|
@@ -3,3 +3,5 @@
|
|
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
|
|
--- 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)
|
|
file(GLOB_RECURSE CPP_SOURCES flann_cpp.cpp)
|
|
file(GLOB_RECURSE CU_SOURCES *.cu)
|
|
|
|
-add_library(flann_cpp_s STATIC ${CPP_SOURCES})
|
|
-target_link_libraries(flann_cpp_s ${LZ4_LIBRARIES})
|
|
-if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
|
- 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)
|
|
|
|
if (BUILD_CUDA_LIB)
|
|
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-DFLANN_USE_CUDA")
|
|
@@ -25,45 +24,9 @@ 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()
|
|
-
|
|
-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_CUDA_LIB)
|
|
- cuda_add_library(flann_cuda SHARED "")
|
|
- 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)
|
|
- endif()
|
|
-else()
|
|
- add_library(flann_cpp SHARED ${CPP_SOURCES})
|
|
- target_link_libraries(flann_cpp -Wl,--push-state,--no-as-needed ${LZ4_LIBRARIES} -Wl,--pop-state)
|
|
- # 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 ${CPP_SOURCES})
|
|
- 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
|
|
- )
|
|
+ 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()
|
|
|
|
|
|
@@ -80,6 +43,7 @@ endif()
|
|
|
|
|
|
if (BUILD_C_BINDINGS)
|
|
+ if (0)
|
|
add_library(flann_s STATIC ${C_SOURCES})
|
|
target_link_libraries(flann_s -Wl,--push-state,--no-as-needed ${LZ4_LIBRARIES} -Wl,--pop-state)
|
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
|
|
@@ -105,6 +69,10 @@ 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()
|
|
|
|
if(WIN32)
|
|
@@ -118,9 +86,9 @@ endif(WIN32)
|
|
|
|
|
|
install (
|
|
- TARGETS flann_cpp flann_cpp_s
|
|
+ TARGETS flann_cpp
|
|
EXPORT ${targets_export_name}
|
|
- INCLUDES DESTINATION include
|
|
+ INCLUDES DESTINATION ${FLANN_INCLUDE_INSTALL_DIR}
|
|
RUNTIME DESTINATION bin
|
|
LIBRARY DESTINATION ${FLANN_LIB_INSTALL_DIR}
|
|
ARCHIVE DESTINATION ${FLANN_LIB_INSTALL_DIR}
|
|
@@ -128,9 +96,9 @@ install (
|
|
|
|
if (BUILD_CUDA_LIB)
|
|
install (
|
|
- TARGETS flann_cuda flann_cuda_s
|
|
+ TARGETS flann_cuda
|
|
EXPORT ${targets_export_name}
|
|
- INCLUDES DESTINATION include
|
|
+ INCLUDES DESTINATION ${FLANN_INCLUDE_INSTALL_DIR}
|
|
RUNTIME DESTINATION bin
|
|
LIBRARY DESTINATION ${FLANN_LIB_INSTALL_DIR}
|
|
ARCHIVE DESTINATION ${FLANN_LIB_INSTALL_DIR}
|
|
@@ -139,9 +107,9 @@ endif()
|
|
|
|
if (BUILD_C_BINDINGS)
|
|
install (
|
|
- TARGETS flann flann_s
|
|
+ TARGETS flann
|
|
EXPORT ${targets_export_name}
|
|
- INCLUDES DESTINATION include
|
|
+ INCLUDES DESTINATION ${FLANN_INCLUDE_INSTALL_DIR}
|
|
RUNTIME DESTINATION bin
|
|
LIBRARY DESTINATION ${FLANN_LIB_INSTALL_DIR}
|
|
ARCHIVE DESTINATION ${FLANN_LIB_INSTALL_DIR}
|