public UEBuildEditor( string InGameName, UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, TargetRules InRulesObject, List <string> InAdditionalDefinitions, string InRemoteRoot, List <OnlyModule> InOnlyModules, bool bInEditorRecompile) // NOTE: If we're building a monolithic binary, then the game and engine code are linked together into one // program executable, so we want the application name to be the game name. In the case of a modular // binary, we use 'UnrealEngine' for our application name : base( InAppName: UEBuildTarget.GetBinaryBaseName( InGameName, InRulesObject, InPlatform, InConfiguration, (InRulesObject.Type == TargetRules.TargetType.Editor) ? "Editor" : "" ), InGameName: InGameName, InPlatform: InPlatform, InConfiguration: InConfiguration, InRulesObject: InRulesObject, InAdditionalDefinitions: InAdditionalDefinitions, InRemoteRoot: InRemoteRoot, InOnlyModules: InOnlyModules, bInEditorRecompile: bInEditorRecompile ) { }
public override bool WriteProjectFile(List <UnrealTargetPlatform> InPlatforms, List <UnrealTargetConfiguration> InConfigurations) { bool bSuccess = false; var TargetName = ProjectFilePath.GetFileNameWithoutExtension(); FileReference GameProjectPath = null; List <DirectoryReference> GameFolders = UEBuildTarget.DiscoverAllGameFolders(); foreach (var GameFolder in GameFolders) { FileReference UProjectPath = FileReference.Combine(GameFolder, TargetName + ".uproject"); if (FileReference.Exists(UProjectPath)) { GameProjectPath = UProjectPath; break; } } var ProjectFileContent = new StringBuilder(); ProjectFileContent.Append("# @Eddie Workset@" + ProjectFileGenerator.NewLine); ProjectFileContent.Append("AddWorkset \"" + this.ToString() + ".wkst\" \"" + ProjectFilePath.FullName + "\"" + ProjectFileGenerator.NewLine); ParseSourceFilesIntoGroups(); EmitProject(ProjectFileContent, Folders); bSuccess = ProjectFileGenerator.WriteFileIfChanged(ProjectFilePath.FullName, ProjectFileContent.ToString(), new UTF8Encoding()); return(bSuccess); }
/** * Get a list of extra modules the platform requires. * This is to allow undisclosed platforms to add modules they need without exposing information about the platfomr. * * @param Target The target being build * @param BuildTarget The UEBuildTarget getting build * @param PlatformExtraModules OUTPUT the list of extra modules the platform needs to add to the target */ public override void GetExtraModules(TargetInfo Target, UEBuildTarget BuildTarget, ref List <string> PlatformExtraModules) { if (Target.Platform == UnrealTargetPlatform.WinRT) { PlatformExtraModules.Add("XAudio2"); } }
/// <summary> /// Finds the names of files directly included by the given C++ file, and also whether the file contains any UObjects /// </summary> public static List <DependencyInclude> GetDirectIncludeDependencies(UEBuildTarget Target, FileItem CPPFile, UEBuildPlatform BuildPlatform, bool bOnlyCachedDependencies) { // Try to fulfill request from cache first. List <DependencyInclude> Info = IncludeDependencyCache[Target].GetCachedDependencyInfo(CPPFile); if (Info != null) { return(Info); } List <DependencyInclude> Result = new List <DependencyInclude>(); if (bOnlyCachedDependencies) { return(Result); } DateTime TimerStartTime = DateTime.UtcNow; ++CPPEnvironment.TotalDirectIncludeCacheMisses; Result = GetUncachedDirectIncludeDependencies(CPPFile, BuildPlatform, Target.ProjectFile); // Populate cache with results. IncludeDependencyCache[Target].SetDependencyInfo(CPPFile, Result); CPPEnvironment.DirectIncludeCacheMissesTotalTime += (DateTime.UtcNow - TimerStartTime).TotalSeconds; return(Result); }
/// <summary> /// Setup the target environment for building /// </summary> /// <param name="InBuildTarget"> The target being built</param> public override void SetUpEnvironment(UEBuildTarget InBuildTarget) { if (GetActiveArchitecture() == "-win32") { InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCMT"); } InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_HTML5=1"); if (InBuildTarget.GlobalCompileEnvironment.Config.Target.Architecture == "-win32") { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_HTML5_WIN32=1"); InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("delayimp.lib"); } else { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_HTML5_BROWSER=1"); } // @todo needed? InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("UNICODE"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("_UNICODE"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_AUTOMATION_WORKER=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("REQUIRES_ALIGNED_INT_ACCESS"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_OGGVORBIS=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("USE_SCENE_LOCK=0"); BuildConfiguration.bDeployAfterCompile = true; }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { string SourceSOName = InTarget.OutputPath; string DestApkName = InTarget.ProjectDirectory + "/Binaries/Android/" + Path.GetFileNameWithoutExtension(SourceSOName) + ".apk"; // don't run the whole MakeApk path if the .so and .java files aren't newer than the .apk, // so repeated uses of F5 in the debugger aren't painfully slow List<String> InputFiles = new List<string>(); InputFiles.Add(SourceSOName); string UE4BuildFilesPath = BuildConfiguration.RelativeEnginePath + "Build/Android/Java"; InputFiles.AddRange(Directory.EnumerateFiles(UE4BuildFilesPath + "/src/com/epicgames/ue4", "*.java", SearchOption.AllDirectories)); // look for any newer input file DateTime ApkTime = File.GetLastWriteTimeUtc(DestApkName); bool bAllInputsCurrent = true; foreach (var InputFileName in InputFiles) { DateTime InputFileTime = File.GetLastWriteTimeUtc(InputFileName); if (InputFileTime.CompareTo(ApkTime) > 0) { // could break here bAllInputsCurrent = false; break; } } if (bAllInputsCurrent) { Log.TraceInformation("{0} is up to date (compared to the .so and .java input files)", DestApkName); return true; } return PrepForUATPackageOrDeploy(InTarget.AppName, InTarget.ProjectDirectory, InTarget.OutputPath, BuildConfiguration.RelativeEnginePath, false); }
protected void AddPrerequisiteSourceFile(UEBuildTarget Target, IUEBuildPlatform BuildPlatform, CPPEnvironment CompileEnvironment, FileItem SourceFile, List <FileItem> PrerequisiteItems) { PrerequisiteItems.Add(SourceFile); var RemoteThis = this as RemoteToolChain; bool bAllowUploading = RemoteThis != null && BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac; // Don't use remote features when compiling from a Mac if (bAllowUploading) { RemoteThis.QueueFileForBatchUpload(SourceFile); } if (!BuildConfiguration.bUseExperimentalFastBuildIteration) // In fast build iteration mode, we'll gather includes later on { // @todo fastubt: What if one of the prerequisite files has become missing since it was updated in our cache? (usually, because a coder eliminated the source file) // -> Two CASES: // 1) NOT WORKING: Non-unity file went away (SourceFile in this context). That seems like an existing old use case. Compile params or Response file should have changed? // 2) WORKING: Indirect file went away (unity'd original source file or include). This would return a file that no longer exists and adds to the prerequiteitems list var IncludedFileList = CPPEnvironment.FindAndCacheAllIncludedFiles(Target, SourceFile, BuildPlatform, CompileEnvironment.Config.CPPIncludeInfo, bOnlyCachedDependencies: BuildConfiguration.bUseExperimentalFastDependencyScan); foreach (FileItem IncludedFile in IncludedFileList) { PrerequisiteItems.Add(IncludedFile); if (bAllowUploading && !BuildConfiguration.bUseExperimentalFastDependencyScan) // With fast dependency scanning, we will not have an exhaustive list of dependencies here. We rely on PostCodeGeneration() to upload these files. { RemoteThis.QueueFileForBatchUpload(IncludedFile); } } } }
/** * Setup the target environment for building * * @param InBuildTarget The target being built */ public override void SetUpEnvironment(UEBuildTarget InBuildTarget) { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_DESKTOP=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_64BITS=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("EXCEPTIONS_DISABLED=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("_WIN32_WINNT=0x0A00"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WINVER=0x0A00"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_UWP=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("UWP=1"); // @todo UWP: This used to be "WINUAP=1". Need to verify that 'UWP' is the correct define that we want here. if (bWinApiFamilyApp) { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WINAPI_FAMILY=WINAPI_FAMILY_APP"); } // @todo UWP: UE4 is non-compliant when it comes to use of %s and %S // Previously %s meant "the current character set" and %S meant "the other one". // Now %s means multibyte and %S means wide. %Ts means "natural width". // Reverting this behavior until the UE4 source catches up. InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("_CRT_STDIO_LEGACY_WIDE_SPECIFIERS=1"); // No D3DX on UWP! InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("NO_D3DX_LIBS=1"); if (InBuildTarget.Rules != null) { // Explicitly exclude the MS C++ runtime libraries we're not using, to ensure other libraries we link with use the same // runtime library as the engine. if (InBuildTarget.Configuration == UnrealTargetConfiguration.Debug && BuildConfiguration.bDebugBuildsActuallyUseDebugCRT) { InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("MSVCRT"); InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("MSVCPRT"); } else { InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("MSVCRTD"); InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("MSVCPRTD"); } InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBC"); InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCMT"); InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCPMT"); InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCP"); InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCD"); InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCMTD"); InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCPMTD"); InBuildTarget.GlobalLinkEnvironment.Config.ExcludedLibraries.Add("LIBCPD"); } InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("mincore.lib"); InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("dloadhelper.lib"); // Disable Simplygon support if compiling against the NULL RHI. if (InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Contains("USE_NULL_RHI=1")) { UEBuildConfiguration.bCompileSimplygon = false; } }
public static IUEToolChain GetPlatformToolChain(CPPTargetPlatform Platform) { UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(UEBuildTarget.CPPTargetPlatformToUnrealTargetPlatform(Platform)); UEBuildPlatformContext Context = BuildPlatform.CreateContext(null); return(Context.CreateToolChain(BuildPlatform.DefaultCppPlatform)); }
/// <summary> /// Create an instance initialized to the given configuration /// </summary> /// <param name="InConfig">The build binary configuration to initialize the instance to</param> public UEBuildBinaryCPP(UEBuildTarget InTarget, UEBuildBinaryConfiguration InConfig) : base(InTarget, InConfig) { ModuleNames = new HashSet <string>(InConfig.ModuleNames); bCreateImportLibrarySeparately = InConfig.bCreateImportLibrarySeparately; bIncludeDependentLibrariesInLibrary = InConfig.bIncludeDependentLibrariesInLibrary; }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { string SubDir = GetTargetPlatformName(); string GameName = InTarget.TargetName; string BuildPath = (GameName == "UE4Game" ? "../../Engine" : InTarget.ProjectDirectory.FullName) + "/Binaries/" + SubDir; string ProjectDirectory = InTarget.ProjectDirectory.FullName; bool bIsUE4Game = GameName.Contains("UE4Game"); string DecoratedGameName; if (InTarget.Configuration == UnrealTargetConfiguration.Development) { DecoratedGameName = GameName; } else { DecoratedGameName = String.Format("{0}-{1}-{2}", GameName, InTarget.Platform.ToString(), InTarget.Configuration.ToString()); } if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac && Environment.GetEnvironmentVariable("UBT_NO_POST_DEPLOY") != "true") { return(PrepForUATPackageOrDeploy(InTarget.ProjectFile, GameName, ProjectDirectory, BuildPath + "/" + DecoratedGameName, "../../Engine", false, "", false)); } else { // @todo tvos merge: This used to copy the bundle back - where did that code go? It needs to be fixed up for TVOS directories GeneratePList(ProjectDirectory, bIsUE4Game, GameName, (InTarget.ProjectFile == null) ? "" : Path.GetFileNameWithoutExtension(InTarget.ProjectFile.FullName), "../../Engine", ""); } return(true); }
/// <summary> /// Creates a cache hierarchy for a particular target /// </summary> /// <param name="ProjectFile">Project file for the target being built</param> /// <param name="TargetName">Name of the target</param> /// <param name="Platform">Platform being built</param> /// <param name="Configuration">Configuration being built</param> /// <param name="TargetType">The target type</param> /// <param name="Architecture">The target architecture</param> /// <returns>Dependency cache hierarchy for the given project</returns> public static CppDependencyCache CreateHierarchy(FileReference ProjectFile, string TargetName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, TargetType TargetType, string Architecture) { CppDependencyCache Cache = null; if (ProjectFile == null || !UnrealBuildTool.IsEngineInstalled()) { string AppName; if (TargetType == TargetType.Program) { AppName = TargetName; } else { AppName = UEBuildTarget.GetAppNameForTargetType(TargetType); } FileReference EngineCacheLocation = FileReference.Combine(UnrealBuildTool.EngineDirectory, UEBuildTarget.GetPlatformIntermediateFolder(Platform, Architecture), AppName, Configuration.ToString(), "DependencyCache.bin"); Cache = FindOrAddCache(EngineCacheLocation, UnrealBuildTool.EngineDirectory, Cache); } if (ProjectFile != null) { FileReference ProjectCacheLocation = FileReference.Combine(ProjectFile.Directory, UEBuildTarget.GetPlatformIntermediateFolder(Platform, Architecture), TargetName, Configuration.ToString(), "DependencyCache.bin"); Cache = FindOrAddCache(ProjectCacheLocation, ProjectFile.Directory, Cache); } return(Cache); }
/// <summary> /// Write C++ toolchain information to JSON writer /// </summary> /// <param name="Target"></param> /// <param name="Writer"></param> private static void ExportEnvironmentToJson(UEBuildTarget Target, JsonWriter Writer) { CppCompileEnvironment GlobalCompileEnvironment = Target.CreateCompileEnvironmentForProjectFiles(); Writer.WriteArrayStart("EnvironmentIncludePaths"); foreach (DirectoryReference Path in GlobalCompileEnvironment.UserIncludePaths) { Writer.WriteValue(Path.FullName); } foreach (DirectoryReference Path in GlobalCompileEnvironment.SystemIncludePaths) { Writer.WriteValue(Path.FullName); } // TODO: get corresponding includes for specific platforms if (UEBuildPlatform.IsPlatformInGroup(Target.Platform, UnrealPlatformGroup.Windows)) { foreach (DirectoryReference Path in Target.Rules.WindowsPlatform.Environment.IncludePaths) { Writer.WriteValue(Path.FullName); } } Writer.WriteArrayEnd(); Writer.WriteArrayStart("EnvironmentDefinitions"); foreach (string Definition in GlobalCompileEnvironment.Definitions) { Writer.WriteValue(Definition); } Writer.WriteArrayEnd(); }
/// <summary> /// Setup the target environment for building /// </summary> /// <param name="InBuildTarget"> The target being built</param> public override void SetUpEnvironment(UEBuildTarget InBuildTarget) { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_LINUX=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("LINUX=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_DATABASE_SUPPORT=0"); //@todo linux: valid? if (GetActiveArchitecture().StartsWith("arm")) { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("REQUIRES_ALIGNED_INT_ACCESS"); } // link with Linux libraries. InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("pthread"); // Disable Simplygon support if compiling against the NULL RHI. if (InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Contains("USE_NULL_RHI=1")) { UEBuildConfiguration.bCompileSimplygon = false; UEBuildConfiguration.bCompileSimplygonSSF = false; } if (InBuildTarget.TargetType == TargetRules.TargetType.Server) { // Localization shouldn't be needed on servers by default, and ICU is pretty heavy UEBuildConfiguration.bCompileICU = false; } }
/// <summary> /// Generates a full path to action history file for the specified target. /// </summary> public static FileReference GeneratePathForTarget(UEBuildTarget Target) { DirectoryReference Folder = null; if (Target.ShouldCompileMonolithic() || Target.TargetType == TargetRules.TargetType.Program) { // Monolithic configs and programs have their Action History stored in their respective project folders // or under engine intermediate folder + program name folder DirectoryReference RootDirectory; if (Target.ProjectFile != null) { RootDirectory = Target.ProjectFile.Directory; } else { RootDirectory = UnrealBuildTool.EngineDirectory; } Folder = DirectoryReference.Combine(RootDirectory, BuildConfiguration.PlatformIntermediateFolder, Target.GetTargetName()); } else { // Shared action history (unless this is an installed build target) Folder = (UnrealBuildTool.IsEngineInstalled() && Target.ProjectFile != null) ? DirectoryReference.Combine(Target.ProjectFile.Directory, BuildConfiguration.BaseIntermediateFolder) : DirectoryReference.Combine(UnrealBuildTool.EngineDirectory, BuildConfiguration.BaseIntermediateFolder); } return(FileReference.Combine(Folder, "ActionHistory.bin")); }
/// <summary> /// Setup the target environment for building /// </summary> /// <param name="InBuildTarget"> The target being built</param> public override void SetUpEnvironment(UEBuildTarget InBuildTarget) { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_LINUX=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("LINUX=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_SUPPORTS_JEMALLOC=1"); // this define does not set jemalloc as default, just indicates its support InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_DATABASE_SUPPORT=0"); //@todo linux: valid? if (GetActiveArchitecture().StartsWith("arm")) // AArch64 doesn't strictly need that - aligned access improves perf, but this will be likely offset by memcpys we're doing to guarantee it. { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("REQUIRES_ALIGNED_INT_ACCESS"); } // link with Linux libraries. InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("pthread"); // Disable Simplygon support if compiling against the NULL RHI. if (InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Contains("USE_NULL_RHI=1")) { UEBuildConfiguration.bCompileSimplygon = false; UEBuildConfiguration.bCompileSimplygonSSF = false; } // At the moment ICU has not been compiled for AArch64. Also, localization isn't needed on servers by default, and ICU is pretty heavy if (GetActiveArchitecture().StartsWith("aarch64") || InBuildTarget.TargetType == TargetRules.TargetType.Server) { UEBuildConfiguration.bCompileICU = false; } }
/// <summary> /// Setup the target environment for building /// </summary> /// <param name="InBuildTarget"> The target being built</param> public override void SetUpEnvironment(UEBuildTarget InBuildTarget) { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_IOS=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_APPLE=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_TTS=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_SPEECH_RECOGNITION=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_DATABASE_SUPPORT=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_EDITOR=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("USE_NULL_RHI=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("REQUIRES_ALIGNED_INT_ACCESS"); if (GetActiveArchitecture() == "-simulator") { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_SIMULATOR=1"); } // we assume now we are building with IOS8 or later if (UEBuildConfiguration.bCompileAgainstEngine) { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("HAS_METAL=1"); InBuildTarget.ExtraModuleNames.Add("MetalRHI"); } else { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("HAS_METAL=0"); } InBuildTarget.GlobalLinkEnvironment.Config.AdditionalFrameworks.Add(new UEBuildFramework("GameKit")); InBuildTarget.GlobalLinkEnvironment.Config.AdditionalFrameworks.Add(new UEBuildFramework("StoreKit")); }
/** * Setup the configuration environment for building * * @param InBuildTarget The target being built */ public override void SetUpConfigurationEnvironment(UEBuildTarget InBuildTarget) { // Determine the C++ compile/link configuration based on the Unreal configuration. CPPTargetConfiguration CompileConfiguration; //@todo SAS: Add a true Debug mode! UnrealTargetConfiguration CheckConfig = InBuildTarget.Configuration; switch (CheckConfig) { default: case UnrealTargetConfiguration.Debug: CompileConfiguration = CPPTargetConfiguration.Debug; if (BuildConfiguration.bDebugBuildsActuallyUseDebugCRT) { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("_DEBUG=1"); // the engine doesn't use this, but lots of 3rd party stuff does } else { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("NDEBUG=1"); // the engine doesn't use this, but lots of 3rd party stuff does } InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("UE_BUILD_DEBUG=1"); break; case UnrealTargetConfiguration.DebugGame: // Default to Development; can be overriden by individual modules. case UnrealTargetConfiguration.Development: CompileConfiguration = CPPTargetConfiguration.Development; InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("NDEBUG=1"); // the engine doesn't use this, but lots of 3rd party stuff does InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("UE_BUILD_DEVELOPMENT=1"); break; case UnrealTargetConfiguration.Shipping: CompileConfiguration = CPPTargetConfiguration.Shipping; InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("NDEBUG=1"); // the engine doesn't use this, but lots of 3rd party stuff does InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("UE_BUILD_SHIPPING=1"); break; case UnrealTargetConfiguration.Test: CompileConfiguration = CPPTargetConfiguration.Shipping; InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("NDEBUG=1"); // the engine doesn't use this, but lots of 3rd party stuff does InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("UE_BUILD_TEST=1"); break; } // Set up the global C++ compilation and link environment. InBuildTarget.GlobalCompileEnvironment.Config.Target.Configuration = CompileConfiguration; InBuildTarget.GlobalLinkEnvironment.Config.Target.Configuration = CompileConfiguration; // Create debug info based on the heuristics specified by the user. InBuildTarget.GlobalCompileEnvironment.Config.bCreateDebugInfo = !BuildConfiguration.bDisableDebugInfo && ShouldCreateDebugInfo(InBuildTarget.Platform, CheckConfig); // NOTE: Even when debug info is turned off, we currently force the linker to generate debug info // anyway on Visual C++ platforms. This will cause a PDB file to be generated with symbols // for most of the classes and function/method names, so that crashes still yield somewhat // useful call stacks, even though compiler-generate debug info may be disabled. This gives // us much of the build-time savings of fully-disabled debug info, without giving up call // data completely. InBuildTarget.GlobalLinkEnvironment.Config.bCreateDebugInfo = true; }
/// <summary> /// Creates the cache object /// </summary> /// <param name="Target">The target to create the cache for</param> /// <returns>The new instance</returns> public static FlatCPPIncludeDependencyCache Create(UEBuildTarget Target) { string CachePath = FlatCPPIncludeDependencyCache.GetDependencyCachePathForTarget(Target);; // See whether the cache file exists. FileItem Cache = FileItem.GetItemByPath(CachePath); if (Cache.bExists) { if (BuildConfiguration.bPrintPerformanceInfo) { Log.TraceInformation("Loading existing FlatCPPIncludeDependencyCache: " + Cache.AbsolutePath); } var TimerStartTime = DateTime.UtcNow; // Deserialize cache from disk if there is one. FlatCPPIncludeDependencyCache Result = Load(Cache); if (Result != null) { var TimerDuration = DateTime.UtcNow - TimerStartTime; if (BuildConfiguration.bPrintPerformanceInfo) { Log.TraceInformation("Loading FlatCPPIncludeDependencyCache took " + TimerDuration.TotalSeconds + "s"); } return(Result); } } // Fall back to a clean cache on error or non-existence. return(new FlatCPPIncludeDependencyCache(Cache)); }
private static void SerializeTarget(FileReference OutputFile, UEBuildTarget BuildTarget) { DirectoryReference.CreateDirectory(OutputFile.Directory); using (JsonWriter Writer = new JsonWriter(OutputFile)) { ExportTarget(BuildTarget, Writer); } }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { // we need to strip architecture from any of the output paths string BaseSoName = AndroidToolChain.RemoveArchName(InTarget.OutputPaths[0]); // this always makes a merged .apk since for debugging, there's no way to know which one to run MakeApk(InTarget.AppName, InTarget.ProjectDirectory, BaseSoName, BuildConfiguration.RelativeEnginePath, bForDistribution:false, CookFlavor:"", bMakeSeparateApks:false); return true; }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { // we need to strip architecture from any of the output paths string BaseSoName = AndroidToolChain.RemoveArchName(InTarget.OutputPaths[0]); // this always makes a merged .apk since for debugging, there's no way to know which one to run MakeApk(InTarget.AppName, InTarget.ProjectDirectory, BaseSoName, BuildConfiguration.RelativeEnginePath, bForDistribution: false, CookFlavor: "", bMakeSeparateApks: false); return(true); }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { string InAppName = InTarget.AppName; Log.TraceInformation("Prepping {0} for deployment to {1}", InAppName, InTarget.Platform.ToString()); System.DateTime PrepDeployStartTime = DateTime.UtcNow; string TargetFilename = InTarget.RulesAssembly.GetTargetFileName(InAppName).FullName; string ProjectSourceFolder = new FileInfo(TargetFilename).DirectoryName + "/"; string RelativeTargetDirectory; string EngineSourceRelativeBinaryPath; UWPProjectGenerator.GetTargetUWPPaths(InTarget.RulesAssembly, InAppName, InTarget.Rules, out EngineSourceRelativeBinaryPath, out RelativeTargetDirectory); PrepForUATPackageOrDeploy(InAppName, InTarget.ProjectDirectory.FullName, InTarget.OutputPath.FullName, BuildConfiguration.RelativeEnginePath, false, ""); // TODO - richiem - restore this if we find that it's needed. //Log.TraceInformation("...copying the CELL dll..."); //string CELLPath = "../../../Engine/Source/" + UEBuildConfiguration.UEThirdPartySourceDirectory + "CELL/lib/win64/"; //string CELLPathRelease = CELLPath + "Release/"; //string CELLDllRelease = "CommonEventLoggingLibrary.dll"; //string CELLPathDebug = CELLPath + "Debug/"; //string CELLDllDebug = "CommonEventLoggingLibraryd.dll"; //CopyFile(EngineSourceRelativeBinaryPath + CELLPathRelease + CELLDllRelease, EngineSourceRelativeBinaryPath + CELLDllRelease, true); //CopyFile(EngineSourceRelativeBinaryPath + CELLPathDebug + CELLDllDebug, EngineSourceRelativeBinaryPath + CELLDllDebug, true); //string XSAPIPath = EngineSourceRelativeBinaryPath + "../../../Engine/Source/ThirdParty/XSAPI/lib/"; //string XboxServicesConfig = "xboxservices.config"; //string DesktopLogin = "******"; //Log.TraceInformation("...copying xboxservices.config"); //CopyFile(XSAPIPath + XboxServicesConfig, EngineSourceRelativeBinaryPath + XboxServicesConfig, true); //Log.TraceInformation("...copying DesktopLogin.exe..."); //CopyFile(XSAPIPath + DesktopLogin, EngineSourceRelativeBinaryPath + DesktopLogin, true); // TODO - richiem - restore this if we find that it's needed. //if (InTarget.Configuration == UnrealTargetConfiguration.Development) //{ // Log.TraceInformation("...copying AutoLogin..."); // string AutoLoginPath = EngineSourceRelativeBinaryPath + "../../../Engine/Source/Tools/AutoLogin/"; // string AutoLoginDLL = "AutoLogin.dll"; // string AutoLoginBat = "AutoLogin.bat"; // CopyFile(AutoLoginPath + "bin/Debug/" + AutoLoginDLL, EngineSourceRelativeBinaryPath + AutoLoginDLL, true); // CopyFile(AutoLoginPath + AutoLoginBat, EngineSourceRelativeBinaryPath + AutoLoginBat, true); //} // Log out the time taken to deploy... double PrepDeployDuration = (DateTime.UtcNow - PrepDeployStartTime).TotalSeconds; Log.TraceInformation("UWP deployment preparation took {0:0.00} seconds", PrepDeployDuration); return(true); }
/** * Setup the target environment for building * * @param InBuildTarget The target being built */ public override void SetUpEnvironment(UEBuildTarget InBuildTarget) { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_MAC=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_APPLE=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_TTS=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_SPEECH_RECOGNITION=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_DATABASE_SUPPORT=0"); }
public static List <FileItem> FindAndCacheAllIncludedFiles(UEBuildTarget Target, FileItem SourceFile, UEBuildPlatform BuildPlatform, CPPIncludeInfo CPPIncludeInfo, bool bOnlyCachedDependencies) { List <FileItem> Result = null; if (CPPIncludeInfo.IncludeFileSearchDictionary == null) { CPPIncludeInfo.IncludeFileSearchDictionary = new Dictionary <string, FileItem>(); } bool bUseFlatCPPIncludeDependencyCache = BuildConfiguration.bUseUBTMakefiles && UnrealBuildTool.IsAssemblingBuild; if (bOnlyCachedDependencies && bUseFlatCPPIncludeDependencyCache) { Result = FlatCPPIncludeDependencyCache[Target].GetDependenciesForFile(SourceFile.Reference); if (Result == null) { // Nothing cached for this file! It is new to us. This is the expected flow when our CPPIncludeDepencencyCache is missing. } } else { // @todo ubtmake: HeaderParser.h is missing from the include set for Module.UnrealHeaderTool.cpp (failed to find include using: FileItem DirectIncludeResolvedFile = CPPEnvironment.FindIncludedFile(DirectInclude.IncludeName, !BuildConfiguration.bCheckExternalHeadersForModification, IncludePathsToSearch, IncludeFileSearchDictionary );) // If we're doing an exhaustive include scan, make sure that we have our include dependency cache loaded and ready if (!bOnlyCachedDependencies) { if (!IncludeDependencyCache.ContainsKey(Target)) { IncludeDependencyCache.Add(Target, DependencyCache.Create(DependencyCache.GetDependencyCachePathForTarget(Target))); } } Result = new List <FileItem>(); IncludedFilesSet IncludedFileList = new IncludedFilesSet(); CPPEnvironment.FindAndCacheAllIncludedFiles(Target, SourceFile, BuildPlatform, CPPIncludeInfo, ref IncludedFileList, bOnlyCachedDependencies: bOnlyCachedDependencies); foreach (FileItem IncludedFile in IncludedFileList) { Result.Add(IncludedFile); } // Update cache if (bUseFlatCPPIncludeDependencyCache && !bOnlyCachedDependencies) { List <FileReference> Dependencies = new List <FileReference>(); foreach (FileItem IncludedFile in Result) { Dependencies.Add(IncludedFile.Reference); } FileReference PCHName = SourceFile.PrecompiledHeaderIncludeFilename; FlatCPPIncludeDependencyCache[Target].SetDependenciesForFile(SourceFile.Reference, PCHName, Dependencies); } } return(Result); }
/// <summary> /// Write a Target to a JSON writer. Is array is empty, don't write anything /// </summary> /// <param name="Target"></param> /// <param name="Writer">Writer for the array data</param> private static void ExportTarget(UEBuildTarget Target, JsonWriter Writer) { Writer.WriteObjectStart(); Writer.WriteValue("Name", Target.TargetName); Writer.WriteValue("Configuration", Target.Configuration.ToString()); Writer.WriteValue("Platform", Target.Platform.ToString()); Writer.WriteValue("TargetFile", Target.TargetRulesFile.FullName); if (Target.ProjectFile != null) { Writer.WriteValue("ProjectFile", Target.ProjectFile.FullName); } ExportEnvironmentToJson(Target, Writer); if (Target.Binaries.Any()) { Writer.WriteArrayStart("Binaries"); foreach (UEBuildBinary Binary in Target.Binaries) { Writer.WriteObjectStart(); ExportBinary(Binary, Writer); Writer.WriteObjectEnd(); } Writer.WriteArrayEnd(); } CppCompileEnvironment GlobalCompileEnvironment = Target.CreateCompileEnvironmentForProjectFiles(); HashSet <string> ModuleNames = new HashSet <string>(); Writer.WriteObjectStart("Modules"); foreach (UEBuildBinary Binary in Target.Binaries) { CppCompileEnvironment BinaryCompileEnvironment = Binary.CreateBinaryCompileEnvironment(GlobalCompileEnvironment); foreach (UEBuildModule Module in Binary.Modules) { if (ModuleNames.Add(Module.Name)) { Writer.WriteObjectStart(Module.Name); ExportModule(Module, Binary.OutputDir, Target.GetExecutableDir(), Writer); UEBuildModuleCPP ModuleCpp = Module as UEBuildModuleCPP; if (ModuleCpp != null) { CppCompileEnvironment ModuleCompileEnvironment = ModuleCpp.CreateCompileEnvironmentForIntellisense(Target.Rules, BinaryCompileEnvironment); ExportModuleCpp(ModuleCpp, ModuleCompileEnvironment, Writer); } Writer.WriteObjectEnd(); } } } Writer.WriteObjectEnd(); ExportPluginsFromTarget(Target, Writer); Writer.WriteObjectEnd(); }
// UEBuildBinary interface. /// <summary> /// Creates all the modules referenced by this target. /// </summary> public override void CreateAllDependentModules(UEBuildTarget Target) { if (Config.bHasModuleRules) { foreach (UEBuildModule Module in Modules) { Module.RecursivelyCreateModules(Target); } } }
/// <summary> /// Write project file info in JSON file. /// For every combination of <c>UnrealTargetPlatform</c>, <c>UnrealTargetConfiguration</c> and <c>TargetType</c> /// will be generated separate JSON file. /// Project file will be stored: /// For UE4: {UE4Root}/Engine/Intermediate/ProjectFiles/.Rider/{Platform}/{Configuration}/{TargetType}/{ProjectName}.json /// For game: {GameRoot}/Intermediate/ProjectFiles/.Rider/{Platform}/{Configuration}/{TargetType}/{ProjectName}.json /// </summary> /// <remarks> /// * <c>UnrealTargetPlatform.Win32</c> will be always ignored. /// * <c>TargetType.Editor</c> will be generated for current platform only and will ignore <c>UnrealTargetConfiguration.Test</c> and <c>UnrealTargetConfiguration.Shipping</c> configurations /// * <c>TargetType.Program</c> will be generated for current platform only and <c>UnrealTargetConfiguration.Development</c> configuration only /// </remarks> /// <param name="InPlatforms"></param> /// <param name="InConfigurations"></param> /// <param name="PlatformProjectGenerators"></param> /// <returns></returns> public override bool WriteProjectFile(List <UnrealTargetPlatform> InPlatforms, List <UnrealTargetConfiguration> InConfigurations, PlatformProjectGeneratorCollection PlatformProjectGenerators) { string ProjectName = ProjectFilePath.GetFileNameWithoutAnyExtensions(); DirectoryReference projectRootFolder = DirectoryReference.Combine(RootPath, ".Rider"); List <Tuple <FileReference, UEBuildTarget> > fileToTarget = new List <Tuple <FileReference, UEBuildTarget> >(); foreach (UnrealTargetPlatform Platform in InPlatforms.Where(it => it != UnrealTargetPlatform.Win32)) { foreach (UnrealTargetConfiguration Configuration in InConfigurations) { foreach (ProjectTarget ProjectTarget in ProjectTargets) { if (TargetTypes.Any() && !TargetTypes.Contains(ProjectTarget.TargetRules.Type)) { continue; } // Skip Programs for all configs except for current platform + Development configuration if (ProjectTarget.TargetRules.Type == TargetType.Program && (BuildHostPlatform.Current.Platform != Platform || Configuration != UnrealTargetConfiguration.Development)) { continue; } // Skip Editor for all platforms except for current platform if (ProjectTarget.TargetRules.Type == TargetType.Editor && (BuildHostPlatform.Current.Platform != Platform || (Configuration == UnrealTargetConfiguration.Test || Configuration == UnrealTargetConfiguration.Shipping))) { continue; } DirectoryReference ConfigurationFolder = DirectoryReference.Combine(projectRootFolder, Platform.ToString(), Configuration.ToString()); DirectoryReference TargetFolder = DirectoryReference.Combine(ConfigurationFolder, ProjectTarget.TargetRules.Type.ToString()); string DefaultArchitecture = UEBuildPlatform .GetBuildPlatform(BuildHostPlatform.Current.Platform) .GetDefaultArchitecture(ProjectTarget.UnrealProjectFilePath); TargetDescriptor TargetDesc = new TargetDescriptor(ProjectTarget.UnrealProjectFilePath, ProjectTarget.Name, BuildHostPlatform.Current.Platform, UnrealTargetConfiguration.Development, DefaultArchitecture, Arguments); UEBuildTarget BuildTarget = UEBuildTarget.Create(TargetDesc, false, false); FileReference OutputFile = FileReference.Combine(TargetFolder, $"{ProjectName}.json"); fileToTarget.Add(Tuple.Create(OutputFile, BuildTarget)); } } } foreach (Tuple <FileReference, UEBuildTarget> tuple in fileToTarget) { SerializeTarget(tuple.Item1, tuple.Item2); } return(true); }
public override CPPOutput CompileRCFiles(UEBuildTarget Target, CPPEnvironment Environment, List <FileItem> RCFiles) { CPPOutput Result = new CPPOutput(); if (Environment.Config.Target.Architecture == "-win32") { return(base.CompileRCFiles(Target, Environment, RCFiles)); } return(Result); }
public static List <FileItem> FindAndCacheAllIncludedFiles(UEBuildTarget Target, FileItem SourceFile, IUEBuildPlatform BuildPlatform, CPPIncludeInfo CPPIncludeInfo, bool bOnlyCachedDependencies) { var Result = new List <FileItem>(); if (CPPIncludeInfo.IncludeFileSearchDictionary == null) { CPPIncludeInfo.IncludeFileSearchDictionary = new Dictionary <string, FileItem>(); } bool bUseFlatCPPIncludeDependencyCache = (BuildConfiguration.bUseExperimentalFastDependencyScan && (!BuildConfiguration.bUseExperimentalFastBuildIteration || UnrealBuildTool.IsAssemblingBuild)); if (bUseFlatCPPIncludeDependencyCache && bOnlyCachedDependencies) { var Dependencies = FlatCPPIncludeDependencyCache[Target].GetDependenciesForFile(SourceFile.AbsolutePath); if (Dependencies != null) { foreach (string Dependency in Dependencies) { Result.Add(FileItem.GetItemByFullPath(Dependency)); // @todo fastubt: Make sure this is as fast as possible (convert to FileItem) } } else { // Nothing cached for this file! It is new to us. This is the expected flow when our CPPIncludeDepencencyCache is missing. } } else { // @todo fastubt: HeaderParser.h is missing from the include set for Module.UnrealHeaderTool.cpp (failed to find include using: FileItem DirectIncludeResolvedFile = CPPEnvironment.FindIncludedFile(DirectInclude.IncludeName, !BuildConfiguration.bCheckExternalHeadersForModification, IncludePathsToSearch, IncludeFileSearchDictionary );) var IncludedFileList = new IncludedFilesSet(); CPPEnvironment.FindAndCacheAllIncludedFiles(Target, SourceFile, BuildPlatform, CPPIncludeInfo, ref IncludedFileList, bOnlyCachedDependencies: bOnlyCachedDependencies); foreach (FileItem IncludedFile in IncludedFileList) { Result.Add(IncludedFile); } // Update cache if (bUseFlatCPPIncludeDependencyCache && !bOnlyCachedDependencies) { var Dependencies = new List <string>(); foreach (var IncludedFile in Result) { Dependencies.Add(IncludedFile.AbsolutePath); } string PCHName = SourceFile.PrecompiledHeaderIncludeFilename; FlatCPPIncludeDependencyCache[Target].SetDependenciesForFile(SourceFile.AbsolutePath, PCHName, Dependencies); } } return(Result); }
/// <summary> /// Gets the dependency cache path and filename for the specified target. /// </summary> /// <param name="Target">Current build target</param> /// <returns>Cache Path</returns> public static string GetDependencyCachePathForTarget(UEBuildTarget Target) { string PlatformIntermediatePath = BuildConfiguration.PlatformIntermediatePath; if (UnrealBuildTool.HasUProjectFile()) { PlatformIntermediatePath = Path.Combine(UnrealBuildTool.GetUProjectPath(), BuildConfiguration.PlatformIntermediateFolder); } string CachePath = Path.Combine(PlatformIntermediatePath, Target.GetTargetName(), "DependencyCache.bin"); return(CachePath); }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { string SubDir = GetTargetPlatformName(); string GameName = InTarget.TargetName; string BuildPath = (GameName == "UE4Game" ? "../../Engine" : InTarget.ProjectDirectory.FullName) + "/Binaries/" + SubDir; string ProjectDirectory = InTarget.ProjectDirectory.FullName; bool bIsUE4Game = GameName.Contains("UE4Game"); string DecoratedGameName; if (InTarget.Configuration == UnrealTargetConfiguration.Development) { DecoratedGameName = GameName; } else { DecoratedGameName = String.Format("{0}-{1}-{2}", GameName, InTarget.Platform.ToString(), InTarget.Configuration.ToString()); } // Run through iOS APL file IOSPlatformContext PlatformContext = new IOSPlatformContext(InTarget.ProjectFile); PlatformContext.SetUpProjectEnvironment(InTarget.Configuration); string BaseSoName = InTarget.OutputPaths[0].FullName; // get the receipt UnrealTargetPlatform Platform = InTarget.Platform; UnrealTargetConfiguration Configuration = InTarget.Configuration; string ProjectBaseName = Path.GetFileName(BaseSoName).Replace("-" + Platform, "").Replace("-" + Configuration, "").Replace(".so", ""); string ReceiptFilename = TargetReceipt.GetDefaultPath(InTarget.ProjectDirectory.FullName, ProjectBaseName, Platform, Configuration, ""); Log.TraceInformation("Receipt Filename: {0}", ReceiptFilename); SetIOSPluginData(PlatformContext.ProjectArches, CollectPluginDataPaths(TargetReceipt.Read(ReceiptFilename))); string BundlePath = Path.Combine(ProjectDirectory, "Binaries", "IOS", "Payload", ProjectBaseName + ".app"); // Passing in true for distribution is not ideal here but given the way that ios packaging happens and this call chain it seems unavoidable for now, maybe there is a way to correctly pass it in that I can't find? UPL.Init(PlatformContext.ProjectArches, true, BuildConfiguration.RelativeEnginePath, BundlePath, ProjectDirectory); if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac && Environment.GetEnvironmentVariable("UBT_NO_POST_DEPLOY") != "true") { return(PrepForUATPackageOrDeploy(InTarget.ProjectFile, GameName, ProjectDirectory, BuildPath + "/" + DecoratedGameName, "../../Engine", false, "", false)); } else { // @todo tvos merge: This used to copy the bundle back - where did that code go? It needs to be fixed up for TVOS directories GeneratePList(ProjectDirectory, bIsUE4Game, GameName, (InTarget.ProjectFile == null) ? "" : Path.GetFileNameWithoutExtension(InTarget.ProjectFile.FullName), "../../Engine", ""); } return(true); }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { string GameName = InTarget.AppName; string BuildPath = InTarget.ProjectDirectory + "/Binaries/IOS"; string ProjectDirectory = InTarget.ProjectDirectory; if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac && Environment.GetEnvironmentVariable("UBT_NO_POST_DEPLOY") != "true") { string DecoratedGameName; if (InTarget.Configuration == UnrealTargetConfiguration.Development) { DecoratedGameName = GameName; } else { DecoratedGameName = String.Format("{0}-{1}-{2}", GameName, InTarget.Platform.ToString(), InTarget.Configuration.ToString()); } return PrepForUATPackageOrDeploy(GameName, ProjectDirectory, BuildPath + "/" + DecoratedGameName, "../../Engine", false, ""); } else { // If it is requested, send the app bundle back to the platform executing these commands. if (BuildConfiguration.bCopyAppBundleBackToDevice) { Log.TraceInformation("Copying binaries back to this device..."); IOSToolChain Toolchain = UEToolChain.GetPlatformToolChain(CPPTargetPlatform.IOS) as IOSToolChain; try { string BinaryDir = Path.GetDirectoryName(InTarget.OutputPath) + "\\"; if (BinaryDir.EndsWith(InTarget.AppName + "\\Binaries\\IOS\\") && InTarget.TargetType != TargetRules.TargetType.Game) { BinaryDir = BinaryDir.Replace(InTarget.TargetType.ToString(), "Game"); } // Get the app bundle's name string AppFullName = InTarget.AppName; if (InTarget.Configuration != UnrealTargetConfiguration.Development) { AppFullName += "-" + InTarget.Platform.ToString(); AppFullName += "-" + InTarget.Configuration.ToString(); } foreach (string BinaryPath in Toolchain.BuiltBinaries) { if (!BinaryPath.Contains("Dummy")) { RPCUtilHelper.CopyFile(Toolchain.ConvertPath(BinaryPath), BinaryPath, false); } } Log.TraceInformation("Copied binaries successfully."); } catch (Exception) { Log.TraceInformation("Copying binaries back to this device failed."); } } // install the provision /* string ProvisionWithPrefix = "../../Engine/Build/IOS/UE4Game.mobileprovision"; if (File.Exists(BuildPath + "/" + GameName + ".mobileprovision")) { ProvisionWithPrefix = BuildPath + "/" + GameName + ".mobileprovision"; } else { if (File.Exists(BuildPath + "/NotForLicensees/" + GameName + ".mobileprovision")) { ProvisionWithPrefix = BuildPath + "/NotForLicensees/" + GameName + ".mobileprovision"; } else if (!File.Exists(ProvisionWithPrefix)) { ProvisionWithPrefix = "../../Engine/Build/IOS/NotForLicensees/UE4Game.mobileprovision"; } } string LibraryDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/Apple Computer/MobileDevice/Provisioning Profiles/"; if (File.Exists(ProvisionWithPrefix)) { Directory.CreateDirectory(LibraryDir); File.Copy(ProvisionWithPrefix, LibraryDir + GameName + ".mobileprovision", true); FileInfo DestFileInfo = new FileInfo(LibraryDir + GameName + ".mobileprovision"); DestFileInfo.Attributes = DestFileInfo.Attributes & ~FileAttributes.ReadOnly; } // install the distribution provision ProvisionWithPrefix = "../../Engine/Build/IOS/UE4Game_Distro.mobileprovision"; if (File.Exists(BuildPath + "/" + GameName + "_Distro.mobileprovision")) { ProvisionWithPrefix = BuildPath + "/" + GameName + "_Distro.mobileprovision"; } else { if (File.Exists(BuildPath + "/NotForLicensees/" + GameName + "_Distro.mobileprovision")) { ProvisionWithPrefix = BuildPath + "/NotForLicensees/" + GameName + "_Distro.mobileprovision"; } else if (!File.Exists(ProvisionWithPrefix)) { ProvisionWithPrefix = "../../Engine/Build/IOS/NotForLicensees/UE4Game_Distro.mobileprovision"; } } if (File.Exists(ProvisionWithPrefix)) { File.Copy(ProvisionWithPrefix, LibraryDir + GameName + "_Distro.mobileprovision", true); FileInfo DestFileInfo = new FileInfo(LibraryDir + GameName + "_Distro.mobileprovision"); DestFileInfo.Attributes = DestFileInfo.Attributes & ~FileAttributes.ReadOnly; }*/ } return true; }
/** * Setup the binaries for this specific platform. * * @param InBuildTarget The target being built */ public override void SetupBinaries(UEBuildTarget InBuildTarget) { }
/** * Setup the target environment for building * * @param InBuildTarget The target being built */ public override void SetUpEnvironment(UEBuildTarget InBuildTarget) { InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_OGGVORBIS=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("UNICODE"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("_UNICODE"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_LINUX=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("LINUX=1"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_DATABASE_SUPPORT=0"); //@todo android: valid? InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_EDITOR=0"); InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("USE_NULL_RHI=1"); // link with Linux libraries. InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("pthread"); InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("z"); UEBuildConfiguration.bCompileSimplygon = false; }
/** * Get a list of extra modules the platform requires. * This is to allow undisclosed platforms to add modules they need without exposing information about the platfomr. * * @param Target The target being build * @param BuildTarget The UEBuildTarget getting build * @param PlatformExtraModules OUTPUT the list of extra modules the platform needs to add to the target */ public override void GetExtraModules(TargetInfo Target, UEBuildTarget BuildTarget, ref List<string> PlatformExtraModules) { }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { Log.TraceInformation("Deploying now!"); string IntermediateDirectory = InTarget.AppName + "/Intermediate/Build/Mac/" + InTarget.AppName + "/" + InTarget.Configuration; if (!Directory.Exists("../../" + IntermediateDirectory)) { IntermediateDirectory = "Engine/Intermediate/Build/Mac/" + InTarget.AppName + "/" + InTarget.Configuration; } MacToolChain Toolchain = UEToolChain.GetPlatformToolChain(CPPTargetPlatform.Mac) as MacToolChain; string FixDylibDepsScript = Path.Combine(IntermediateDirectory, "FixDylibDependencies.sh"); string CreateAppBundleScript = Path.Combine(IntermediateDirectory, "CreateAppBundle.sh"); string RemoteWorkingDir = ""; bool bIsStaticLibrary = InTarget.OutputPath.EndsWith(".a"); if (BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac) { if (!bIsStaticLibrary) { // Copy the command scripts to the intermediate on the target Mac. string RemoteFixDylibDepsScript = Toolchain.ConvertPath(Path.GetFullPath(FixDylibDepsScript)); RemoteFixDylibDepsScript = RemoteFixDylibDepsScript.Replace("../../../../", "../../"); RPCUtilHelper.CopyFile("../../" + FixDylibDepsScript, RemoteFixDylibDepsScript, true); if (!InTarget.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication) { string RemoteCreateAppBundleScript = Toolchain.ConvertPath(Path.GetFullPath(CreateAppBundleScript)); RemoteCreateAppBundleScript = RemoteCreateAppBundleScript.Replace("../../../../", "../../"); RPCUtilHelper.CopyFile("../../" + CreateAppBundleScript, RemoteCreateAppBundleScript, true); } // run it remotely RemoteWorkingDir = Toolchain.ConvertPath(Path.GetDirectoryName(Path.GetFullPath(FixDylibDepsScript))); Log.TraceInformation("Running FixDylibDependencies.sh..."); Hashtable Results = RPCUtilHelper.Command(RemoteWorkingDir, "/bin/sh", "FixDylibDependencies.sh", null); if (Results != null) { string Result = (string)Results["CommandOutput"]; if (Result != null) { Log.TraceInformation(Result); } } if (!InTarget.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication) { Log.TraceInformation("Running CreateAppBundle.sh..."); Results = RPCUtilHelper.Command(RemoteWorkingDir, "/bin/sh", "CreateAppBundle.sh", null); if (Results != null) { string Result = (string)Results["CommandOutput"]; if (Result != null) { Log.TraceInformation(Result); } } } } // If it is requested, send the app bundle back to the platform executing these commands. if (BuildConfiguration.bCopyAppBundleBackToDevice) { Log.TraceInformation("Copying binaries back to this device..."); try { string BinaryDir = Path.GetDirectoryName(InTarget.OutputPath) + "\\"; if (BinaryDir.EndsWith(InTarget.AppName + "\\Binaries\\Mac\\") && InTarget.TargetType != TargetRules.TargetType.Game) { BinaryDir = BinaryDir.Replace(InTarget.TargetType.ToString(), "Game"); } string RemoteBinariesDir = Toolchain.ConvertPath( BinaryDir ); string LocalBinariesDir = BinaryDir; // Get the app bundle's name string AppFullName = InTarget.AppName; if (InTarget.Configuration != UnrealTargetConfiguration.Development) { AppFullName += "-" + InTarget.Platform.ToString(); AppFullName += "-" + InTarget.Configuration.ToString(); } if (!InTarget.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication) { AppFullName += ".app"; } List<string> NotBundledBinaries = new List<string>(); foreach (string BinaryPath in Toolchain.BuiltBinaries) { if (InTarget.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication || bIsStaticLibrary || !BinaryPath.StartsWith(LocalBinariesDir + AppFullName)) { NotBundledBinaries.Add(BinaryPath); } } // Zip the app bundle for transferring. if (!InTarget.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication && !bIsStaticLibrary) { string ZipCommand = "zip -0 -r -y -T \"" + AppFullName + ".zip\" \"" + AppFullName + "\""; RPCUtilHelper.Command(RemoteBinariesDir, ZipCommand, "", null); // Copy the AppBundle back to the source machine string LocalZipFileLocation = LocalBinariesDir + AppFullName + ".zip "; string RemoteZipFileLocation = RemoteBinariesDir + AppFullName + ".zip"; RPCUtilHelper.CopyFile(RemoteZipFileLocation, LocalZipFileLocation, false); // Extract the copied app bundle (in zip format) to the local binaries directory using (ZipFile AppBundleZip = ZipFile.Read(LocalZipFileLocation)) { foreach (ZipEntry Entry in AppBundleZip) { Entry.Extract(LocalBinariesDir, ExtractExistingFileAction.OverwriteSilently); } } // Delete the zip as we no longer need/want it. File.Delete(LocalZipFileLocation); RPCUtilHelper.Command(RemoteBinariesDir, "rm -f \"" + AppFullName + ".zip\"", "", null); } if (NotBundledBinaries.Count > 0) { foreach (string BinaryPath in NotBundledBinaries) { RPCUtilHelper.CopyFile(Toolchain.ConvertPath(BinaryPath), BinaryPath, false); } } Log.TraceInformation("Copied binaries successfully."); } catch (Exception) { Log.TraceInformation("Copying binaries back to this device failed."); } } } return true; }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { string GameName = InTarget.TargetName; string BuildPath = (GameName == "UE4Game" ? "../../Engine" : InTarget.ProjectDirectory) + "/Binaries/IOS"; string ProjectDirectory = InTarget.ProjectDirectory; bool bIsUE4Game = GameName.Contains("UE4Game"); string DecoratedGameName; if (InTarget.Configuration == UnrealTargetConfiguration.Development) { DecoratedGameName = GameName; } else { DecoratedGameName = String.Format("{0}-{1}-{2}", GameName, InTarget.Platform.ToString(), InTarget.Configuration.ToString()); } if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac && Environment.GetEnvironmentVariable("UBT_NO_POST_DEPLOY") != "true") { return PrepForUATPackageOrDeploy(GameName, ProjectDirectory, BuildPath + "/" + DecoratedGameName, "../../Engine", false, "", false); } else { // If it is requested, send the app bundle back to the platform executing these commands. if (BuildConfiguration.bCopyAppBundleBackToDevice) { Log.TraceInformation("Copying binaries back to this device..."); IOSToolChain Toolchain = UEToolChain.GetPlatformToolChain(CPPTargetPlatform.IOS) as IOSToolChain; try { string BinaryDir = Path.GetDirectoryName(InTarget.OutputPath) + "\\"; if (BinaryDir.EndsWith(InTarget.AppName + "\\Binaries\\IOS\\") && InTarget.TargetType != TargetRules.TargetType.Game) { BinaryDir = BinaryDir.Replace(InTarget.TargetType.ToString(), "Game"); } // Get the app bundle's name string AppFullName = InTarget.AppName; if (InTarget.Configuration != UnrealTargetConfiguration.Development) { AppFullName += "-" + InTarget.Platform.ToString(); AppFullName += "-" + InTarget.Configuration.ToString(); } foreach (string BinaryPath in Toolchain.BuiltBinaries) { if (!BinaryPath.Contains("Dummy")) { RPCUtilHelper.CopyFile(Toolchain.ConvertPath(BinaryPath), BinaryPath, false); } } Log.TraceInformation("Copied binaries successfully."); } catch (Exception) { Log.TraceInformation("Copying binaries back to this device failed."); } } GeneratePList(ProjectDirectory, bIsUE4Game, GameName, Path.GetFileNameWithoutExtension(UnrealBuildTool.GetUProjectFile()), "../../Engine", ""); } return true; }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { if (ExternalExecution.GetRuntimePlatform() == UnrealTargetPlatform.Mac && Environment.GetEnvironmentVariable("UBT_NO_POST_DEPLOY") != "true") { string GameName = InTarget.AppName; string DecoratedGameName; if (InTarget.Configuration == UnrealTargetConfiguration.Development) { DecoratedGameName = GameName; } else { DecoratedGameName = String.Format("{0}-{1}-{2}", GameName, InTarget.Platform.ToString(), InTarget.Configuration.ToString()); } string BuildPath = InTarget.ProjectDirectory + "/Binaries/IOS"; string ProjectDirectory = InTarget.ProjectDirectory; return PrepForUATPackageOrDeploy(GameName, ProjectDirectory, BuildPath + "/" + DecoratedGameName, "../../Engine", false); } return true; }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { //Log.TraceInformation("$$$$$$$$$$$$$$ PrepTargetForDeployment $$$$$$$$$$$$$$$$$"); // we need to strip architecture from any of the output paths string BaseSoName = AndroidToolChain.RemoveArchName(InTarget.OutputPaths[0]); // get the receipt UnrealTargetPlatform Platform = InTarget.Platform; UnrealTargetConfiguration Configuration = InTarget.Configuration; string ReceiptFilename = BuildReceipt.GetDefaultPath(InTarget.ProjectDirectory, Path.GetFileName(BaseSoName).Replace(".so",""), Platform, Configuration, ""); Log.TraceInformation("Receipt Filename: {0}", ReceiptFilename); SetAndroidPluginData(CollectPluginDataPaths(BuildReceipt.Read(ReceiptFilename))); // make an apk at the end of compiling, so that we can run without packaging (debugger, cook on the fly, etc) MakeApk(InTarget.AppName, InTarget.ProjectDirectory, BaseSoName, BuildConfiguration.RelativeEnginePath, bForDistribution: false, CookFlavor: "", bMakeSeparateApks:ShouldMakeSeparateApks(), bIncrementalPackage:true, bDisallowPackagingDataInApk:false); // if we made any non-standard .apk files, the generated debugger settings may be wrong if (ShouldMakeSeparateApks() && (InTarget.OutputPaths.Count > 1 || !InTarget.OutputPaths[0].Contains("-armv7-es2"))) { Console.WriteLine("================================================================================================================================"); Console.WriteLine("Non-default apk(s) have been made: If you are debugging, you will need to manually select one to run in the debugger properties!"); Console.WriteLine("================================================================================================================================"); } return true; }
public override bool PrepTargetForDeployment(UEBuildTarget InTarget) { // we need to strip architecture from any of the output paths string BaseSoName = AndroidToolChain.RemoveArchName(InTarget.OutputPaths[0]); // make an apk at the end of compiling, so that we can run without packaging (debugger, cook on the fly, etc) MakeApk(InTarget.AppName, InTarget.ProjectDirectory, BaseSoName, BuildConfiguration.RelativeEnginePath, bForDistribution: false, CookFlavor: "", bMakeSeparateApks:ShouldMakeSeparateApks(), bIncrementalPackage:true, bDisallowPackagingDataInApk:false); // if we made any non-standard .apk files, the generated debugger settings may be wrong if (ShouldMakeSeparateApks() && (InTarget.OutputPaths.Count > 1 || !InTarget.OutputPaths[0].Contains("-armv7-es2"))) { Console.WriteLine("================================================================================================================================"); Console.WriteLine("Non-default apk(s) have been made: If you are debugging, you will need to manually select one to run in the debugger properties!"); Console.WriteLine("================================================================================================================================"); } return true; }