diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2019-02-18 22:17:20 (GMT) |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2019-02-20 17:25:34 (GMT) |
commit | 001446126e71b3829855aac29048999b7a4ce6f4 (patch) | |
tree | 393d8d8ac0d1a181a47535c5f7aea8205bb0aace /Source/cmNinjaNormalTargetGenerator.cxx | |
parent | b76b83efd37a439e22d1d92af3b98c30e8f9ba97 (diff) | |
download | CMake-001446126e71b3829855aac29048999b7a4ce6f4.zip CMake-001446126e71b3829855aac29048999b7a4ce6f4.tar.gz CMake-001446126e71b3829855aac29048999b7a4ce6f4.tar.bz2 |
Ninja: add final placeholders to merge Swift partials
This adds the placeholders that are needed to merge the swift partial
modules. It permits generating the rules necessary to actually merge
the partial modules emitted for a partial compilation.
Diffstat (limited to 'Source/cmNinjaNormalTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 3784313..9def1f4 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -283,6 +283,11 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()); vars.Language = this->TargetLinkLanguage.c_str(); + if (this->TargetLinkLanguage == "Swift") { + vars.SwiftPartialModules = "$SWIFT_PARTIAL_MODULES"; + vars.TargetSwiftModule = "$TARGET_SWIFT_MODULE"; + vars.TargetSwiftDoc = "$TARGET_SWIFT_DOC"; + } std::string responseFlag; if (!useResponseFile) { @@ -787,6 +792,34 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmNinjaDeps outputs; outputs.push_back(targetOutputReal); + if (this->TargetLinkLanguage == "Swift") { + if (const char* name = gt.GetProperty("SWIFT_MODULE_NAME")) { + vars["TARGET_SWIFT_DOC"] = std::string(name) + ".swiftdoc"; + vars["TARGET_SWIFT_MODULE"] = std::string(name) + ".swiftmodule"; + } else { + vars["TARGET_SWIFT_DOC"] = gt.GetName() + ".swiftdoc"; + vars["TARGET_SWIFT_MODULE"] = gt.GetName() + ".swiftmodule"; + } + outputs.push_back(vars["TARGET_SWIFT_DOC"]); + outputs.push_back(vars["TARGET_SWIFT_MODULE"]); + + cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator(); + + std::string partials; + std::vector<cmSourceFile const*> sources; + gt.GetObjectSources(sources, this->GetConfigName()); + for (cmSourceFile const* source : sources) { + partials += " "; + if (const char* partial = source->GetProperty("SWIFT_PARTIAL_MODULE")) { + partials += partial; + } else { + partials += localGen.GetTargetDirectory(>) + "/" + + gt.GetObjectName(source) + ".swiftmodule"; + } + } + vars["SWIFT_PARTIAL_MODULES"] = partials; + } + // Compute specific libraries to link with. cmNinjaDeps explicitDeps = this->GetObjects(); cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage); |