mirror of
https://github.com/microsoft/vcpkg.git
synced 2026-01-18 01:11:23 +01:00
[structopt] Add port (#47014)
This commit is contained in:
79
ports/structopt/0000-vendored-dependencies.patch
Normal file
79
ports/structopt/0000-vendored-dependencies.patch
Normal file
@@ -0,0 +1,79 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 8c6f3dd..a85803b 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -36,6 +36,9 @@ option(STRUCTOPT_SAMPLES "Build structopt samples")
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
+find_package(magic_enum REQUIRED)
|
||||
+find_package(unofficial-visit_struct REQUIRED)
|
||||
+
|
||||
add_library(structopt INTERFACE)
|
||||
add_library(structopt::structopt ALIAS structopt)
|
||||
|
||||
@@ -43,6 +46,9 @@ target_compile_features(structopt INTERFACE cxx_std_17)
|
||||
target_include_directories(structopt INTERFACE
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>)
|
||||
+target_link_libraries(structopt INTERFACE
|
||||
+ magic_enum::magic_enum
|
||||
+ unofficial::visit_struct::visit_struct)
|
||||
|
||||
if(STRUCTOPT_SAMPLES)
|
||||
add_subdirectory(samples)
|
||||
diff --git a/include/structopt/app.hpp b/include/structopt/app.hpp
|
||||
index b60cc29..c89aa5d 100644
|
||||
--- a/include/structopt/app.hpp
|
||||
+++ b/include/structopt/app.hpp
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <string>
|
||||
#include <structopt/is_stl_container.hpp>
|
||||
#include <structopt/parser.hpp>
|
||||
-#include <structopt/third_party/visit_struct/visit_struct.hpp>
|
||||
+#include <visit_struct/visit_struct.hpp>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
diff --git a/include/structopt/parser.hpp b/include/structopt/parser.hpp
|
||||
index 5ef391c..1cbfc71 100644
|
||||
--- a/include/structopt/parser.hpp
|
||||
+++ b/include/structopt/parser.hpp
|
||||
@@ -13,8 +13,8 @@
|
||||
#include <structopt/is_number.hpp>
|
||||
#include <structopt/is_specialization.hpp>
|
||||
#include <structopt/sub_command.hpp>
|
||||
-#include <structopt/third_party/magic_enum/magic_enum.hpp>
|
||||
-#include <structopt/third_party/visit_struct/visit_struct.hpp>
|
||||
+#include <magic_enum/magic_enum.hpp>
|
||||
+#include <visit_struct/visit_struct.hpp>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
diff --git a/include/structopt/visitor.hpp b/include/structopt/visitor.hpp
|
||||
index f36c155..dbaa619 100644
|
||||
--- a/include/structopt/visitor.hpp
|
||||
+++ b/include/structopt/visitor.hpp
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <string>
|
||||
#include <structopt/is_specialization.hpp>
|
||||
#include <structopt/string.hpp>
|
||||
-#include <structopt/third_party/visit_struct/visit_struct.hpp>
|
||||
+#include <visit_struct/visit_struct.hpp>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
diff --git a/structoptConfig.cmake.in b/structoptConfig.cmake.in
|
||||
index 8f4580f..c272fe6 100644
|
||||
--- a/structoptConfig.cmake.in
|
||||
+++ b/structoptConfig.cmake.in
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
+find_dependency(magic_enum)
|
||||
+find_dependency(unofficial-visit_struct)
|
||||
+
|
||||
if (NOT TARGET structopt::structopt)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/structoptTargets.cmake)
|
||||
endif ()
|
||||
42
ports/structopt/portfile.cmake
Normal file
42
ports/structopt/portfile.cmake
Normal file
@@ -0,0 +1,42 @@
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO p-ranav/structopt
|
||||
REF "v${VERSION}"
|
||||
SHA512 f284ec20379a1bfecfe1622e45d0570128455ecf0c24f2a1d26420c13a277112ca7ba350e2d40c0b0b37b38eba4ffa6ff164590b32262a5ba23186f7cd904511
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
0000-vendored-dependencies.patch
|
||||
)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DSTRUCTOPT_TESTS=OFF
|
||||
-DSTRUCTOPT_SAMPLES=OFF
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
|
||||
# Header-only library.
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/structopt")
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
# Delete all third-party header files vendored by the structopt library. The library has been patched to instead use
|
||||
# the external versions of these libraries.
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/structopt/third_party")
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug")
|
||||
|
||||
vcpkg_install_copyright(
|
||||
FILE_LIST
|
||||
"${SOURCE_PATH}/LICENSE"
|
||||
)
|
||||
|
||||
# Remove redundant license files that are installed by the library.
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/licenses)
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_LIST_DIR}/usage"
|
||||
"${CURRENT_PACKAGES_DIR}/share/${PORT}/usage"
|
||||
COPYONLY
|
||||
)
|
||||
4
ports/structopt/usage
Normal file
4
ports/structopt/usage
Normal file
@@ -0,0 +1,4 @@
|
||||
structopt provides CMake targets:
|
||||
|
||||
find_package(structopt CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE structopt::structopt)
|
||||
20
ports/structopt/vcpkg.json
Normal file
20
ports/structopt/vcpkg.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "structopt",
|
||||
"version": "0.1.3",
|
||||
"description": "Parse command line arguments by defining a struct.",
|
||||
"homepage": "https://github.com/p-ranav/structopt",
|
||||
"documentation": "https://github.com/p-ranav/structopt",
|
||||
"license": "MIT",
|
||||
"dependencies": [
|
||||
"magic-enum",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
},
|
||||
"visit-struct"
|
||||
]
|
||||
}
|
||||
@@ -9296,6 +9296,10 @@
|
||||
"baseline": "2020-09-14",
|
||||
"port-version": 4
|
||||
},
|
||||
"structopt": {
|
||||
"baseline": "0.1.3",
|
||||
"port-version": 0
|
||||
},
|
||||
"stx": {
|
||||
"baseline": "1.0.5",
|
||||
"port-version": 0
|
||||
|
||||
9
versions/s-/structopt.json
Normal file
9
versions/s-/structopt.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "8e4e317c3ba0dead53ae587f45d27022387eba29",
|
||||
"version": "0.1.3",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user