Commit d688c4c1 authored by Saleem Abdulrasool's avatar Saleem Abdulrasool Committed by Brad King

Swift: remove unnecessary unreleased Ninja infrastructure

This cleans up the new options that were added to support Swift.  This
was not released, and the proper support approach that we settled upon
does not require as much specialised support.
parent 07235822
......@@ -281,11 +281,6 @@ 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) {
......@@ -804,34 +799,6 @@ 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) + "/" +
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);
......
......@@ -19,7 +19,6 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalNinjaGenerator.h"
#include "cmListFileCache.h" // for BT
#include "cmLocalGenerator.h"
#include "cmLocalNinjaGenerator.h"
#include "cmMakefile.h"
......@@ -455,13 +454,6 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
vars.TargetCompilePDB = "$TARGET_COMPILE_PDB";
vars.ObjectDir = "$OBJECT_DIR";
vars.ObjectFileDir = "$OBJECT_FILE_DIR";
if (lang == "Swift") {
vars.SwiftAuxiliarySources = "$SWIFT_AUXILIARY_SOURCES";
vars.SwiftModuleName = "$SWIFT_MODULE_NAME";
vars.SwiftLibraryName = "$SWIFT_LIBRARY_NAME";
vars.SwiftPartialModule = "$SWIFT_PARTIAL_MODULE";
vars.SwiftPartialDoc = "$SWIFT_PARTIAL_DOC";
}
// For some cases we do an explicit preprocessor invocation.
bool const explicitPP = this->NeedExplicitPreprocessing(lang);
......@@ -947,43 +939,6 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
vars["DEFINES"] = this->ComputeDefines(source, language);
vars["INCLUDES"] = this->ComputeIncludes(source, language);
if (language == "Swift") {
// The swift compiler needs all the sources besides the one being compiled
// in order to do the type checking. List all these "auxiliary" sources.
std::string aux_sources;
cmGeneratorTarget::KindedSources const& sources =
this->GeneratorTarget->GetKindedSources(this->GetConfigName());
for (cmGeneratorTarget::SourceAndKind const& src : sources.Sources) {
if (src.Source.Value == source) {
continue;
}
aux_sources += " " + this->GetSourceFilePath(src.Source.Value);
}
vars["SWIFT_AUXILIARY_SOURCES"] = aux_sources;
if (const char* name =
this->GeneratorTarget->GetProperty("SWIFT_MODULE_NAME")) {
vars["SWIFT_MODULE_NAME"] = name;
} else {
vars["SWIFT_MODULE_NAME"] = this->GeneratorTarget->GetName();
}
cmGeneratorTarget::Names targetNames =
this->GeneratorTarget->GetLibraryNames(this->GetConfigName());
vars["SWIFT_LIBRARY_NAME"] = targetNames.Base;
if (const char* partial = source->GetProperty("SWIFT_PARTIAL_MODULE")) {
vars["SWIFT_PARTIAL_MODULE"] = partial;
} else {
vars["SWIFT_PARTIAL_MODULE"] = objectFileName + ".swiftmodule";
}
if (const char* partial = source->GetProperty("SWIFT_PARTIAL_DOC")) {
vars["SWIFT_PARTIAL_DOC"] = partial;
} else {
vars["SWIFT_PARTIAL_DOC"] = objectFileName + ".swiftdoc";
}
}
if (!this->NeedDepTypeMSVC(language)) {
bool replaceExt(false);
......
......@@ -162,46 +162,6 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable(
}
}
}
if (replaceValues.SwiftAuxiliarySources) {
if (variable == "SWIFT_AUXILIARY_SOURCES") {
return replaceValues.SwiftAuxiliarySources;
}
}
if (replaceValues.SwiftModuleName) {
if (variable == "SWIFT_MODULE_NAME") {
return replaceValues.SwiftModuleName;
}
}
if (replaceValues.SwiftLibraryName) {
if (variable == "SWIFT_LIBRARY_NAME") {
return replaceValues.SwiftLibraryName;
}
}
if (replaceValues.SwiftPartialDoc) {
if (variable == "SWIFT_PARTIAL_DOC") {
return replaceValues.SwiftPartialDoc;
}
}
if (replaceValues.SwiftPartialModule) {
if (variable == "SWIFT_PARTIAL_MODULE") {
return replaceValues.SwiftPartialModule;
}
}
if (replaceValues.SwiftPartialModules) {
if (variable == "SWIFT_PARTIAL_MODULES") {
return replaceValues.SwiftPartialModules;
}
}
if (replaceValues.TargetSwiftDoc) {
if (variable == "TARGET_SWIFT_DOC") {
return replaceValues.TargetSwiftDoc;
}
}
if (replaceValues.TargetSwiftModule) {
if (variable == "TARGET_SWIFT_MODULE") {
return replaceValues.TargetSwiftModule;
}
}
if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" ||
variable == "TARGET_INSTALLNAME_DIR") {
// All these variables depend on TargetSOName
......
......@@ -58,14 +58,6 @@ public:
const char* Includes;
const char* DependencyFile;
const char* FilterPrefix;
const char* SwiftAuxiliarySources;
const char* SwiftModuleName;
const char* SwiftLibraryName;
const char* SwiftPartialModule;
const char* SwiftPartialDoc;
const char* TargetSwiftModule;
const char* TargetSwiftDoc;
const char* SwiftPartialModules;
};
// Expand rule variables in CMake of the type found in language rules
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment