Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stduuid] Add new port @1.2.2 #25115

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions ports/stduuid/fix-gsl-polyfill.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f45a7dc..039ee53 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,11 +37,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}/gsl>
- $<INSTALL_INTERFACE:include/gsl>)
- 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 ()

# Install step and imported target
diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in
index 7217b72..fb981d2 100644
--- 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
23 changes: 23 additions & 0 deletions ports/stduuid/fix-install-directory.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fffb92c..f45a7dc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,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)
@@ -44,7 +45,7 @@ if (NOT UUID_USING_CXX20_SPAN)
endif ()

# 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})
32 changes: 32 additions & 0 deletions ports/stduuid/fix-libuuid-dependency.patch
Original file line number Diff line number Diff line change
@@ -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 ()

BurningEnlightenment marked this conversation as resolved.
Show resolved Hide resolved
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 ()

40 changes: 40 additions & 0 deletions ports/stduuid/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mariusbancila/stduuid
REF v1.2.2
SHA512 30970c25992e1ba35d96e3b2fc8530466c1070b8b913b8c37e9f698f39121a5a74361e2c4db4c2ba2feddb0ce9b2f14b78c4761cdac09b89a6a0117b179b08a7
HEAD_REF master
PATCHES
fix-install-directory.patch
fix-gsl-polyfill.patch
fix-libuuid-dependency.patch
BurningEnlightenment marked this conversation as resolved.
Show resolved Hide resolved
)

# 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
${FEATURE_OPTIONS}
)
vcpkg_cmake_install()

vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib)

BurningEnlightenment marked this conversation as resolved.
Show resolved Hide resolved
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()

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
33 changes: 33 additions & 0 deletions ports/stduuid/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "stduuid",
"version": "1.2.2",
"description": "A C++17 cross-platform implementation for UUIDs",
"license": "MIT",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"gsl-span": {
ras0219-msft marked this conversation as resolved.
Show resolved Hide resolved
"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"
}
]
}
}
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6824,6 +6824,10 @@
"baseline": "2021-09-10",
"port-version": 0
},
"stduuid": {
"baseline": "1.2.2",
"port-version": 0
},
"stftpitchshift": {
"baseline": "1.4.1",
"port-version": 0
Expand Down
9 changes: 9 additions & 0 deletions versions/s-/stduuid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "bd235773c953e5636a7b9f6356437daef6e5010c",
"version": "1.2.2",
"port-version": 0
}
]
}