aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/stduuid
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/stduuid')
-rw-r--r--vcpkg/ports/stduuid/fix-gsl-polyfill.patch35
-rw-r--r--vcpkg/ports/stduuid/fix-install-directory.patch22
-rw-r--r--vcpkg/ports/stduuid/fix-libuuid-dependency.patch32
-rw-r--r--vcpkg/ports/stduuid/portfile.cmake41
-rw-r--r--vcpkg/ports/stduuid/vcpkg.json34
5 files changed, 164 insertions, 0 deletions
diff --git a/vcpkg/ports/stduuid/fix-gsl-polyfill.patch b/vcpkg/ports/stduuid/fix-gsl-polyfill.patch
new file mode 100644
index 0000000..3ae0359
--- /dev/null
+++ b/vcpkg/ports/stduuid/fix-gsl-polyfill.patch
@@ -0,0 +1,35 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -43,11 +43,11 @@ if (UUID_TIME_GENERATOR)
+ endif()
+
+ # Using span from std
+-if (NOT UUID_USING_CXX20_SPAN)
+- target_include_directories(${PROJECT_NAME} INTERFACE
+- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+- $<INSTALL_INTERFACE:include>)
+- install(DIRECTORY gsl DESTINATION include)
++if (UUID_USING_CXX20_SPAN)
++ target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_20)
++else()
++ find_package(Microsoft.GSL CONFIG REQUIRED)
++ target_link_libraries(${PROJECT_NAME} INTERFACE Microsoft.GSL::GSL)
+ endif ()
+
+ if(UUID_ENABLE_INSTALL)
+diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in
+--- a/cmake/Config.cmake.in
++++ b/cmake/Config.cmake.in
+@@ -9,6 +9,10 @@ if (@UUID_SYSTEM_GENERATOR@)
+ endif ()
+ endif ()
+
++if (NOT "@UUID_USING_CXX20_SPAN@")
++ find_dependency(Microsoft.GSL)
++endif ()
++
+ include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
+
+ check_required_components(@PROJECT_NAME@)
+\ No newline at end of file
diff --git a/vcpkg/ports/stduuid/fix-install-directory.patch b/vcpkg/ports/stduuid/fix-install-directory.patch
new file mode 100644
index 0000000..be1a12b
--- /dev/null
+++ b/vcpkg/ports/stduuid/fix-install-directory.patch
@@ -0,0 +1,22 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -18,7 +18,8 @@ option(UUID_USING_CXX20_SPAN "Using span from std instead of gsl" OFF)
+ add_library(${PROJECT_NAME} INTERFACE)
+ target_include_directories(${PROJECT_NAME} INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+- $<INSTALL_INTERFACE:include>)
++ $<INSTALL_INTERFACE:include>
++ $<INSTALL_INTERFACE:include/stduuid>)
+
+ # Using system uuid generator
+ if (UUID_SYSTEM_GENERATOR)
+@@ -52,7 +52,7 @@
+
+ if(UUID_ENABLE_INSTALL)
+ # Install step and imported target
+- install(FILES include/uuid.h DESTINATION include)
++ install(FILES include/uuid.h DESTINATION include/stduuid)
+ install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets)
+ install(EXPORT ${PROJECT_NAME}-targets
+ DESTINATION lib/cmake/${PROJECT_NAME})
diff --git a/vcpkg/ports/stduuid/fix-libuuid-dependency.patch b/vcpkg/ports/stduuid/fix-libuuid-dependency.patch
new file mode 100644
index 0000000..5913481
--- /dev/null
+++ b/vcpkg/ports/stduuid/fix-libuuid-dependency.patch
@@ -0,0 +1,32 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 039ee53..d4218a4 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -23,11 +23,8 @@ if (UUID_SYSTEM_GENERATOR)
+ find_library(CFLIB CoreFoundation REQUIRED)
+ target_link_libraries(${PROJECT_NAME} INTERFACE ${CFLIB})
+ else ()
+- find_package(Libuuid REQUIRED)
+- if (Libuuid_FOUND)
+- target_include_directories(${PROJECT_NAME} INTERFACE ${Libuuid_INCLUDE_DIRS})
+- target_link_libraries(${PROJECT_NAME} INTERFACE ${Libuuid_LIBRARIES})
+- endif ()
++ find_package(unofficial-libuuid CONFIG REQUIRED)
++ target_link_libraries(${PROJECT_NAME} INTERFACE unofficial::UUID::uuid)
+ endif ()
+ endif ()
+
+diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in
+index fb981d2..8a3c8ab 100644
+--- a/cmake/Config.cmake.in
++++ b/cmake/Config.cmake.in
+@@ -4,8 +4,7 @@ include(CMakeFindDependencyMacro)
+ if (@UUID_SYSTEM_GENERATOR@)
+ if (WIN32 OR APPLE)
+ else ()
+- list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+- find_dependency(Libuuid REQUIRED)
++ find_dependency(unofficial-libuuid CONFIG)
+ endif ()
+ endif ()
+
diff --git a/vcpkg/ports/stduuid/portfile.cmake b/vcpkg/ports/stduuid/portfile.cmake
new file mode 100644
index 0000000..696b867
--- /dev/null
+++ b/vcpkg/ports/stduuid/portfile.cmake
@@ -0,0 +1,41 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO mariusbancila/stduuid
+ REF "v${VERSION}"
+ SHA512 3d2fb21f680fb12559642d6787a5744d4f4fb48a6284bfef77537cb51f9bdbbe271b24a8c3bb1f954b4c845145f22c6d89a09e663df2f96a2e24d1d6f22fdf22
+ HEAD_REF master
+ PATCHES
+ fix-install-directory.patch
+ fix-gsl-polyfill.patch
+ fix-libuuid-dependency.patch
+)
+
+# the debug build is not necessary, because stduuid deployed files are header-only
+set(VCPKG_BUILD_TYPE release)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ system-gen UUID_SYSTEM_GENERATOR
+ INVERTED_FEATURES
+ gsl-span UUID_USING_CXX20_SPAN
+)
+
+vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DUUID_BUILD_TESTS=OFF
+ -DUUID_ENABLE_INSTALL=ON
+ ${FEATURE_OPTIONS}
+)
+vcpkg_cmake_install()
+
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")
+
+if("gsl-span" IN_LIST FEATURES)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/stduuid/uuid.h" "#ifdef __cpp_lib_span" "#if 0")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/stduuid/uuid.h" "#include <span>" "#include <gsl/span>")
+else()
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/stduuid/uuid.h" "#ifdef __cpp_lib_span" "#if 1")
+endif()
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/stduuid/vcpkg.json b/vcpkg/ports/stduuid/vcpkg.json
new file mode 100644
index 0000000..406519f
--- /dev/null
+++ b/vcpkg/ports/stduuid/vcpkg.json
@@ -0,0 +1,34 @@
+{
+ "name": "stduuid",
+ "version": "1.2.3",
+ "description": "A C++17 cross-platform implementation for UUIDs",
+ "homepage": "https://github.com/mariusbancila/stduuid",
+ "license": "MIT",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "gsl-span": {
+ "description": "Using span from gsl instead of std",
+ "dependencies": [
+ "ms-gsl"
+ ]
+ },
+ "system-gen": {
+ "description": "Enable operating system uuid generator",
+ "dependencies": [
+ {
+ "name": "libuuid",
+ "platform": "!osx & !windows"
+ }
+ ]
+ }
+ }
+}