Ninja,Swift: reuse SWIFT_MODULE_NAME
for SWIFT_MODULE
Rather than compute the value of `SWIFT_MODULE`, use the computed value of `SWIFT_MODULE_NAME`. This is helpful strictly for Windows where you have multiple configuration variants with differing ABIs that need must co-exist. In particular, this re-use permits the use of `CMAKE_DEBUG_POSTFIX` to have the import library and the DLL be named with the trailing suffix but have the same import name for the swift module and interface.
This commit is contained in:
parent
e025495b85
commit
62381effba
@ -814,10 +814,15 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||||||
return targetNames.Base;
|
return targetNames.Base;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
vars["SWIFT_MODULE"] = [this]() -> std::string {
|
vars["SWIFT_MODULE_NAME"] = [this]() -> std::string {
|
||||||
cmGeneratorTarget::Names targetNames =
|
if (const char* name =
|
||||||
this->GetGeneratorTarget()->GetLibraryNames(this->GetConfigName());
|
this->GetGeneratorTarget()->GetProperty("Swift_MODULE_NAME")) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
return this->GetGeneratorTarget()->GetName();
|
||||||
|
}();
|
||||||
|
|
||||||
|
vars["SWIFT_MODULE"] = [this](const std::string& module) -> std::string {
|
||||||
std::string directory =
|
std::string directory =
|
||||||
this->GetLocalGenerator()->GetCurrentBinaryDirectory();
|
this->GetLocalGenerator()->GetCurrentBinaryDirectory();
|
||||||
if (const char* prop = this->GetGeneratorTarget()->GetProperty(
|
if (const char* prop = this->GetGeneratorTarget()->GetProperty(
|
||||||
@ -825,7 +830,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||||||
directory = prop;
|
directory = prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name = targetNames.Base + ".swiftmodule";
|
std::string name = module + ".swiftmodule";
|
||||||
if (const char* prop =
|
if (const char* prop =
|
||||||
this->GetGeneratorTarget()->GetProperty("Swift_MODULE")) {
|
this->GetGeneratorTarget()->GetProperty("Swift_MODULE")) {
|
||||||
name = prop;
|
name = prop;
|
||||||
@ -834,15 +839,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||||||
return this->GetLocalGenerator()->ConvertToOutputFormat(
|
return this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||||
this->ConvertToNinjaPath(directory + "/" + name),
|
this->ConvertToNinjaPath(directory + "/" + name),
|
||||||
cmOutputConverter::SHELL);
|
cmOutputConverter::SHELL);
|
||||||
}();
|
}(vars["SWIFT_MODULE_NAME"]);
|
||||||
|
|
||||||
vars["SWIFT_MODULE_NAME"] = [this]() -> std::string {
|
|
||||||
if (const char* name =
|
|
||||||
this->GetGeneratorTarget()->GetProperty("Swift_MODULE_NAME")) {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
return this->GetGeneratorTarget()->GetName();
|
|
||||||
}();
|
|
||||||
|
|
||||||
vars["SWIFT_OUTPUT_FILE_MAP"] =
|
vars["SWIFT_OUTPUT_FILE_MAP"] =
|
||||||
this->GetLocalGenerator()->ConvertToOutputFormat(
|
this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||||
|
Loading…
Reference in New Issue
Block a user