aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include/VcpkgPaths.h
blob: 3c1955204bb21850984e74d4b3ff69738e5b1a45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#pragma once
#include "BinaryParagraph.h"
#include "Lazy.h"
#include "PackageSpec.h"
#include "filesystem_fs.h"
#include "vcpkg_Files.h"
#include "vcpkg_expected.h"

namespace vcpkg
{
    struct ToolsetArchOption
    {
        CWStringView name;
        System::CPUArchitecture host_arch;
        System::CPUArchitecture target_arch;
    };

    struct Toolset
    {
        fs::path dumpbin;
        fs::path vcvarsall;
        std::vector<std::wstring> vcvarsall_options;
        CWStringView version;
        std::vector<ToolsetArchOption> supported_architectures;
    };

    struct VcpkgPaths
    {
        static Expected<VcpkgPaths> create(const fs::path& vcpkg_root_dir);

        fs::path package_dir(const PackageSpec& spec) const;
        fs::path port_dir(const PackageSpec& spec) const;
        fs::path port_dir(const std::string& name) const;
        fs::path build_info_file_path(const PackageSpec& spec) const;
        fs::path listfile_path(const BinaryParagraph& pgh) const;

        bool is_valid_triplet(const Triplet& t) const;

        fs::path root;
        fs::path packages;
        fs::path buildtrees;
        fs::path downloads;
        fs::path ports;
        fs::path installed;
        fs::path triplets;
        fs::path scripts;

        fs::path buildsystems;
        fs::path buildsystems_msbuild_targets;

        fs::path vcpkg_dir;
        fs::path vcpkg_dir_status_file;
        fs::path vcpkg_dir_info;
        fs::path vcpkg_dir_updates;

        fs::path ports_cmake;

        const fs::path& get_cmake_exe() const;
        const fs::path& get_git_exe() const;
        const fs::path& get_nuget_exe() const;

        /// <summary>Retrieve a toolset matching a VS version</summary>
        /// <remarks>
        ///   Valid version strings are "v140", "v141", and "". Empty string gets the latest.
        /// </remarks>
        const Toolset& get_toolset(const std::string& toolset_version) const;

        Files::Filesystem& get_filesystem() const;

    private:
        Lazy<fs::path> cmake_exe;
        Lazy<fs::path> git_exe;
        Lazy<fs::path> nuget_exe;
        Lazy<std::vector<Toolset>> toolsets;
        Lazy<std::vector<Toolset>> toolsets_vs2017_v140;
    };
}