Visual Studio: Skip unknown platforms (ARM, ARM64)

This commit is contained in:
Daniel Marjamäki 2017-06-01 13:13:23 +02:00
parent dc79f9630f
commit 5efb2e3be0
1 changed files with 19 additions and 8 deletions

View File

@ -255,14 +255,22 @@ namespace {
if (e->GetText()) { if (e->GetText()) {
if (std::strcmp(e->Name(),"Configuration")==0) if (std::strcmp(e->Name(),"Configuration")==0)
configuration = e->GetText(); configuration = e->GetText();
else if (std::strcmp(e->Name(),"Platform")==0) else if (std::strcmp(e->Name(),"Platform")==0) {
platform = e->GetText(); platformStr = e->GetText();
if (platformStr == "Win32")
platform = Win32;
else if (platformStr == "x64")
platform = x64;
else
platform = Unknown;
}
} }
} }
} }
std::string name; std::string name;
std::string configuration; std::string configuration;
std::string platform; enum { Win32, x64, Unknown } platform;
std::string platformStr;
}; };
struct ItemDefinitionGroup { struct ItemDefinitionGroup {
@ -300,7 +308,7 @@ namespace {
return true; return true;
std::string c = '(' + condition + ");"; std::string c = '(' + condition + ");";
replaceAll(c, "$(Configuration)", p.configuration); replaceAll(c, "$(Configuration)", p.configuration);
replaceAll(c, "$(Platform)", p.platform); replaceAll(c, "$(Platform)", p.platformStr);
// TODO : Better evaluation // TODO : Better evaluation
Settings s; Settings s;
@ -423,9 +431,12 @@ void ImportProject::importVcxproj(const std::string &filename, std::map<std::str
if (std::strcmp(node->Name(), "ItemGroup") == 0) { if (std::strcmp(node->Name(), "ItemGroup") == 0) {
if (node->Attribute("Label") && std::strcmp(node->Attribute("Label"), "ProjectConfigurations") == 0) { if (node->Attribute("Label") && std::strcmp(node->Attribute("Label"), "ProjectConfigurations") == 0) {
for (const tinyxml2::XMLElement *cfg = node->FirstChildElement(); cfg; cfg = cfg->NextSiblingElement()) { for (const tinyxml2::XMLElement *cfg = node->FirstChildElement(); cfg; cfg = cfg->NextSiblingElement()) {
if (std::strcmp(cfg->Name(), "ProjectConfiguration") == 0) if (std::strcmp(cfg->Name(), "ProjectConfiguration") == 0) {
ProjectConfiguration p(cfg);
if (p.platform != ProjectConfiguration::Unknown)
projectConfigurationList.push_back(ProjectConfiguration(cfg)); projectConfigurationList.push_back(ProjectConfiguration(cfg));
} }
}
} else { } else {
for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) { for (const tinyxml2::XMLElement *e = node->FirstChildElement(); e; e = e->NextSiblingElement()) {
if (std::strcmp(e->Name(), "ClCompile") == 0) if (std::strcmp(e->Name(), "ClCompile") == 0)
@ -455,9 +466,9 @@ void ImportProject::importVcxproj(const std::string &filename, std::map<std::str
fs.filename = Path::simplifyPath(Path::getPathFromFilename(filename) + *c); fs.filename = Path::simplifyPath(Path::getPathFromFilename(filename) + *c);
fs.cfg = p->name; fs.cfg = p->name;
fs.defines = "_MSC_VER=1900;_WIN32=1"; fs.defines = "_MSC_VER=1900;_WIN32=1";
if (p->platform == "Win32") if (p->platform == ProjectConfiguration::Win32)
fs.platformType = cppcheck::Platform::Win32W; fs.platformType = cppcheck::Platform::Win32W;
else if (p->platform == "x64") { else if (p->platform == ProjectConfiguration::x64) {
fs.platformType = cppcheck::Platform::Win64; fs.platformType = cppcheck::Platform::Win64;
fs.defines += ";_WIN64=1"; fs.defines += ";_WIN64=1";
} }