VS: Rename VS 2017 generator sources to be version-independent

Rename `cmGlobalVisualStudio{15 => Versioned}Generator`.  Rename
`Factory` to `Factory15` since that part still needs to be
version-specific.
This commit is contained in:
Brad King 2019-01-09 10:26:49 -05:00
parent d8ed309d05
commit 68d316e0cf
5 changed files with 45 additions and 37 deletions

View File

@ -696,10 +696,10 @@ if (WIN32)
cmGlobalVisualStudio12Generator.cxx
cmGlobalVisualStudio14Generator.h
cmGlobalVisualStudio14Generator.cxx
cmGlobalVisualStudio15Generator.h
cmGlobalVisualStudio15Generator.cxx
cmGlobalVisualStudioGenerator.cxx
cmGlobalVisualStudioGenerator.h
cmGlobalVisualStudioVersionedGenerator.h
cmGlobalVisualStudioVersionedGenerator.cxx
cmIDEFlagTable.h
cmIDEOptions.cxx
cmIDEOptions.h

View File

@ -10,7 +10,7 @@
#if defined(_WIN32)
# include "cmAlgorithms.h"
# include "cmGlobalGenerator.h"
# include "cmGlobalVisualStudio15Generator.h"
# include "cmGlobalVisualStudioVersionedGenerator.h"
# include "cmSystemTools.h"
# include "cmVSSetupHelper.h"
# define HAVE_VS_SETUP_HELPER
@ -133,8 +133,8 @@ bool cmCMakeHostSystemInformationCommand::GetValue(
// If generating for the VS 15 IDE, use the same instance.
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
if (cmHasLiteralPrefix(gg->GetName(), "Visual Studio 15 ")) {
cmGlobalVisualStudio15Generator* vs15gen =
static_cast<cmGlobalVisualStudio15Generator*>(gg);
cmGlobalVisualStudioVersionedGenerator* vs15gen =
static_cast<cmGlobalVisualStudioVersionedGenerator*>(gg);
if (vs15gen->GetVSInstance(value)) {
return true;
}

View File

@ -1,6 +1,6 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGlobalVisualStudio15Generator.h"
#include "cmGlobalVisualStudioVersionedGenerator.h"
#include "cmAlgorithms.h"
#include "cmDocumentationEntry.h"
@ -25,7 +25,7 @@ static const char* cmVS15GenName(const std::string& name, std::string& genName)
return p;
}
class cmGlobalVisualStudio15Generator::Factory
class cmGlobalVisualStudioVersionedGenerator::Factory15
: public cmGlobalGeneratorFactory
{
public:
@ -38,16 +38,16 @@ public:
return 0;
}
if (!*p) {
return new cmGlobalVisualStudio15Generator(cm, genName, "");
return new cmGlobalVisualStudioVersionedGenerator(cm, genName, "");
}
if (*p++ != ' ') {
return 0;
}
if (strcmp(p, "Win64") == 0) {
return new cmGlobalVisualStudio15Generator(cm, genName, "x64");
return new cmGlobalVisualStudioVersionedGenerator(cm, genName, "x64");
}
if (strcmp(p, "ARM") == 0) {
return new cmGlobalVisualStudio15Generator(cm, genName, "ARM");
return new cmGlobalVisualStudioVersionedGenerator(cm, genName, "ARM");
}
return 0;
}
@ -70,12 +70,13 @@ public:
bool SupportsPlatform() const override { return true; }
};
cmGlobalGeneratorFactory* cmGlobalVisualStudio15Generator::NewFactory()
cmGlobalGeneratorFactory*
cmGlobalVisualStudioVersionedGenerator::NewFactory15()
{
return new Factory;
return new Factory15;
}
cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator(
cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator(
cmake* cm, const std::string& name,
std::string const& platformInGeneratorName)
: cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName)
@ -89,7 +90,7 @@ cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator(
this->Version = VS15;
}
bool cmGlobalVisualStudio15Generator::MatchesGeneratorName(
bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName(
const std::string& name) const
{
std::string genName;
@ -99,7 +100,7 @@ bool cmGlobalVisualStudio15Generator::MatchesGeneratorName(
return false;
}
bool cmGlobalVisualStudio15Generator::SetGeneratorInstance(
bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
std::string const& i, cmMakefile* mf)
{
if (!i.empty()) {
@ -141,12 +142,13 @@ bool cmGlobalVisualStudio15Generator::SetGeneratorInstance(
return true;
}
bool cmGlobalVisualStudio15Generator::GetVSInstance(std::string& dir) const
bool cmGlobalVisualStudioVersionedGenerator::GetVSInstance(
std::string& dir) const
{
return vsSetupAPIHelper.GetVSInstanceInfo(dir);
}
bool cmGlobalVisualStudio15Generator::IsDefaultToolset(
bool cmGlobalVisualStudioVersionedGenerator::IsDefaultToolset(
const std::string& version) const
{
if (version.empty()) {
@ -167,7 +169,7 @@ bool cmGlobalVisualStudio15Generator::IsDefaultToolset(
return false;
}
std::string cmGlobalVisualStudio15Generator::GetAuxiliaryToolset() const
std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const
{
const char* version = this->GetPlatformToolsetVersion();
if (version) {
@ -186,7 +188,7 @@ std::string cmGlobalVisualStudio15Generator::GetAuxiliaryToolset() const
return {};
}
bool cmGlobalVisualStudio15Generator::InitializeWindows(cmMakefile* mf)
bool cmGlobalVisualStudioVersionedGenerator::InitializeWindows(cmMakefile* mf)
{
// If the Win 8.1 SDK is installed then we can select a SDK matching
// the target Windows version.
@ -198,7 +200,7 @@ bool cmGlobalVisualStudio15Generator::InitializeWindows(cmMakefile* mf)
return this->SelectWindows10SDK(mf, false);
}
bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset(
bool cmGlobalVisualStudioVersionedGenerator::SelectWindowsStoreToolset(
std::string& toolset) const
{
if (cmHasLiteralPrefix(this->SystemVersion, "10.0")) {
@ -214,17 +216,19 @@ bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset(
toolset);
}
bool cmGlobalVisualStudio15Generator::IsWindowsDesktopToolsetInstalled() const
bool cmGlobalVisualStudioVersionedGenerator::IsWindowsDesktopToolsetInstalled()
const
{
return vsSetupAPIHelper.IsVSInstalled();
}
bool cmGlobalVisualStudio15Generator::IsWindowsStoreToolsetInstalled() const
bool cmGlobalVisualStudioVersionedGenerator::IsWindowsStoreToolsetInstalled()
const
{
return vsSetupAPIHelper.IsWin10SDKInstalled();
}
bool cmGlobalVisualStudio15Generator::IsWin81SDKInstalled() const
bool cmGlobalVisualStudioVersionedGenerator::IsWin81SDKInstalled() const
{
// Does the VS installer tool know about one?
if (vsSetupAPIHelper.IsWin81SDKInstalled()) {
@ -246,12 +250,13 @@ bool cmGlobalVisualStudio15Generator::IsWin81SDKInstalled() const
return false;
}
std::string cmGlobalVisualStudio15Generator::GetWindows10SDKMaxVersion() const
std::string cmGlobalVisualStudioVersionedGenerator::GetWindows10SDKMaxVersion()
const
{
return std::string();
}
std::string cmGlobalVisualStudio15Generator::FindMSBuildCommand()
std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand()
{
std::string msbuild;
@ -268,7 +273,7 @@ std::string cmGlobalVisualStudio15Generator::FindMSBuildCommand()
return msbuild;
}
std::string cmGlobalVisualStudio15Generator::FindDevEnvCommand()
std::string cmGlobalVisualStudioVersionedGenerator::FindDevEnvCommand()
{
std::string devenv;

View File

@ -1,7 +1,7 @@
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmGlobalVisualStudio15Generator_h
#define cmGlobalVisualStudio15Generator_h
#ifndef cmGlobalVisualStudioVersionedGenerator_h
#define cmGlobalVisualStudioVersionedGenerator_h
#include "cmConfigure.h" // IWYU pragma: keep
@ -14,11 +14,12 @@
class cmGlobalGeneratorFactory;
class cmake;
/** \class cmGlobalVisualStudio15Generator */
class cmGlobalVisualStudio15Generator : public cmGlobalVisualStudio14Generator
/** \class cmGlobalVisualStudioVersionedGenerator */
class cmGlobalVisualStudioVersionedGenerator
: public cmGlobalVisualStudio14Generator
{
public:
static cmGlobalGeneratorFactory* NewFactory();
static cmGlobalGeneratorFactory* NewFactory15();
bool MatchesGeneratorName(const std::string& name) const override;
@ -30,8 +31,9 @@ public:
std::string GetAuxiliaryToolset() const override;
protected:
cmGlobalVisualStudio15Generator(cmake* cm, const std::string& name,
std::string const& platformInGeneratorName);
cmGlobalVisualStudioVersionedGenerator(
cmake* cm, const std::string& name,
std::string const& platformInGeneratorName);
bool InitializeWindows(cmMakefile* mf) override;
bool SelectWindowsStoreToolset(std::string& toolset) const override;
@ -53,8 +55,8 @@ protected:
std::string FindDevEnvCommand() override;
private:
class Factory;
friend class Factory;
class Factory15;
friend class Factory15;
mutable cmVSSetupAPIHelper vsSetupAPIHelper;
};
#endif

View File

@ -55,8 +55,8 @@
# include "cmGlobalVisualStudio11Generator.h"
# include "cmGlobalVisualStudio12Generator.h"
# include "cmGlobalVisualStudio14Generator.h"
# include "cmGlobalVisualStudio15Generator.h"
# include "cmGlobalVisualStudio9Generator.h"
# include "cmGlobalVisualStudioVersionedGenerator.h"
# include "cmVSSetupHelper.h"
# define CMAKE_HAVE_VS_GENERATORS
@ -1792,7 +1792,8 @@ void cmake::AddDefaultGenerators()
{
#if defined(_WIN32) && !defined(__CYGWIN__)
# if !defined(CMAKE_BOOT_MINGW)
this->Generators.push_back(cmGlobalVisualStudio15Generator::NewFactory());
this->Generators.push_back(
cmGlobalVisualStudioVersionedGenerator::NewFactory15());
this->Generators.push_back(cmGlobalVisualStudio14Generator::NewFactory());
this->Generators.push_back(cmGlobalVisualStudio12Generator::NewFactory());
this->Generators.push_back(cmGlobalVisualStudio11Generator::NewFactory());