[spatial-hash] add new port (#42197)

This commit is contained in:
Emre 2024-11-25 23:29:43 +03:00 committed by GitHub
parent 5e5d0e1cd7
commit 7b0568efbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,54 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f21fb2c..31040fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,13 +5,10 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
-add_compile_options(-Wall -Wextra)
-
option(SPATIAL_HASH_BUILD_TESTS "Build tests" ON)
-find_package(Eigen3 REQUIRED)
-find_package(PkgConfig REQUIRED)
-pkg_check_modules(glog REQUIRED IMPORTED_TARGET libglog)
+find_package(Eigen3 CONFIG REQUIRED)
+find_package(glog CONFIG REQUIRED)
add_library(
${PROJECT_NAME}
@@ -24,7 +21,7 @@ target_include_directories(
${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
-target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen PkgConfig::glog)
+target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen glog::glog)
if(SPATIAL_HASH_BUILD_TESTS)
find_package(GTest REQUIRED)
@@ -42,6 +39,7 @@ add_library(
install(TARGETS ${PROJECT_NAME} EXPORT spatial_hash-targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT spatial_hash-targets FILE spatial_hashTargets.cmake NAMESPACE spatial_hash::
diff --git a/cmake/spatial_hashConfig.cmake.in b/cmake/spatial_hashConfig.cmake.in
index ffb1450..1803838 100644
--- a/cmake/spatial_hashConfig.cmake.in
+++ b/cmake/spatial_hashConfig.cmake.in
@@ -1,9 +1,8 @@
+include(CMakeFindDependencyMacro)
get_filename_component(spatial_hash_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-find_dependency(Eigen3 REQUIRED)
-find_package(PkgConfig REQUIRED)
-pkg_check_modules(glog REQUIRED IMPORTED_TARGET libglog)
-
+find_dependency(Eigen3 CONFIG)
+find_dependency(glog CONFIG)
if(NOT TARGET spatial_hash::spatial_hash)
include("${spatial_hash_CMAKE_DIR}/spatial_hashTargets.cmake")
endif()

View File

@ -0,0 +1,28 @@
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO MIT-SPARK/Spatial-Hash
REF bf592f26d84beca96e3ddc295ee1cf5b7341dee5
SHA512 c6e0c0475f2ca9bd9b21b227874202a12191496a446e44c493d6a181636912a342c56a8742cb5597a164f108bce74ec9534e224db4fa916c76930b232c82895f
PATCHES
compatible-vcpkg-cmake.patch
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DSPATIAL_HASH_BUILD_TESTS=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(
PACKAGE_NAME spatial_hash
CONFIG_PATH lib/cmake/spatial_hash
)
vcpkg_copy_pdbs()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

View File

@ -0,0 +1,19 @@
{
"name": "spatial-hash",
"version": "1.0.0",
"description": "A minimal C++ library for spatial data structures based on voxel hashing.",
"homepage": "https://github.com/MIT-SPARK/Spatial-Hash",
"license": "BSD-3-Clause",
"dependencies": [
"eigen3",
"glog",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -8556,6 +8556,10 @@
"baseline": "1.22",
"port-version": 4
},
"spatial-hash": {
"baseline": "1.0.0",
"port-version": 0
},
"spatialite-tools": {
"baseline": "5.1.0-a",
"port-version": 0

View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "74c5903f7439bd4d1b11f52fa77abe8d8eb8defd",
"version": "1.0.0",
"port-version": 0
}
]
}