| 346 | } |
| 347 | |
| 348 | std::vector<cmGlobalGenerator::GeneratedMakeCommand> |
| 349 | cmGlobalFastbuildGenerator::GenerateBuildCommand( |
| 350 | std::string const& makeProgram, std::string const& /*projectName*/, |
| 351 | std::string const& projectDir, std::vector<std::string> const& targetNames, |
| 352 | std::string const& /*config*/, int /*jobs*/, bool verbose, |
| 353 | cmBuildOptions /*buildOptions*/, std::vector<std::string> const& makeOptions, |
| 354 | BuildTryCompile isInTryCompile) |
| 355 | { |
| 356 | GeneratedMakeCommand makeCommand; |
| 357 | this->FastbuildCommand = this->SelectMakeProgram(makeProgram); |
| 358 | makeCommand.Add(this->FastbuildCommand); |
| 359 | // A build command for fastbuild looks like this: |
| 360 | // fbuild.exe [make-options] [-config projectName.bff] <target> |
| 361 | |
| 362 | std::string configFile = cmStrCat(projectDir, '/', FASTBUILD_BUILD_FILE); |
| 363 | |
| 364 | // Push in the make options |
| 365 | makeCommand.Add(makeOptions.begin(), makeOptions.end()); |
| 366 | |
| 367 | if (!configFile.empty()) { |
| 368 | makeCommand.Add("-config", configFile); |
| 369 | } |
| 370 | // Tested in "RunCMake.SymlinkTrees" test. |
| 371 | makeCommand.Add("-continueafterdbmove"); |
| 372 | |
| 373 | // Tested in RunCMake.LinkWhatYouUse on Linux. (We need to see output of |
| 374 | // LinkerStampExe process). |
| 375 | // In general, it might be useful to see output of external processes |
| 376 | // regardless of their outcome. |
| 377 | makeCommand.Add("-showcmdoutput"); |
| 378 | |
| 379 | // Add the target-config to the command |
| 380 | for (auto const& tname : targetNames) { |
| 381 | if (!tname.empty()) { |
| 382 | makeCommand.Add(tname); |
| 383 | } |
| 384 | } |
| 385 | if (verbose) { |
| 386 | makeCommand.Add("-verbose"); |
| 387 | } |
| 388 | |
| 389 | // Don't do extra work during "TryCompile". |
| 390 | if (isInTryCompile == BuildTryCompile::Yes) { |
| 391 | return { std::move(makeCommand) }; |
| 392 | } |
| 393 | |
| 394 | // Make "rebuild-bff" target up-to-date before running the build. |
| 395 | std::string output; |
| 396 | ExecuteFastbuildTarget(projectDir, FASTBUILD_REBUILD_BFF_TARGET_NAME, output, |
| 397 | { "-why" }); |
| 398 | |
| 399 | // If fbuild.bff was re-generated we need to "restat" it. |
| 400 | if (output.find("Need to build") != std::string::npos) { |
| 401 | // Let the user know that re-generation happened (and why it |
| 402 | // happened). |
| 403 | cmSystemTools::Stdout(output); |
| 404 | // FASTBuild will consider the target out-of-date in case some of the |
| 405 | // inputs have changes after re-generation which might happen if, for |