MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Build

Method Build

Source/Editor/Cooker/GameCooker.cpp:488–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486}
487
488bool GameCooker::Build(BuildPlatform platform, BuildConfiguration configuration, const StringView& outputPath, BuildOptions options, const Array<String>& customDefines, const StringView& preset, const StringView& presetTarget)
489{
490 if (IsRunning())
491 {
492 LOG(Warning, "Cannot start a build. Already running.");
493 return true;
494 }
495 PlatformTools* tools = GetTools(platform);
496 if (tools == nullptr)
497 {
498 LOG(Error, "Build platform {0} is not supported.", ::ToString(platform));
499 return true;
500 }
501 PROFILE_MEM(Editor);
502
503 // Setup
504 CancelFlag = 0;
505 ProgressMsg.Clear();
506 ProgressValue = 1.0f;
507 Data = New<CookingData>();
508 CookingData& data = *Data;
509 data.Tools = tools;
510 data.Platform = platform;
511 data.Configuration = configuration;
512 data.Options = options;
513 data.Preset = preset;
514 data.PresetTarget = presetTarget;
515 data.CustomDefines = customDefines;
516 data.OriginalOutputPath = outputPath;
517 FileSystem::NormalizePath(data.OriginalOutputPath);
518 data.OriginalOutputPath = FileSystem::ConvertRelativePathToAbsolute(Globals::ProjectFolder, data.OriginalOutputPath);
519 data.NativeCodeOutputPath = data.ManagedCodeOutputPath = data.DataOutputPath = data.OriginalOutputPath;
520 data.CacheDirectory = Globals::ProjectCacheFolder / TEXT("Cooker") / tools->GetName();
521 if (!FileSystem::DirectoryExists(data.CacheDirectory))
522 {
523 if (FileSystem::CreateDirectory(data.CacheDirectory))
524 {
525 LOG(Error, "Cannot setup game building cache directory.");
526 return true;
527 }
528 }
529
530 // Start
531 GameCookerImpl::IsRunning = true;
532
533 // Start thread if need to
534 if (!IsThreadRunning)
535 {
536 Function<int32()> f;
537 f.Bind(ThreadFunction);
538 uint32 stackSize = 4 * 1024 * 1024; // Larger stack
539 const auto thread = ThreadSpawner::Start(f, GameCookerServiceInstance.Name, ThreadPriority::Highest, stackSize);
540 if (thread == nullptr)
541 {
542 GameCookerImpl::IsRunning = false;
543 LOG(Error, "Failed to start a build thread.");
544 return true;
545 }

Callers 7

LoadProjectMethod · 0.45
TryBuildCommandMethod · 0.45
LoadProductMethod · 0.45
BuildFunction · 0.45
OnBuildClickedMethod · 0.45
OnUpdateFunction · 0.45

Calls 15

NormalizePathFunction · 0.85
StartFunction · 0.85
IsCancelRequestedFunction · 0.85
EnumHasAnyFlagsFunction · 0.85
DeleteFunction · 0.85
InitProgressMethod · 0.80
NextStepMethod · 0.80
ToStringFunction · 0.70
IsRunningFunction · 0.50
FormatFunction · 0.50
ClearMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected