diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2020-06-30 14:13:53 (GMT) |
---|---|---|
committer | Robert Maynard <robert.maynard@kitware.com> | 2020-08-28 15:21:31 (GMT) |
commit | e783bf8aa6f90ddb1458c7b1a78c5d0225c1496a (patch) | |
tree | b59fe2e01365d0ec14d79f38be8bede5afde6a62 /Source/cmGlobalNinjaGenerator.cxx | |
parent | 34cc6acc81758e29f8c88607c21ab11d8807f87c (diff) | |
download | CMake-e783bf8aa6f90ddb1458c7b1a78c5d0225c1496a.zip CMake-e783bf8aa6f90ddb1458c7b1a78c5d0225c1496a.tar.gz CMake-e783bf8aa6f90ddb1458c7b1a78c5d0225c1496a.tar.bz2 |
ISPC: Support ISPC header generation byproducts and parallel builds
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 2ef202d..9a87e18 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -680,6 +680,9 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures() this->NinjaSupportsRestatTool = !cmSystemTools::VersionCompare( cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), RequiredNinjaVersionForRestatTool().c_str()); + this->NinjaSupportsMultipleOutputs = !cmSystemTools::VersionCompare( + cmSystemTools::OP_LESS, this->NinjaVersion.c_str(), + RequiredNinjaVersionForMultipleOutputs().c_str()); } bool cmGlobalNinjaGenerator::CheckLanguages( @@ -688,6 +691,9 @@ bool cmGlobalNinjaGenerator::CheckLanguages( if (cm::contains(languages, "Fortran")) { return this->CheckFortran(mf); } + if (cm::contains(languages, "ISPC")) { + return this->CheckISPC(mf); + } if (cm::contains(languages, "Swift")) { const std::string architectures = mf->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES"); @@ -721,6 +727,25 @@ bool cmGlobalNinjaGenerator::CheckFortran(cmMakefile* mf) const return false; } +bool cmGlobalNinjaGenerator::CheckISPC(cmMakefile* mf) const +{ + if (this->NinjaSupportsMultipleOutputs) { + return true; + } + + std::ostringstream e; + /* clang-format off */ + e << + "The Ninja generator does not support ISPC using Ninja version\n" + " " << this->NinjaVersion << "\n" + "due to lack of required features. Ninja 1.10 or higher is required." + ; + /* clang-format on */ + mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); + cmSystemTools::SetFatalErrorOccured(); + return false; +} + void cmGlobalNinjaGenerator::EnableLanguage( std::vector<std::string> const& langs, cmMakefile* mf, bool optional) { @@ -1127,6 +1152,21 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( } } else { cmNinjaDeps outs; + + auto computeISPCOuputs = [](cmGlobalNinjaGenerator* gg, + cmGeneratorTarget const* depTarget, + cmNinjaDeps& outputDeps, + const std::string& targetConfig) { + if (depTarget->CanCompileSources()) { + auto headers = depTarget->GetGeneratedISPCHeaders(targetConfig); + if (!headers.empty()) { + std::transform(headers.begin(), headers.end(), headers.begin(), + gg->MapToNinjaPath()); + outputDeps.insert(outputDeps.end(), headers.begin(), headers.end()); + } + } + }; + for (cmTargetDepend const& targetDep : this->GetTargetDirectDepends(target)) { if (!targetDep->IsInBuildSystem()) { @@ -1134,8 +1174,10 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( } if (targetDep.IsCross()) { this->AppendTargetOutputs(targetDep, outs, fileConfig, depends); + computeISPCOuputs(this, targetDep, outs, fileConfig); } else { this->AppendTargetOutputs(targetDep, outs, config, depends); + computeISPCOuputs(this, targetDep, outs, config); } } std::sort(outs.begin(), outs.end()); |