From 831f0631f7eea7aebad5fcce95c0bbf0e0cdff68 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Tue, 6 Jun 2017 16:08:36 -0700 Subject: [vcpkg] Added parser support for 'Supports' field --- toolsrc/include/SourceParagraph.h | 37 ++++++++++++++++++++++++++++++++++++- toolsrc/include/vcpkg_Util.h | 6 ++++++ 2 files changed, 42 insertions(+), 1 deletion(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/SourceParagraph.h index 7b0fa3178..a53158f3f 100644 --- a/toolsrc/include/SourceParagraph.h +++ b/toolsrc/include/SourceParagraph.h @@ -1,6 +1,9 @@ #pragma once +#include "vcpkg_System.h" #include "vcpkg_expected.h" + +#include #include #include @@ -38,6 +41,7 @@ namespace vcpkg std::string version; std::string description; std::string maintainer; + std::vector supports; std::vector depends; }; @@ -47,5 +51,36 @@ namespace vcpkg std::vector filter_dependencies(const std::vector& deps, const Triplet& t); std::vector expand_qualified_dependencies(const std::vector& depends); - std::vector parse_depends(const std::string& depends_string); + std::vector parse_comma_list(const std::string& str); + + struct Supports + { + static ExpectedT> parse(const std::vector& strs); + + using Architecture = System::CPUArchitecture; + + enum class Platform + { + WINDOWS, + UWP, + }; + enum class Linkage + { + DYNAMIC, + STATIC, + }; + enum class ToolsetVersion + { + V140, + V141, + }; + + bool supports(Architecture arch, Platform plat, Linkage crt, ToolsetVersion tools); + + private: + std::vector architectures; + std::vector platforms; + std::vector crt_linkages; + std::vector toolsets; + }; } diff --git a/toolsrc/include/vcpkg_Util.h b/toolsrc/include/vcpkg_Util.h index 6648302ac..1bd1bcc4a 100644 --- a/toolsrc/include/vcpkg_Util.h +++ b/toolsrc/include/vcpkg_Util.h @@ -34,6 +34,12 @@ namespace vcpkg::Util cont.erase(std::remove_if(cont.begin(), cont.end(), pred), cont.end()); } + template + auto find(const Container& cont, V&& v) + { + return std::find(cont.cbegin(), cont.cend(), v); + } + template auto find_if(const Container& cont, Pred pred) { -- cgit v1.2.3