FString FDesktopPlatformBase::GetEngineDescription(const FString& Identifier) { // Official release versions just have a version number if(IsStockEngineRelease(Identifier)) { return Identifier; } // Otherwise get the path FString RootDir; if(!GetEngineRootDirFromIdentifier(Identifier, RootDir)) { return FString(); } // Convert it to a platform directory FString PlatformRootDir = RootDir; FPaths::MakePlatformFilename(PlatformRootDir); // Perforce build if (IsSourceDistribution(RootDir)) { return FString::Printf(TEXT("Source build at %s"), *PlatformRootDir); } else { return FString::Printf(TEXT("Binary build at %s"), *PlatformRootDir); } }
bool FDesktopPlatformBase::GenerateProjectFiles(const FString& RootDir, const FString& ProjectFileName, FFeedbackContext* Warn) { #if PLATFORM_MAC FString Arguments = TEXT(" -xcodeprojectfile"); #elif PLATFORM_LINUX FString Arguments = TEXT(" -makefile -kdevelopfile -qmakefile -cmakefile -codelitefile "); #else FString Arguments = TEXT(" -projectfiles"); #endif // Build the arguments to pass to UBT. If it's a non-foreign project, just build full project files. if ( !ProjectFileName.IsEmpty() && GetCachedProjectDictionary(RootDir).IsForeignProject(ProjectFileName) ) { // Figure out whether it's a foreign project const FUProjectDictionary &ProjectDictionary = GetCachedProjectDictionary(RootDir); if(ProjectDictionary.IsForeignProject(ProjectFileName)) { Arguments += FString::Printf(TEXT(" -project=\"%s\""), *IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*ProjectFileName)); // Always include game source Arguments += TEXT(" -game"); // Determine whether or not to include engine source if(IsSourceDistribution(RootDir) && !FRocketSupport::IsRocket()) { Arguments += TEXT(" -engine"); } else { Arguments += TEXT(" -rocket"); } } } Arguments += TEXT(" -progress"); // Compile UnrealBuildTool if it doesn't exist. This can happen if we're just copying source from somewhere. bool bRes = true; Warn->BeginSlowTask(LOCTEXT("GeneratingProjectFiles", "Generating project files..."), true, true); if(!FPaths::FileExists(GetUnrealBuildToolExecutableFilename(RootDir))) { Warn->StatusUpdate(0, 1, LOCTEXT("BuildingUBT", "Building UnrealBuildTool...")); bRes = BuildUnrealBuildTool(RootDir, *Warn); } if(bRes) { Warn->StatusUpdate(0, 1, LOCTEXT("GeneratingProjectFiles", "Generating project files...")); bRes = RunUnrealBuildTool(LOCTEXT("GeneratingProjectFiles", "Generating project files..."), RootDir, Arguments, Warn); } Warn->EndSlowTask(); return bRes; }
bool FDesktopPlatformBase::CompileGameProject(const FString& RootDir, const FString& ProjectFileName, FFeedbackContext* Warn) { // Get the project directory FString ProjectDir = FPaths::GetPath(ProjectFileName); // Get the target name. By default it'll be the same as the project name, but that might not be the case if the project was renamed. FString TargetName = FPaths::GetBaseFilename(ProjectFileName); if(!FPaths::FileExists(ProjectDir / FString::Printf(TEXT("Source/%sEditor.Target.cs"), *TargetName))) { // Find all the target files TArray<FString> TargetFiles; IFileManager::Get().FindFilesRecursive(TargetFiles, *(ProjectDir / TEXT("Source")), TEXT("*.target.cs"), true, false, false); // Try to find a target that's clearly meant to be the editor. If there isn't one, let UBT fail with a sensible message without trying to do anything else smart. for(const FString TargetFile: TargetFiles) { if(TargetFile.EndsWith("Editor.Target.cs")) { TargetName = FPaths::GetBaseFilename(FPaths::GetBaseFilename(TargetFile)); break; } } } // Build the argument list FString Arguments = FString::Printf(TEXT("%s %s %s"), *TargetName, FModuleManager::Get().GetUBTConfiguration(), FPlatformMisc::GetUBTPlatform()); // Append the project name if it's a foreign project if ( !ProjectFileName.IsEmpty() ) { FUProjectDictionary ProjectDictionary(RootDir); if(ProjectDictionary.IsForeignProject(ProjectFileName)) { Arguments += FString::Printf(TEXT(" -project=\"%s\""), *IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*ProjectFileName)); } } // Append the Rocket flag if(!IsSourceDistribution(RootDir) || FRocketSupport::IsRocket()) { Arguments += TEXT(" -rocket"); } // Append any other options Arguments += " -editorrecompile -progress -noubtmakefiles"; // Run UBT return RunUnrealBuildTool(LOCTEXT("CompilingProject", "Compiling project..."), RootDir, Arguments, Warn); }