mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-24 03:27:12 +01:00
Use Cache class
This commit is contained in:
parent
ba432c23bc
commit
80f16f769e
@ -3,6 +3,7 @@
|
|||||||
#include <vcpkg/binaryparagraph.h>
|
#include <vcpkg/binaryparagraph.h>
|
||||||
#include <vcpkg/packagespec.h>
|
#include <vcpkg/packagespec.h>
|
||||||
|
|
||||||
|
#include <vcpkg/base/cache.h>
|
||||||
#include <vcpkg/base/expected.h>
|
#include <vcpkg/base/expected.h>
|
||||||
#include <vcpkg/base/files.h>
|
#include <vcpkg/base/files.h>
|
||||||
#include <vcpkg/base/lazy.h>
|
#include <vcpkg/base/lazy.h>
|
||||||
@ -89,7 +90,7 @@ namespace vcpkg
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Lazy<std::vector<std::string>> available_triplets;
|
Lazy<std::vector<std::string>> available_triplets;
|
||||||
mutable std::map<std::string, fs::path> tool_paths;
|
Cache<std::string, fs::path> tool_paths;
|
||||||
Lazy<std::vector<Toolset>> toolsets;
|
Lazy<std::vector<Toolset>> toolsets;
|
||||||
Lazy<std::vector<Toolset>> toolsets_vs2013;
|
Lazy<std::vector<Toolset>> toolsets_vs2013;
|
||||||
|
|
||||||
|
@ -91,14 +91,7 @@ namespace vcpkg
|
|||||||
|
|
||||||
const fs::path& VcpkgPaths::get_tool_exe(const std::string& tool) const
|
const fs::path& VcpkgPaths::get_tool_exe(const std::string& tool) const
|
||||||
{
|
{
|
||||||
const auto it = this->tool_paths.find(tool);
|
return this->tool_paths.get_lazy(tool, [&]() { return Commands::Fetch::get_tool_path(*this, tool); });
|
||||||
if (it != this->tool_paths.cend())
|
|
||||||
{
|
|
||||||
return it->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->tool_paths[tool] = Commands::Fetch::get_tool_path(*this, tool);
|
|
||||||
return this->tool_paths[tool];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Toolset& VcpkgPaths::get_toolset(const Build::PreBuildInfo& prebuildinfo) const
|
const Toolset& VcpkgPaths::get_toolset(const Build::PreBuildInfo& prebuildinfo) const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user