2016-11-09 06:12:49 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
#include "Paragraphs.h"
|
2016-11-10 10:44:11 +08:00
|
|
|
#include <regex>
|
2016-11-09 06:12:49 +08:00
|
|
|
|
2016-11-30 09:17:45 +08:00
|
|
|
namespace vcpkg { namespace PostBuildLint
|
2016-11-09 06:12:49 +08:00
|
|
|
{
|
|
|
|
enum class LinkageType
|
|
|
|
{
|
|
|
|
DYNAMIC,
|
|
|
|
STATIC,
|
|
|
|
UNKNOWN
|
|
|
|
};
|
|
|
|
|
|
|
|
LinkageType linkage_type_value_of(const std::string& as_string);
|
|
|
|
|
2016-11-09 17:27:49 +08:00
|
|
|
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;
|
|
|
|
|
2016-11-10 10:44:11 +08:00
|
|
|
static const std::vector<BuildType>& values()
|
|
|
|
{
|
|
|
|
static const std::vector<BuildType> v = {DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC};
|
|
|
|
return v;
|
|
|
|
}
|
2016-11-09 17:27:49 +08:00
|
|
|
|
|
|
|
BuildType() = delete;
|
|
|
|
|
2016-11-10 10:44:11 +08:00
|
|
|
const ConfigurationType& config() const;
|
|
|
|
const LinkageType& linkage() const;
|
2016-11-30 03:33:32 +08:00
|
|
|
std::regex crt_regex() const;
|
|
|
|
std::string toString() const;
|
2016-11-09 17:27:49 +08:00
|
|
|
|
|
|
|
private:
|
2016-11-10 10:44:11 +08:00
|
|
|
BuildType(const ConfigurationType& config, const LinkageType& linkage, const std::string& crt_regex_as_string)
|
|
|
|
: m_config(config), m_linkage(linkage), m_crt_regex_as_string(crt_regex_as_string)
|
2016-11-09 17:27:49 +08:00
|
|
|
{
|
|
|
|
}
|
2016-11-10 10:44:11 +08:00
|
|
|
|
|
|
|
ConfigurationType m_config;
|
|
|
|
LinkageType m_linkage;
|
|
|
|
std::string m_crt_regex_as_string;
|
2016-11-09 17:27:49 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
bool operator ==(const BuildType& lhs, const BuildType& rhs);
|
|
|
|
|
|
|
|
bool operator !=(const BuildType& lhs, const BuildType& rhs);
|
|
|
|
|
2016-11-11 03:04:33 +08:00
|
|
|
struct OutdatedDynamicCrt
|
|
|
|
{
|
2016-11-11 08:28:10 +08:00
|
|
|
// Old CPP
|
2016-11-11 03:04:33 +08:00
|
|
|
static const OutdatedDynamicCrt MSVCP100_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCP100D_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCP110_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCP110_WIN_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCP120_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCP120_CLR0400_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCP60_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCP_WIN_DLL;
|
|
|
|
|
2016-11-11 08:28:10 +08:00
|
|
|
// Old C
|
|
|
|
static const OutdatedDynamicCrt MSVCR100_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCR100D_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCR100_CLR0400_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCR110_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCR120_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCR120_CLR0400_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCRT_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCRT20_DLL;
|
|
|
|
static const OutdatedDynamicCrt MSVCRT40_DLL;
|
|
|
|
|
2016-11-11 03:04:33 +08:00
|
|
|
static const std::vector<OutdatedDynamicCrt>& values()
|
|
|
|
{
|
|
|
|
static const std::vector<OutdatedDynamicCrt> v = {
|
|
|
|
MSVCP100_DLL, MSVCP100D_DLL,
|
|
|
|
MSVCP110_DLL,MSVCP110_WIN_DLL,
|
|
|
|
MSVCP120_DLL, MSVCP120_CLR0400_DLL,
|
2016-11-11 08:28:10 +08:00
|
|
|
MSVCP60_DLL,
|
|
|
|
MSVCP_WIN_DLL,
|
|
|
|
|
|
|
|
MSVCR100_DLL, MSVCR100D_DLL, MSVCR100_CLR0400_DLL,
|
|
|
|
MSVCR110_DLL,
|
|
|
|
MSVCR120_DLL, MSVCR120_CLR0400_DLL,
|
|
|
|
MSVCRT_DLL, MSVCRT20_DLL,MSVCRT40_DLL
|
2016-11-11 03:04:33 +08:00
|
|
|
};
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
OutdatedDynamicCrt() = delete;
|
|
|
|
|
2016-11-26 18:51:12 +08:00
|
|
|
const std::regex crt_regex() const;
|
2016-11-11 03:04:33 +08:00
|
|
|
const std::string& toString() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
explicit OutdatedDynamicCrt(const std::string& dll_name, const std::string& crt_regex_as_string)
|
|
|
|
: m_dll_name(dll_name), m_crt_regex_as_string(crt_regex_as_string)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string m_dll_name;
|
|
|
|
std::string m_crt_regex_as_string;
|
|
|
|
};
|
|
|
|
|
2016-11-09 06:12:49 +08:00
|
|
|
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);
|
2016-11-30 09:17:45 +08:00
|
|
|
}}
|