[sparsehash] Add new port (#7772)

* sparsehash

* Update portfile.cmake
This commit is contained in:
zi-m 2019-08-20 19:33:40 +02:00 committed by Curtis J Bezault
parent 573bebe6b7
commit 87da388431
5 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,17 @@
diff --git a/src/windows/sparsehash/internal/sparseconfig.h b/src/windows/sparsehash/internal/sparseconfig.h
index 3091559..f96e08c 100644
--- a/src/windows/sparsehash/internal/sparseconfig.h
+++ b/src/windows/sparsehash/internal/sparseconfig.h
@@ -7,10 +7,10 @@
#define GOOGLE_NAMESPACE ::google
/* the location of the header defining hash functions */
-#define HASH_FUN_H <hash_map>
+#define HASH_FUN_H <unordered_map>
/* the namespace of the hash<> function */
-#define HASH_NAMESPACE stdext
+#define HASH_NAMESPACE std
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

4
ports/sparsehash/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: sparsehash
Version: 2.0.3
Homepage: https://github.com/sparsehash/sparsehash
Description: The sparsehash package consists of two hashtable implementations: sparse, which is designed to be very space efficient, and dense, which is designed to be very time efficient.

View File

@ -0,0 +1,10 @@
get_filename_component(_sparsehash_root "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_sparsehash_root "${_sparsehash_root}" PATH)
get_filename_component(_sparsehash_root "${_sparsehash_root}" PATH)
add_library(sparsehash::sparsehash INTERFACE IMPORTED)
set_target_properties(sparsehash::sparsehash
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_sparsehash_root}/include")
unset(_sparsehash_root)

View File

@ -0,0 +1,41 @@
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO sparsehash/sparsehash
REF sparsehash-2.0.3
SHA512 bb00d0acb8eba65f7da8015ea4f6bebf8bba36ed6777881960ee215f22b7be17b069c59838d210551ce67a34baccfc7b2fed603677ec53c0c32714d8e76f5d6c
HEAD_REF master
PATCHES 00001-windows-use-std.patch
)
if(VCPKG_TARGET_IS_WINDOWS)
file(COPY ${SOURCE_PATH}/src/google DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(COPY ${SOURCE_PATH}/src/sparsehash DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(COPY ${SOURCE_PATH}/src/windows/sparsehash/internal/sparseconfig.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/sparsehash/internal)
else()
vcpkg_execute_required_process(
COMMAND ${SOURCE_PATH}/configure ${OPTIONS} --prefix=${CURRENT_PACKAGES_DIR}
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME configure-${TARGET_TRIPLET}
)
vcpkg_execute_required_process(
COMMAND make -j ${VCPKG_CONCURRENCY} install
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME install-${TARGET_TRIPLET}
)
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in
${CURRENT_PACKAGES_DIR}/share/sparsehash/sparsehash-config.cmake
@ONLY
)
configure_file(${SOURCE_PATH}/COPYING ${CURRENT_PACKAGES_DIR}/share/sparsehash/copyright COPYONLY)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/sparsehash)

4
ports/sparsehash/usage Normal file
View File

@ -0,0 +1,4 @@
The package sparsehash provides CMake targets:
find_package(sparsehash CONFIG REQUIRED)
target_link_libraries(main PRIVATE sparsehash::sparsehash)