From 9a963f7eff1981d4e894ea8b297d092cda60b764 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 5 Oct 2017 13:51:28 -0700 Subject: Overhaul VS selection. Add triplet option to specify VS instance --- toolsrc/include/VcpkgPaths.h | 5 +++-- toolsrc/include/vcpkg_Build.h | 3 ++- toolsrc/include/vcpkg_Util.h | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/VcpkgPaths.h b/toolsrc/include/VcpkgPaths.h index 4b4527434..d4640fba2 100644 --- a/toolsrc/include/VcpkgPaths.h +++ b/toolsrc/include/VcpkgPaths.h @@ -17,6 +17,7 @@ namespace vcpkg struct Toolset { + fs::path visual_studio_root_path; fs::path dumpbin; fs::path vcvarsall; std::vector vcvarsall_options; @@ -66,7 +67,8 @@ namespace vcpkg /// /// Valid version strings are "v140", "v141", and "". Empty string gets the latest. /// - const Toolset& get_toolset(const std::string& toolset_version) const; + const Toolset& VcpkgPaths::get_toolset(const Optional& toolset_version, + const Optional& visual_studio_path) const; Files::Filesystem& get_filesystem() const; @@ -78,6 +80,5 @@ namespace vcpkg Lazy ifw_binarycreator_exe; Lazy ifw_repogen_exe; Lazy> toolsets; - Lazy> toolsets_vs2017_v140; }; } diff --git a/toolsrc/include/vcpkg_Build.h b/toolsrc/include/vcpkg_Build.h index 78e89d4de..5ba675757 100644 --- a/toolsrc/include/vcpkg_Build.h +++ b/toolsrc/include/vcpkg_Build.h @@ -79,7 +79,8 @@ namespace vcpkg::Build std::string target_architecture; std::string cmake_system_name; std::string cmake_system_version; - std::string platform_toolset; + Optional platform_toolset; + Optional visual_studio_path; }; std::wstring make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset); diff --git a/toolsrc/include/vcpkg_Util.h b/toolsrc/include/vcpkg_Util.h index e5ead6d3a..a87045d73 100644 --- a/toolsrc/include/vcpkg_Util.h +++ b/toolsrc/include/vcpkg_Util.h @@ -67,6 +67,21 @@ namespace vcpkg::Util return std::find_if(cont.cbegin(), cont.cend(), pred); } + template + using ToVectorOfConstPointersT = std::decay_t()))>; + + template> + std::vector to_vector_of_const_pointers(const Container& cont) + { + std::vector output; + for (auto i = cont.cbegin(), cend = cont.end(); i != cend; ++i) + { + output.push_back(&(*i)); + } + + return output; + } + template auto find_if_not(const Container& cont, Pred pred) { -- cgit v1.2.3