[vcpkg] Add 7zip internal tool
MODIFY
include/vcpkg/vcpkgpaths.h
include/vcpkg/vcpkgpaths.h
@@ -63,6 +63,7 @@ namespace vcpkg
fs::path ports_cmake;
+ const fs::path& get_7za_exe() const;
const fs::path& get_cmake_exe() const;
const fs::path& get_git_exe() const;
const fs::path& get_nuget_exe() const;
@@ -80,6 +81,7 @@ namespace vcpkg
private:
Lazy<std::vector<std::string>> available_triplets;
+ Lazy<fs::path> _7za_exe;
Lazy<fs::path> cmake_exe;
Lazy<fs::path> git_exe;
Lazy<fs::path> nuget_exe;

MODIFY
src/vcpkg/vcpkgpaths.cpp
src/vcpkg/vcpkgpaths.cpp
@@ -205,6 +205,20 @@ namespace vcpkg
return fetch_tool(paths.scripts, "cmake", TOOL_DATA);
}
+ static fs::path get_7za_path(const VcpkgPaths& paths)
+ {
+#if defined(_WIN32)
+ static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "7zip");
+ if (!paths.get_filesystem().exists(TOOL_DATA.downloaded_exe_path))
+ {
+ return fetch_tool(paths.scripts, "7zip", TOOL_DATA);
+ }
+ return TOOL_DATA.downloaded_exe_path;
+#else
+ Checks::exit_with_message(VCPKG_LINE_INFO, "Cannot download 7zip for non-Windows platforms.");
+#endif
+ }
+
static fs::path get_nuget_path(const VcpkgPaths& paths)
{
static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "nuget");
@@ -353,6 +367,11 @@ namespace vcpkg
return it != this->get_available_triplets().cend();
}
+ const fs::path& VcpkgPaths::get_7za_exe() const
+ {
+ return this->_7za_exe.get_lazy([this]() { return get_7za_path(*this); });
+ }
+
const fs::path& VcpkgPaths::get_cmake_exe() const
{
return this->cmake_exe.get_lazy([this]() { return get_cmake_path(*this); });

[vcpkg] Add 7zip internal tool