diff options
| author | Stefano Sinigardi <stesinigardi@hotmail.com> | 2019-05-19 07:58:03 +0200 |
|---|---|---|
| committer | Victor Romero <romerosanchezv@gmail.com> | 2019-05-18 22:58:03 -0700 |
| commit | 69e86fd2013e0c495cc4e61500e794548b62ae03 (patch) | |
| tree | 622efdfd61d25e6105751e316b033e8ff4bcd804 /ports/flann/fix_targets.patch | |
| parent | 77af264118522788e24e463309220f97dcff0a79 (diff) | |
| download | vcpkg-69e86fd2013e0c495cc4e61500e794548b62ae03.tar.gz vcpkg-69e86fd2013e0c495cc4e61500e794548b62ae03.zip | |
[lz4, flann] port patches from #5169 (#6294)
* [lz4, flann] port patches from #5169
* [lz4] use vcpkg_fixup_cmake_targets
* [flann] improve target handling
* [lz4] remove unnecessary debug message
* [openmvg] many many fixes to build it on windows
* [pcl] use official FLANN cmake config file instead of custom module
* [pcl] fix patch for flann targets
* [pcl] Bump CONTROL version
Diffstat (limited to 'ports/flann/fix_targets.patch')
| -rw-r--r-- | ports/flann/fix_targets.patch | 243 |
1 files changed, 243 insertions, 0 deletions
diff --git a/ports/flann/fix_targets.patch b/ports/flann/fix_targets.patch new file mode 100644 index 000000000..b9ebe7cb7 --- /dev/null +++ b/ports/flann/fix_targets.patch @@ -0,0 +1,243 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f4b94d2..e55195b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -146,9 +146,6 @@ if (BUILD_CUDA_LIB) + endif(CUDA_FOUND) + endif(BUILD_CUDA_LIB) + +-find_package(PkgConfig REQUIRED) +-pkg_check_modules(LZ4 REQUIRED liblz4) +- + #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..2c95b6e 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) +diff --git a/cmake/flann_utils.cmake b/cmake/flann_utils.cmake +index afe4742..0cf8289 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) + + +@@ -27,7 +26,7 @@ macro(find_hdf5) + set( HDF5_IS_PARALLEL FALSE ) + foreach( _dir ${HDF5_INCLUDE_DIRS} ) + if( EXISTS "${_dir}/H5pubconf.h" ) +- file( STRINGS "${_dir}/H5pubconf.h" ++ file( STRINGS "${_dir}/H5pubconf.h" + HDF5_HAVE_PARALLEL_DEFINE + REGEX "HAVE_PARALLEL 1" ) + if( HDF5_HAVE_PARALLEL_DEFINE ) +@@ -106,7 +105,7 @@ endmacro(flann_add_pyunit) + + macro(flann_download_test_data _name _md5) + string(REPLACE "/" "_" _dataset_name dataset_${_name}) +- ++ + add_custom_target(${_dataset_name} + COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/bin/download_checkmd5.py http://people.cs.ubc.ca/~mariusm/uploads/FLANN/datasets/${_name} ${TEST_OUTPUT_PATH}/${_name} ${_md5} + VERBATIM) +diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt +index 3f4655a..918b94a 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) +@@ -36,7 +37,3 @@ if (HDF5_FOUND) + else() + message("hdf5 library not found, not compiling flann_example.cpp") + endif() +- +- +- +- +diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt +index b30f3da..1535d37 100644 +--- a/src/cpp/CMakeLists.txt ++++ b/src/cpp/CMakeLists.txt +@@ -8,12 +8,13 @@ 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,48 +26,11 @@ 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() + +- + 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}) +@@ -80,31 +44,9 @@ endif() + + + if (BUILD_C_BINDINGS) +- add_library(flann_s STATIC ${C_SOURCES}) +- target_link_libraries(flann_cpp -Wl,--push-state,--no-as-needed ${LZ4_LIBRARIES} -Wl,--pop-state) +- if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) +- set_target_properties(flann_s PROPERTIES COMPILE_FLAGS -fPIC) +- endif() +- set_property(TARGET flann_s PROPERTY COMPILE_DEFINITIONS FLANN_STATIC) +- +- if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC) +- add_library(flann SHARED "") +- 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_cpp -Wl,--push-state,--no-as-needed ${LZ4_LIBRARIES} -Wl,--pop-state) +- +- if(MINGW AND OPENMP_FOUND) +- target_link_libraries(flann gomp) +- endif() +- endif() +- +- set_target_properties(flann PROPERTIES +- VERSION ${FLANN_VERSION} +- SOVERSION ${FLANN_SOVERSION} +- DEFINE_SYMBOL FLANN_EXPORTS +- ) ++ 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 +60,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 +70,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,7 +81,7 @@ endif() + + if (BUILD_C_BINDINGS) + install ( +- TARGETS flann flann_s ++ TARGETS flann + EXPORT ${targets_export_name} + INCLUDES DESTINATION include + RUNTIME DESTINATION bin |
