aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzi-m <53815290+zi-m@users.noreply.github.com>2019-08-20 19:33:40 +0200
committerCurtis J Bezault <curtbezault@gmail.com>2019-08-20 10:33:40 -0700
commit87da3884314cf24cd1c25f4ac5ab3bcf8554210a (patch)
tree876006586325a86c5710366a1e84e111f9992fde
parent573bebe6b76d6efc88bf3652ca9b1e62f0f3f85b (diff)
downloadvcpkg-87da3884314cf24cd1c25f4ac5ab3bcf8554210a.tar.gz
vcpkg-87da3884314cf24cd1c25f4ac5ab3bcf8554210a.zip
[sparsehash] Add new port (#7772)
* sparsehash * Update portfile.cmake
-rw-r--r--ports/sparsehash/00001-windows-use-std.patch17
-rw-r--r--ports/sparsehash/CONTROL4
-rw-r--r--ports/sparsehash/Config.cmake.in10
-rw-r--r--ports/sparsehash/portfile.cmake41
-rw-r--r--ports/sparsehash/usage4
5 files changed, 76 insertions, 0 deletions
diff --git a/ports/sparsehash/00001-windows-use-std.patch b/ports/sparsehash/00001-windows-use-std.patch
new file mode 100644
index 000000000..69d1966f8
--- /dev/null
+++ b/ports/sparsehash/00001-windows-use-std.patch
@@ -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
diff --git a/ports/sparsehash/CONTROL b/ports/sparsehash/CONTROL
new file mode 100644
index 000000000..04c1d756b
--- /dev/null
+++ b/ports/sparsehash/CONTROL
@@ -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.
diff --git a/ports/sparsehash/Config.cmake.in b/ports/sparsehash/Config.cmake.in
new file mode 100644
index 000000000..07739ddb6
--- /dev/null
+++ b/ports/sparsehash/Config.cmake.in
@@ -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)
diff --git a/ports/sparsehash/portfile.cmake b/ports/sparsehash/portfile.cmake
new file mode 100644
index 000000000..1dcccda82
--- /dev/null
+++ b/ports/sparsehash/portfile.cmake
@@ -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)
diff --git a/ports/sparsehash/usage b/ports/sparsehash/usage
new file mode 100644
index 000000000..5222b2402
--- /dev/null
+++ b/ports/sparsehash/usage
@@ -0,0 +1,4 @@
+The package sparsehash provides CMake targets:
+
+ find_package(sparsehash CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE sparsehash::sparsehash)