aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include/BuildInfo.h
blob: 870001474e31d39095dc7cf823756ba6f8600211 (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
#pragma once

#include <unordered_map>
#include "Paragraphs.h"

namespace fs = std::tr2::sys;

namespace vcpkg
{
    enum class LinkageType
    {
        DYNAMIC,
        STATIC,
        UNKNOWN
    };

    LinkageType linkage_type_value_of(const std::string& as_string);

    std::string to_string(const LinkageType& build_info);

    enum class ConfigurationType
    {
        DEBUG = 1,
        RELEASE = 2
    };

    std::string to_string(const ConfigurationType& conf);

    struct BuildType
    {
        static BuildType value_of(const ConfigurationType& config, const LinkageType& linkage);

        static const BuildType DEBUG_STATIC;
        static const BuildType DEBUG_DYNAMIC;
        static const BuildType RELEASE_STATIC;
        static const BuildType RELEASE_DYNAMIC;

        const ConfigurationType config;
        const LinkageType linkage;

        BuildType() = delete;

        std::string toString() const;

    private:
        BuildType(const ConfigurationType& config, const LinkageType& linkage) : config(config), linkage(linkage)
        {
        }
    };

    bool operator ==(const BuildType& lhs, const BuildType& rhs);

    bool operator !=(const BuildType& lhs, const BuildType& rhs);

    struct BuildInfo
    {
        static BuildInfo create(const std::unordered_map<std::string, std::string>& pgh);

        std::string crt_linkage;
        std::string library_linkage;
    };

    BuildInfo read_build_info(const fs::path& filepath);
}