mirror of
https://github.com/reactos/CMake.git
synced 2025-03-03 09:27:12 +00:00
VS: Do not use native unity builds on VS 2017 versions less than 15.8
VS 2017 version 15.8 introduced support for unity builds implemented in part by the `$(VCTargetsPath)/Microsoft.Cpp.Unity.targets` file. Do not enable unity builds on VS 15 versions that do not have that file. Fixes: #20284
This commit is contained in:
parent
21e60da5bb
commit
9135954e2f
@ -230,6 +230,12 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->SupportsUnityBuilds =
|
||||||
|
this->Version >= cmGlobalVisualStudioGenerator::VS16 ||
|
||||||
|
(this->Version == cmGlobalVisualStudioGenerator::VS15 &&
|
||||||
|
cmSystemTools::PathExists(this->VCTargetsPath +
|
||||||
|
"/Microsoft.Cpp.Unity.targets"));
|
||||||
|
|
||||||
if (this->GeneratorToolsetCuda.empty()) {
|
if (this->GeneratorToolsetCuda.empty()) {
|
||||||
// Find the highest available version of the CUDA tools.
|
// Find the highest available version of the CUDA tools.
|
||||||
std::vector<std::string> cudaTools;
|
std::vector<std::string> cudaTools;
|
||||||
|
@ -108,6 +108,8 @@ public:
|
|||||||
virtual bool IsDefaultToolset(const std::string& version) const;
|
virtual bool IsDefaultToolset(const std::string& version) const;
|
||||||
virtual std::string GetAuxiliaryToolset() const;
|
virtual std::string GetAuxiliaryToolset() const;
|
||||||
|
|
||||||
|
bool GetSupportsUnityBuilds() const { return this->SupportsUnityBuilds; }
|
||||||
|
|
||||||
bool FindMakeProgram(cmMakefile* mf) override;
|
bool FindMakeProgram(cmMakefile* mf) override;
|
||||||
|
|
||||||
bool IsIPOSupported() const override { return true; }
|
bool IsIPOSupported() const override { return true; }
|
||||||
@ -172,6 +174,7 @@ protected:
|
|||||||
std::string DefaultMasmFlagTableName;
|
std::string DefaultMasmFlagTableName;
|
||||||
std::string DefaultNasmFlagTableName;
|
std::string DefaultNasmFlagTableName;
|
||||||
std::string DefaultRCFlagTableName;
|
std::string DefaultRCFlagTableName;
|
||||||
|
bool SupportsUnityBuilds = false;
|
||||||
bool SystemIsWindowsCE;
|
bool SystemIsWindowsCE;
|
||||||
bool SystemIsWindowsPhone;
|
bool SystemIsWindowsPhone;
|
||||||
bool SystemIsWindowsStore;
|
bool SystemIsWindowsStore;
|
||||||
|
@ -2085,9 +2085,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
|
|||||||
const bool haveUnityBuild =
|
const bool haveUnityBuild =
|
||||||
this->GeneratorTarget->GetPropertyAsBool("UNITY_BUILD");
|
this->GeneratorTarget->GetPropertyAsBool("UNITY_BUILD");
|
||||||
|
|
||||||
if (haveUnityBuild &&
|
if (haveUnityBuild && this->GlobalGenerator->GetSupportsUnityBuilds()) {
|
||||||
this->GlobalGenerator->GetVersion() >=
|
|
||||||
cmGlobalVisualStudioGenerator::VS15) {
|
|
||||||
Elem e1(e0, "PropertyGroup");
|
Elem e1(e0, "PropertyGroup");
|
||||||
e1.Element("EnableUnitySupport", "true");
|
e1.Element("EnableUnitySupport", "true");
|
||||||
}
|
}
|
||||||
@ -2193,9 +2191,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
|
|||||||
this->WriteSource(e2, si.Source);
|
this->WriteSource(e2, si.Source);
|
||||||
|
|
||||||
bool useNativeUnityBuild = false;
|
bool useNativeUnityBuild = false;
|
||||||
if (haveUnityBuild &&
|
if (haveUnityBuild && this->GlobalGenerator->GetSupportsUnityBuilds()) {
|
||||||
this->GlobalGenerator->GetVersion() >=
|
|
||||||
cmGlobalVisualStudioGenerator::VS15) {
|
|
||||||
// Magic value taken from cmGlobalVisualStudioVersionedGenerator.cxx
|
// Magic value taken from cmGlobalVisualStudioVersionedGenerator.cxx
|
||||||
static const std::string vs15 = "141";
|
static const std::string vs15 = "141";
|
||||||
std::string toolset =
|
std::string toolset =
|
||||||
@ -2222,7 +2218,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
|
|||||||
si.Source->GetProperty("UNITY_SOURCE_FILE"));
|
si.Source->GetProperty("UNITY_SOURCE_FILE"));
|
||||||
e2.Attribute("UnityFilesDirectory", unityDir);
|
e2.Attribute("UnityFilesDirectory", unityDir);
|
||||||
} else {
|
} else {
|
||||||
// Visual Studio versions prior to 2017 do not know about unity
|
// Visual Studio versions prior to 2017 15.8 do not know about unity
|
||||||
// builds, thus we exclude the files alredy part of unity sources.
|
// builds, thus we exclude the files alredy part of unity sources.
|
||||||
if (!si.Source->GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION")) {
|
if (!si.Source->GetPropertyAsBool("SKIP_UNITY_BUILD_INCLUSION")) {
|
||||||
exclude_configs = si.Configs;
|
exclude_configs = si.Configs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user