blob: 649f0cccaaa588b0a9d96b0fdc7b170931c12371 (
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
|
#include "pch.h"
#include "PostBuildLint_BuildType.h"
#include "vcpkg_Checks.h"
namespace vcpkg::PostBuildLint
{
BuildType BuildType::value_of(const ConfigurationType& config, const Build::LinkageType& linkage)
{
if (config == ConfigurationType::DEBUG && linkage == Build::LinkageType::STATIC)
{
return BuildTypeC::DEBUG_STATIC;
}
if (config == ConfigurationType::DEBUG && linkage == Build::LinkageType::DYNAMIC)
{
return BuildTypeC::DEBUG_DYNAMIC;
}
if (config == ConfigurationType::RELEASE && linkage == Build::LinkageType::STATIC)
{
return BuildTypeC::RELEASE_STATIC;
}
if (config == ConfigurationType::RELEASE && linkage == Build::LinkageType::DYNAMIC)
{
return BuildTypeC::RELEASE_DYNAMIC;
}
Checks::unreachable(VCPKG_LINE_INFO);
}
const ConfigurationType& BuildType::config() const { return this->m_config; }
const Build::LinkageType& BuildType::linkage() const { return this->m_linkage; }
const std::regex& BuildType::crt_regex() const
{
static const std::regex REGEX_DEBUG_STATIC(R"(/DEFAULTLIB:LIBCMTD)", std::regex_constants::icase);
static const std::regex REGEX_DEBUG_DYNAMIC(R"(/DEFAULTLIB:MSVCRTD)", std::regex_constants::icase);
static const std::regex REGEX_RELEASE_STATIC(R"(/DEFAULTLIB:LIBCMT[^D])", std::regex_constants::icase);
static const std::regex REGEX_RELEASE_DYNAMIC(R"(/DEFAULTLIB:MSVCRT[^D])", std::regex_constants::icase);
switch (backing_enum)
{
case BuildTypeC::DEBUG_STATIC: return REGEX_DEBUG_STATIC;
case BuildTypeC::DEBUG_DYNAMIC: return REGEX_DEBUG_DYNAMIC;
case BuildTypeC::RELEASE_STATIC: return REGEX_RELEASE_STATIC;
case BuildTypeC::RELEASE_DYNAMIC: return REGEX_RELEASE_DYNAMIC;
default: Checks::unreachable(VCPKG_LINE_INFO);
}
}
const std::string& BuildType::to_string() const
{
static const std::string NAME_DEBUG_STATIC("Debug,Static");
static const std::string NAME_DEBUG_DYNAMIC("Debug,Dynamic");
static const std::string NAME_RELEASE_STATIC("Release,Static");
static const std::string NAME_RELEASE_DYNAMIC("Release,Dynamic");
switch (backing_enum)
{
case BuildTypeC::DEBUG_STATIC: return NAME_DEBUG_STATIC;
case BuildTypeC::DEBUG_DYNAMIC: return NAME_DEBUG_DYNAMIC;
case BuildTypeC::RELEASE_STATIC: return NAME_RELEASE_STATIC;
case BuildTypeC::RELEASE_DYNAMIC: return NAME_RELEASE_DYNAMIC;
default: Checks::unreachable(VCPKG_LINE_INFO);
}
}
}
|