[upa-url] new port (#40964)

This commit is contained in:
Rimas Misevičius 2024-09-18 23:35:55 +03:00 committed by GitHub
parent a8dbca5f70
commit 47969b5f9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,32 @@
diff --git a/include/upa/config.h b/include/upa/config.h
index 46a5bc5..0264380 100644
--- a/include/upa/config.h
+++ b/include/upa/config.h
@@ -12,14 +12,16 @@
# endif
#endif
+#define UPA_CXX_STANDARD @UPA_CXX_STANDARD@ // NOLINT(*-macro-*)
+
// Define UPA_CPP_20 if compiler supports C++20 or later standard
-#if defined(_MSVC_LANG) ? (_MSVC_LANG >= 202002) : (__cplusplus >= 202002)
+#if UPA_CXX_STANDARD >= 20
# define UPA_CPP_20
#endif
// Define UPA_CPP_17 if compiler supports C++17 or later standard
// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
-#if defined(_MSVC_LANG) ? (_MSVC_LANG >= 201703) : (__cplusplus >= 201703)
+#if UPA_CXX_STANDARD >= 17
# define UPA_CPP_17
# define UPA_FALLTHROUGH [[fallthrough]];
# define UPA_CONSTEXPR_17 constexpr
@@ -32,7 +34,7 @@
// Define UPA_CPP_14 if compiler supports C++14 or later
// Note: Visual Studio 2015 (14.0; _MSC_VER == 1900) lacks sufficient C++14 support
-#if defined(_MSVC_LANG) ? (_MSVC_LANG >= 201402 && _MSC_VER > 1900) : (__cplusplus >= 201402)
+#if UPA_CXX_STANDARD >= 14
# define UPA_CPP_14
# define UPA_CONSTEXPR_14 constexpr
#else

View File

@ -0,0 +1,34 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO upa-url/upa
REF "v${VERSION}"
SHA512 6217d2ec00191d125b94d86ea1bc094d5386ee9ebe7368d5ffa74161ab911d2409833239ff6874b185a7deb838a50a6b06cb79f287d16095227c83494e4fd1b4
HEAD_REF main
PATCHES
cxx-standard.patch
)
if("cxx11" IN_LIST FEATURES)
set(UPA_CXX_STANDARD 11)
else()
set(UPA_CXX_STANDARD 17)
endif()
vcpkg_replace_string(${SOURCE_PATH}/include/upa/config.h
"@UPA_CXX_STANDARD@" "${UPA_CXX_STANDARD}"
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DCMAKE_CXX_STANDARD=${UPA_CXX_STANDARD}
-DCMAKE_CXX_STANDARD_REQUIRED=ON
-DUPA_BUILD_TESTS=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME "upa" CONFIG_PATH "lib/cmake/upa")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

22
ports/upa-url/vcpkg.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "upa-url",
"version": "1.0.0",
"description": "An implementation of the WHATWG URL Standard in C++",
"homepage": "https://github.com/upa-url/upa",
"license": "BSD-2-Clause",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"cxx11": {
"description": "Compile library with C++11 (for use in C++11 and C++14 projects)"
}
}
}

View File

@ -9144,6 +9144,10 @@
"baseline": "7.0.7", "baseline": "7.0.7",
"port-version": 0 "port-version": 0
}, },
"upa-url": {
"baseline": "1.0.0",
"port-version": 0
},
"upb": { "upb": {
"baseline": "4.25.1", "baseline": "4.25.1",
"port-version": 1 "port-version": 1

9
versions/u-/upa-url.json Normal file
View File

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