MCPcopy Create free account
hub / github.com/Kitware/CMake / GenerateSwiftOutputFileMap

Method GenerateSwiftOutputFileMap

Source/cmNinjaTargetGenerator.cxx:1270–1306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1268}
1269
1270void cmNinjaTargetGenerator::GenerateSwiftOutputFileMap(
1271 std::string const& config, std::string& flags)
1272{
1273 if (this->Configs[config].SwiftOutputMap.empty()) {
1274 return;
1275 }
1276
1277 std::string const targetSwiftDepsPath = [this, config]() -> std::string {
1278 cmGeneratorTarget const* target = this->GeneratorTarget;
1279 if (cmValue name = target->GetProperty("Swift_DEPENDENCIES_FILE")) {
1280 return *name;
1281 }
1282 return this->ConvertToNinjaPath(cmStrCat(target->GetSupportDirectory(),
1283 '/', config, '/',
1284 target->GetName(), ".swiftdeps"));
1285 }();
1286
1287 std::string mapFilePath =
1288 cmStrCat(this->GeneratorTarget->GetSupportDirectory(), '/', config,
1289 "/"
1290 "output-file-map.json");
1291
1292 // build the global target dependencies
1293 // https://github.com/apple/swift/blob/master/docs/Driver.md#output-file-maps
1294 Json::Value deps(Json::objectValue);
1295 deps["swift-dependencies"] = targetSwiftDepsPath;
1296 this->Configs[config].SwiftOutputMap[""] = deps;
1297
1298 cmGeneratedFileStream output(mapFilePath);
1299 output << this->Configs[config].SwiftOutputMap;
1300
1301 // Add flag
1302 this->LocalGenerator->AppendFlags(flags, "-output-file-map");
1303 this->LocalGenerator->AppendFlags(
1304 flags,
1305 this->ConvertToOutputFormatForShell(ConvertToNinjaPath(mapFilePath)));
1306}
1307
1308namespace {
1309cmNinjaBuild GetScanBuildStatement(std::string const& ruleName,

Callers 2

WriteLinkStatementMethod · 0.80

Calls 7

GetSupportDirectoryMethod · 0.80
cmStrCatFunction · 0.70
emptyMethod · 0.45
GetPropertyMethod · 0.45
GetNameMethod · 0.45
AppendFlagsMethod · 0.45

Tested by

no test coverage detected