public override List <FileReference> FinalizeBinaryPaths(FileReference BinaryName, FileReference ProjectFile, ReadOnlyTargetRules Target) { AndroidToolChain ToolChain = new AndroidToolChain(ProjectFile, false, Target.AndroidPlatform.Architectures, Target.AndroidPlatform.GPUArchitectures); var Architectures = ToolChain.GetAllArchitectures(); var GPUArchitectures = ToolChain.GetAllGPUArchitectures(); // make multiple output binaries List <FileReference> AllBinaries = new List <FileReference>(); foreach (string Architecture in Architectures) { foreach (string GPUArchitecture in GPUArchitectures) { AllBinaries.Add(new FileReference(AndroidToolChain.InlineArchName(BinaryName.FullName, Architecture, GPUArchitecture))); } } return(AllBinaries); }
/// <summary> /// 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 platform. /// </summary> /// <param name="Target">The target being build</param> /// <param name="ExtraModuleNames">List of extra modules the platform needs to add to the target</param> public virtual void AddExtraModules(ReadOnlyTargetRules Target, List <string> ExtraModuleNames) { }
/// <summary> /// Setup the target environment for building /// </summary> /// <param name="Target">Settings for the target being compiled</param> /// <param name="CompileEnvironment">The compile environment for this target</param> /// <param name="LinkEnvironment">The link environment for this target</param> public abstract void SetUpEnvironment(ReadOnlyTargetRules Target, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment);
/// <summary> /// Get the bundle directory for the shared link environment /// </summary> /// <param name="Rules">The target rules</param> /// <param name="OutputFiles">List of executable output files</param> /// <returns>Path to the bundle directory</returns> public virtual DirectoryReference GetBundleDirectory(ReadOnlyTargetRules Rules, List <FileReference> OutputFiles) { return(null); }
/// <summary> /// Get the extension to use for debug info for the given binary type /// </summary> /// <param name="InTarget">Options for the target being built</param> /// <param name="InBinaryType"> The binary type being built</param> /// <returns>string The debug info extension (i.e. 'pdb')</returns> public virtual string GetDebugInfoExtension(ReadOnlyTargetRules InTarget, UEBuildBinaryType InBinaryType) { throw new BuildException("GetDebugInfoExtension for {0} not handled in {1}", InBinaryType.ToString(), this.ToString()); }
/// <summary> /// Modify the rules for a newly created module, where the target is a different host platform. /// This is not required - but allows for hiding details of a particular platform. /// </summary> /// <param name="ModuleName">The name of the module</param> /// <param name="Rules">The module rules</param> /// <param name="Target">The target being build</param> public override void ModifyModuleRulesForOtherPlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target) { }
/// <summary> /// Whether this platform should create debug information or not /// </summary> /// <param name="Target">The target being built</param> /// <returns>true if debug info should be generated, false if not</returns> public override bool ShouldCreateDebugInfo(ReadOnlyTargetRules Target) { return(true); }
/// <summary> /// Get the extension to use for debug info for the given binary type /// </summary> /// <param name="InTarget">Rules for the target being built</param> /// <param name="InBinaryType"> The binary type being built</param> /// <returns>string The debug info extension (i.e. 'pdb')</returns> public override string GetDebugInfoExtension(ReadOnlyTargetRules InTarget, UEBuildBinaryType InBinaryType) { return(""); }
/// <summary> /// Modify the rules for a newly created module, where the target is a different host platform. /// This is not required - but allows for hiding details of a particular platform. /// </summary> /// <param name="ModuleName">The name of the module</param> /// <param name="Rules">The module rules</param> /// <param name="Target">The target being build</param> public override void ModifyModuleRulesForOtherPlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64)) { if (!Target.bBuildRequiresCookedData) { if (ModuleName == "Engine") { if (Target.bBuildDeveloperTools) { Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxNoEditorTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxClientTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxServerTargetPlatform"); } } } // allow standalone tools to use targetplatform modules, without needing Engine if (Target.bForceBuildTargetPlatforms && ModuleName == "TargetPlatform") { Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxNoEditorTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxClientTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxServerTargetPlatform"); } } }
/// <summary> /// Creates an instance of a module rules descriptor object for the specified module name /// </summary> /// <param name="ModuleName">Name of the module</param> /// <param name="ReferenceChain">Chain of references leading to this module</param> /// <param name="Target">Information about the target associated with this module</param> /// <returns>Compiled module rule info</returns> public ModuleRules CreateModuleRules(string ModuleName, ReadOnlyTargetRules Target, string ReferenceChain) { FileReference ModuleFileName; return(CreateModuleRules(ModuleName, Target, ReferenceChain, out ModuleFileName)); }
/// <summary> /// Creates an instance of a module rules descriptor object for the specified module name /// </summary> /// <param name="ModuleName">Name of the module</param> /// <param name="Target">Information about the target associated with this module</param> /// <param name="ReferenceChain">Chain of references leading to this module</param> /// <param name="ModuleFileName">The original source file name for the Module.cs file for this module</param> /// <returns>Compiled module rule info</returns> public ModuleRules CreateModuleRules(string ModuleName, ReadOnlyTargetRules Target, string ReferenceChain, out FileReference ModuleFileName) { // Currently, we expect the user's rules object type name to be the same as the module name string ModuleTypeName = ModuleName; // Make sure the module file is known to us if (!ModuleNameToModuleFile.TryGetValue(ModuleName, out ModuleFileName)) { if (Parent == null) { throw new BuildException("Could not find definition for module '{0}' (referenced via {1})", ModuleName, ReferenceChain); } else { return(Parent.CreateModuleRules(ModuleName, Target, ReferenceChain, out ModuleFileName)); } } // The build module must define a type named 'Rules' that derives from our 'ModuleRules' type. Type RulesObjectType = CompiledAssembly.GetType(ModuleName); if (RulesObjectType == null) { // Temporary hack to avoid System namespace collisions // @todo projectfiles: Make rules assemblies require namespaces. RulesObjectType = CompiledAssembly.GetType("UnrealBuildTool.Rules." + ModuleName); } if (RulesObjectType == null) { throw new BuildException("Expecting to find a type to be declared in a module rules named '{0}' in {1}. This type must derive from the 'ModuleRules' type defined by Unreal Build Tool.", ModuleTypeName, CompiledAssembly.FullName); } // Create an instance of the module's rules object ModuleRules RulesObject; try { // Create an uninitialized ModuleRules object and initialize some fields on it while we're still supporting the deprecated parameterless constructor. RulesObject = (ModuleRules)FormatterServices.GetUninitializedObject(RulesObjectType); typeof(ModuleRules).GetField("Target").SetValue(RulesObject, Target); // Call the constructor ConstructorInfo Constructor = RulesObjectType.GetConstructor(new Type[] { typeof(ReadOnlyTargetRules) }); if (Constructor != null) { Constructor.Invoke(RulesObject, new object[] { Target }); } else { ConstructorInfo DeprecatedConstructor = RulesObjectType.GetConstructor(new Type[] { typeof(TargetInfo) }); if (DeprecatedConstructor == null) { throw new Exception("No valid constructor found."); } DeprecatedConstructor.Invoke(RulesObject, new object[] { new TargetInfo(Target) }); } } catch (Exception Ex) { Exception MessageEx = (Ex is TargetInvocationException && Ex.InnerException != null)? Ex.InnerException : Ex; throw new BuildException(Ex, "Unable to instantiate module '{0}': {1}\n(referenced via {2})", ModuleName, MessageEx.ToString(), ReferenceChain); } return(RulesObject); }
public override UEToolChain CreateToolChain(CppPlatform CppPlatform, ReadOnlyTargetRules Target) { bool bUseLdGold = Target.bUseUnityBuild; return(new AndroidToolChain(Target.ProjectFile, bUseLdGold, Target.AndroidPlatform.Architectures, Target.AndroidPlatform.GPUArchitectures)); }
private bool UseTegraGraphicsDebugger(ReadOnlyTargetRules Target) { // Disable for now return(false); }
public override void SetUpEnvironment(ReadOnlyTargetRules Target, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment) { // we want gcc toolchain 4.9, but fall back to 4.8 or 4.6 for now if it doesn't exist string NDKPath = Environment.GetEnvironmentVariable("NDKROOT"); NDKPath = NDKPath.Replace("\"", ""); AndroidToolChain ToolChain = new AndroidToolChain(Target.ProjectFile, false, Target.AndroidPlatform.Architectures, Target.AndroidPlatform.GPUArchitectures); // figure out the NDK version string NDKToolchainVersion = "unknown"; string NDKDefine = "100500"; // assume r10e string SourcePropFilename = Path.Combine(NDKPath, "source.properties"); if (File.Exists(SourcePropFilename)) { string RevisionString = ""; string[] PropertyContents = File.ReadAllLines(SourcePropFilename); foreach (string PropertyLine in PropertyContents) { if (PropertyLine.StartsWith("Pkg.Revision")) { RevisionString = PropertyLine; break; } } int EqualsIndex = RevisionString.IndexOf('='); if (EqualsIndex > 0) { string[] RevisionParts = RevisionString.Substring(EqualsIndex + 1).Trim().Split('.'); int RevisionMinor = int.Parse(RevisionParts.Length > 1 ? RevisionParts[1] : "0"); char RevisionLetter = Convert.ToChar('a' + RevisionMinor); int RevisionBeta = 0; // @TODO NDKToolchainVersion = "r" + RevisionParts[0] + (RevisionMinor > 0 ? Char.ToString(RevisionLetter) : ""); NDKDefine = RevisionParts[0] + string.Format("{0:00}", RevisionMinor + 1) + string.Format("{0:00}", RevisionBeta); } } else { string ReleaseFilename = Path.Combine(NDKPath, "RELEASE.TXT"); if (File.Exists(ReleaseFilename)) { string[] PropertyContents = File.ReadAllLines(SourcePropFilename); NDKToolchainVersion = PropertyContents[0]; } } // PLATFORM_ANDROID_NDK_VERSION is in the form 150100, where 15 is major version, 01 is the letter (1 is 'a'), 00 indicates beta revision if letter is 00 Log.TraceInformation("PLATFORM_ANDROID_NDK_VERSION = {0}", NDKDefine); CompileEnvironment.Definitions.Add("PLATFORM_ANDROID_NDK_VERSION=" + NDKDefine); string GccVersion = "4.6"; int NDKVersionInt = ToolChain.GetNdkApiLevelInt(); if (Directory.Exists(Path.Combine(NDKPath, @"sources/cxx-stl/gnu-libstdc++/4.9"))) { GccVersion = "4.9"; } else if (Directory.Exists(Path.Combine(NDKPath, @"sources/cxx-stl/gnu-libstdc++/4.8"))) { GccVersion = "4.8"; } Log.TraceInformation("NDK toolchain: {0}, NDK version: {1}, GccVersion: {2}, ClangVersion: {3}", NDKToolchainVersion, NDKVersionInt.ToString(), GccVersion, ToolChain.GetClangVersionString()); CompileEnvironment.Definitions.Add("PLATFORM_DESKTOP=0"); CompileEnvironment.Definitions.Add("PLATFORM_CAN_SUPPORT_EDITORONLY_DATA=0"); CompileEnvironment.Definitions.Add("WITH_OGGVORBIS=1"); CompileEnvironment.Definitions.Add("UNICODE"); CompileEnvironment.Definitions.Add("_UNICODE"); CompileEnvironment.Definitions.Add("PLATFORM_ANDROID=1"); CompileEnvironment.Definitions.Add("ANDROID=1"); CompileEnvironment.Definitions.Add("WITH_DATABASE_SUPPORT=0"); CompileEnvironment.Definitions.Add("WITH_EDITOR=0"); CompileEnvironment.Definitions.Add("USE_NULL_RHI=0"); CompileEnvironment.Definitions.Add("REQUIRES_ALIGNED_INT_ACCESS"); CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/include"); // the toolchain will actually filter these out CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/armeabi-v7a/include"); CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/arm64-v8a/include"); CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86/include"); CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86_64/include"); LinkEnvironment.LibraryPaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/armeabi-v7a"); LinkEnvironment.LibraryPaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/arm64-v8a"); LinkEnvironment.LibraryPaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86"); LinkEnvironment.LibraryPaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86_64"); CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/android/native_app_glue"); CompileEnvironment.IncludePaths.SystemIncludePaths.Add("$(NDKROOT)/sources/android/cpufeatures"); //@TODO: Tegra Gfx Debugger - standardize locations - for now, change the hardcoded paths and force this to return true to test if (UseTegraGraphicsDebugger(Target)) { //LinkEnvironment.LibraryPaths.Add("ThirdParty/NVIDIA/TegraGfxDebugger"); //LinkEnvironment.LibraryPaths.Add("F:/NVPACK/android-kk-egl-t124-a32/stub"); //LinkEnvironment.AdditionalLibraries.Add("Nvidia_gfx_debugger_stub"); } SetupGraphicsDebugger(Target, CompileEnvironment, LinkEnvironment); LinkEnvironment.AdditionalLibraries.Add("gnustl_shared"); LinkEnvironment.AdditionalLibraries.Add("gcc"); LinkEnvironment.AdditionalLibraries.Add("z"); LinkEnvironment.AdditionalLibraries.Add("c"); LinkEnvironment.AdditionalLibraries.Add("m"); LinkEnvironment.AdditionalLibraries.Add("log"); LinkEnvironment.AdditionalLibraries.Add("dl"); if (!UseTegraGraphicsDebugger(Target)) { LinkEnvironment.AdditionalLibraries.Add("GLESv2"); LinkEnvironment.AdditionalLibraries.Add("EGL"); } LinkEnvironment.AdditionalLibraries.Add("OpenSLES"); LinkEnvironment.AdditionalLibraries.Add("android"); }
/// <summary> /// Modify the rules for a newly created module, where the target is a different host platform. /// This is not required - but allows for hiding details of a particular platform. /// </summary> /// <param name="ModuleName">The name of the module</param> /// <param name="Rules">The module rules</param> /// <param name="Target">The target being build</param> public override void ModifyModuleRulesForOtherPlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Mac)) { bool bBuildShaderFormats = Target.bForceBuildShaderFormats; if (!Target.bBuildRequiresCookedData) { if (ModuleName == "Engine") { if (Target.bBuildDeveloperTools) { Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("IOSTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("TVOSTargetPlatform"); } } else if (ModuleName == "TargetPlatform") { bBuildShaderFormats = true; Rules.DynamicallyLoadedModuleNames.Add("TextureFormatPVR"); Rules.DynamicallyLoadedModuleNames.Add("TextureFormatASTC"); if (Target.bBuildDeveloperTools && Target.bCompileAgainstEngine) { Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("AudioFormatADPCM"); } } } // allow standalone tools to use targetplatform modules, without needing Engine if (ModuleName == "TargetPlatform") { if (Target.bForceBuildTargetPlatforms) { Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("IOSTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("TVOSTargetPlatform"); } if (bBuildShaderFormats) { Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("MetalShaderFormat"); } } } }
/// <summary> /// Modify the rules for a newly created module, in a target that's being built for this platform. /// This is not required - but allows for hiding details of a particular platform. /// </summary> /// <param name="ModuleName">The name of the module</param> /// <param name="Rules">The module rules</param> /// <param name="Target">The target being build</param> public override void ModifyModuleRulesForActivePlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target) { bool bBuildShaderFormats = Target.bForceBuildShaderFormats; if (!Target.bBuildRequiresCookedData) { if (ModuleName == "TargetPlatform") { bBuildShaderFormats = true; } } // allow standalone tools to use target platform modules, without needing Engine if (ModuleName == "TargetPlatform") { if (Target.bForceBuildTargetPlatforms) { Rules.DynamicallyLoadedModuleNames.Add("LinuxTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("LinuxNoEditorTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("LinuxClientTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("LinuxServerTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("AllDesktopTargetPlatform"); } if (bBuildShaderFormats) { // Rules.DynamicallyLoadedModuleNames.Add("ShaderFormatD3D"); Rules.DynamicallyLoadedModuleNames.Add("ShaderFormatOpenGL"); Rules.DynamicallyLoadedModuleNames.Add("VulkanShaderFormat"); } } else if (ModuleName == "Launch") { // this is a hack to influence symbol resolution on Linux that results in global delete being called from within CEF if (Target.LinkType != TargetLinkType.Monolithic && Target.bCompileCEF3) { Rules.AddEngineThirdPartyPrivateStaticDependencies(Target, "CEF3"); } } }
/// <summary> /// Creates a toolchain instance for the given platform. /// </summary> /// <param name="CppPlatform">The platform to create a toolchain for</param> /// <param name="Target">The target being built</param> /// <returns>New toolchain instance.</returns> public override UEToolChain CreateToolChain(CppPlatform CppPlatform, ReadOnlyTargetRules Target) { IOSProjectSettings ProjectSettings = ReadProjectSettings(Target.ProjectFile); return(new IOSToolChain(Target.ProjectFile, ProjectSettings)); }
/// <summary> /// Creates a toolchain instance for the given platform. /// </summary> /// <param name="CppPlatform">The platform to create a toolchain for</param> /// <param name="Target">The target being built</param> /// <returns>New toolchain instance.</returns> public override UEToolChain CreateToolChain(CppPlatform CppPlatform, ReadOnlyTargetRules Target) { return(new LinuxToolChain(Target.Architecture)); }
/// <summary> /// Modify the rules for a newly created module, in a target that's being built for this platform. /// This is not required - but allows for hiding details of a particular platform. /// </summary> /// <param name="ModuleName">The name of the module</param> /// <param name="Rules">The module rules</param> /// <param name="Target">The target being build</param> public override void ModifyModuleRulesForActivePlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target) { bool bBuildShaderFormats = Target.bForceBuildShaderFormats; if (!Target.bBuildRequiresCookedData) { if (ModuleName == "TargetPlatform") { bBuildShaderFormats = true; } } // allow standalone tools to use target platform modules, without needing Engine if (ModuleName == "TargetPlatform") { if (Target.bForceBuildTargetPlatforms) { Rules.DynamicallyLoadedModuleNames.Add("MacTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("MacNoEditorTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("MacClientTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("MacServerTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("AllDesktopTargetPlatform"); } if (bBuildShaderFormats) { // Rules.DynamicallyLoadedModuleNames.Add("ShaderFormatD3D"); Rules.DynamicallyLoadedModuleNames.Add("ShaderFormatOpenGL"); Rules.DynamicallyLoadedModuleNames.Add("MetalShaderFormat"); Rules.DynamicallyLoadedModuleNames.Remove("VulkanRHI"); Rules.DynamicallyLoadedModuleNames.Add("VulkanShaderFormat"); } } }
/// <summary> /// Modify the rules for a newly created module, in a target that's being built for this platform. /// This is not required - but allows for hiding details of a particular platform. /// </summary> /// <param name="ModuleName">The name of the module</param> /// <param name="Rules">The module rules</param> /// <param name="Target">The target being build</param> public override void ModifyModuleRulesForActivePlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target) { bool bBuildShaderFormats = Target.bForceBuildShaderFormats; if (!Target.bBuildRequiresCookedData) { if (ModuleName == "TargetPlatform") { bBuildShaderFormats = true; } } // allow standalone tools to use target platform modules, without needing Engine if (ModuleName == "TargetPlatform") { if (Target.bForceBuildTargetPlatforms) { Rules.DynamicallyLoadedModuleNames.Add("WindowsTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("WindowsNoEditorTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("WindowsServerTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("WindowsClientTargetPlatform"); Rules.DynamicallyLoadedModuleNames.Add("AllDesktopTargetPlatform"); } if (bBuildShaderFormats) { Rules.DynamicallyLoadedModuleNames.Add("ShaderFormatD3D"); Rules.DynamicallyLoadedModuleNames.Add("ShaderFormatOpenGL"); Rules.DynamicallyLoadedModuleNames.Remove("VulkanRHI"); Rules.DynamicallyLoadedModuleNames.Add("VulkanShaderFormat"); } } if (ModuleName == "D3D11RHI") { // To enable platform specific D3D11 RHI Types Rules.PrivateIncludePaths.Add("Runtime/Windows/D3D11RHI/Private/Windows"); } if (ModuleName == "D3D12RHI") { if (Target.WindowsPlatform.bPixProfilingEnabled && Target.Platform == UnrealTargetPlatform.Win64 && Target.Configuration != UnrealTargetConfiguration.Shipping && Target.Configuration != UnrealTargetConfiguration.Test) { // Define to indicate profiling enabled (64-bit only) Rules.Definitions.Add("D3D12_PROFILING_ENABLED=1"); Rules.Definitions.Add("PROFILE"); } else { Rules.Definitions.Add("D3D12_PROFILING_ENABLED=0"); } // To enable platform specific D3D12 RHI Types Rules.PrivateIncludePaths.Add("Runtime/Windows/D3D12RHI/Private/Windows"); } // Delay-load D3D12 so we can use the latest features and still run on downlevel versions of the OS Rules.PublicDelayLoadDLLs.Add("d3d12.dll"); }
/// <summary> /// Creates a toolchain instance for the given platform. /// </summary> /// <param name="CppPlatform">The platform to create a toolchain for</param> /// <param name="Target">The target being built</param> /// <returns>New toolchain instance.</returns> public override UEToolChain CreateToolChain(CppPlatform CppPlatform, ReadOnlyTargetRules Target) { return(new MacToolChain(Target.ProjectFile)); }
/// <summary> /// Setup the target environment for building /// </summary> /// <param name="Target">Settings for the target being compiled</param> /// <param name="CompileEnvironment">The compile environment for this target</param> /// <param name="LinkEnvironment">The link environment for this target</param> public override void SetUpEnvironment(ReadOnlyTargetRules Target, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment) { CompileEnvironment.Definitions.Add("WIN32=1"); if (WindowsPlatform.bUseWindowsSDK10) { // Windows 8 or higher required CompileEnvironment.Definitions.Add("_WIN32_WINNT=0x0602"); CompileEnvironment.Definitions.Add("WINVER=0x0602"); } else { // Windows 7 or higher required CompileEnvironment.Definitions.Add("_WIN32_WINNT=0x0601"); CompileEnvironment.Definitions.Add("WINVER=0x0601"); } CompileEnvironment.Definitions.Add("PLATFORM_WINDOWS=1"); CompileEnvironment.Definitions.Add("DEPTH_32_BIT_CONVERSION=0"); FileReference MorpheusShaderPath = FileReference.Combine(UnrealBuildTool.EngineDirectory, "Shaders", "Private", "PS4", "PostProcessHMDMorpheus.usf"); if (FileReference.Exists(MorpheusShaderPath)) { CompileEnvironment.Definitions.Add("HAS_MORPHEUS=1"); //on PS4 the SDK now handles distortion correction. On PC we will still have to handle it manually, CompileEnvironment.Definitions.Add("MORPHEUS_ENGINE_DISTORTION=1"); } // Add path to Intel math libraries when using ICL based on target platform if (WindowsPlatform.bCompileWithICL) { var Result = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "IntelSWTools", "compilers_and_libraries", "windows", "compiler", "lib", Target.Platform == UnrealTargetPlatform.Win32 ? "ia32" : "intel64"); if (!Directory.Exists(Result)) { throw new BuildException("ICL was selected but the required math libraries were not found. Could not find: " + Result); } LinkEnvironment.LibraryPaths.Add(Result); } // 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. bool bUseDebugCRT = Target.Configuration == UnrealTargetConfiguration.Debug && Target.bDebugBuildsActuallyUseDebugCRT; if (!Target.bUseStaticCRT || bUseDebugCRT) { LinkEnvironment.ExcludedLibraries.Add("LIBCMT"); LinkEnvironment.ExcludedLibraries.Add("LIBCPMT"); } if (!Target.bUseStaticCRT || !bUseDebugCRT) { LinkEnvironment.ExcludedLibraries.Add("LIBCMTD"); LinkEnvironment.ExcludedLibraries.Add("LIBCPMTD"); } if (Target.bUseStaticCRT || bUseDebugCRT) { LinkEnvironment.ExcludedLibraries.Add("MSVCRT"); LinkEnvironment.ExcludedLibraries.Add("MSVCPRT"); } if (Target.bUseStaticCRT || !bUseDebugCRT) { LinkEnvironment.ExcludedLibraries.Add("MSVCRTD"); LinkEnvironment.ExcludedLibraries.Add("MSVCPRTD"); } LinkEnvironment.ExcludedLibraries.Add("LIBC"); LinkEnvironment.ExcludedLibraries.Add("LIBCP"); LinkEnvironment.ExcludedLibraries.Add("LIBCD"); LinkEnvironment.ExcludedLibraries.Add("LIBCPD"); //@todo ATL: Currently, only VSAccessor requires ATL (which is only used in editor builds) // When compiling games, we do not want to include ATL - and we can't when compiling games // made with Launcher build due to VS 2012 Express not including ATL. // If more modules end up requiring ATL, this should be refactored into a BuildTarget flag (bNeedsATL) // that is set by the modules the target includes to allow for easier tracking. // Alternatively, if VSAccessor is modified to not require ATL than we should always exclude the libraries. if (Target.LinkType == TargetLinkType.Monolithic && (Target.Type == TargetType.Game || Target.Type == TargetType.Client || Target.Type == TargetType.Server)) { LinkEnvironment.ExcludedLibraries.Add("atl"); LinkEnvironment.ExcludedLibraries.Add("atls"); LinkEnvironment.ExcludedLibraries.Add("atlsd"); LinkEnvironment.ExcludedLibraries.Add("atlsn"); LinkEnvironment.ExcludedLibraries.Add("atlsnd"); } // Add the library used for the delayed loading of DLLs. LinkEnvironment.AdditionalLibraries.Add("delayimp.lib"); //@todo - remove once FB implementation uses Http module if (Target.bCompileAgainstEngine) { // link against wininet (used by FBX and Facebook) LinkEnvironment.AdditionalLibraries.Add("wininet.lib"); } // Compile and link with Win32 API libraries. LinkEnvironment.AdditionalLibraries.Add("rpcrt4.lib"); //LinkEnvironment.AdditionalLibraries.Add("wsock32.lib"); LinkEnvironment.AdditionalLibraries.Add("ws2_32.lib"); LinkEnvironment.AdditionalLibraries.Add("dbghelp.lib"); LinkEnvironment.AdditionalLibraries.Add("comctl32.lib"); LinkEnvironment.AdditionalLibraries.Add("Winmm.lib"); LinkEnvironment.AdditionalLibraries.Add("kernel32.lib"); LinkEnvironment.AdditionalLibraries.Add("user32.lib"); LinkEnvironment.AdditionalLibraries.Add("gdi32.lib"); LinkEnvironment.AdditionalLibraries.Add("winspool.lib"); LinkEnvironment.AdditionalLibraries.Add("comdlg32.lib"); LinkEnvironment.AdditionalLibraries.Add("advapi32.lib"); LinkEnvironment.AdditionalLibraries.Add("shell32.lib"); LinkEnvironment.AdditionalLibraries.Add("ole32.lib"); LinkEnvironment.AdditionalLibraries.Add("oleaut32.lib"); LinkEnvironment.AdditionalLibraries.Add("uuid.lib"); LinkEnvironment.AdditionalLibraries.Add("odbc32.lib"); LinkEnvironment.AdditionalLibraries.Add("odbccp32.lib"); LinkEnvironment.AdditionalLibraries.Add("netapi32.lib"); LinkEnvironment.AdditionalLibraries.Add("iphlpapi.lib"); LinkEnvironment.AdditionalLibraries.Add("setupapi.lib"); // Required for access monitor device enumeration // Windows Vista/7 Desktop Windows Manager API for Slate Windows Compliance LinkEnvironment.AdditionalLibraries.Add("dwmapi.lib"); // IME LinkEnvironment.AdditionalLibraries.Add("imm32.lib"); // For 64-bit builds, we'll forcibly ignore a linker warning with DirectInput. This is // Microsoft's recommended solution as they don't have a fixed .lib for us. if (Target.Platform == UnrealTargetPlatform.Win64) { LinkEnvironment.AdditionalArguments += " /ignore:4078"; } if (Target.Type != TargetType.Editor) { if (!string.IsNullOrEmpty(Target.WindowsPlatform.CompanyName)) { CompileEnvironment.Definitions.Add(String.Format("PROJECT_COMPANY_NAME={0}", SanitizeMacroValue(Target.WindowsPlatform.CompanyName))); } if (!string.IsNullOrEmpty(Target.WindowsPlatform.CopyrightNotice)) { CompileEnvironment.Definitions.Add(String.Format("PROJECT_COPYRIGHT_STRING={0}", SanitizeMacroValue(Target.WindowsPlatform.CopyrightNotice))); } if (!string.IsNullOrEmpty(Target.WindowsPlatform.ProductName)) { CompileEnvironment.Definitions.Add(String.Format("PROJECT_PRODUCT_NAME={0}", SanitizeMacroValue(Target.WindowsPlatform.ProductName))); } if (Target.ProjectFile != null) { CompileEnvironment.Definitions.Add(String.Format("PROJECT_PRODUCT_IDENTIFIER={0}", SanitizeMacroValue(Target.ProjectFile.GetFileNameWithoutExtension()))); } } // Set up default stack size ConfigHierarchy EngineIni = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(Target.ProjectFile), UnrealTargetPlatform.Win64); String TargetSettingsIniPath = "/Script/WindowsTargetPlatform.WindowsTargetSettings"; int IniDefaultStackSize = 0; String StackSizeName = Target.Type == TargetType.Editor ? "DefaultStackSizeEditor" : "DefaultStackSize"; if (EngineIni.GetInt32(TargetSettingsIniPath, StackSizeName, out IniDefaultStackSize)) { LinkEnvironment.DefaultStackSize = IniDefaultStackSize; } int IniDefaultStackSizeCommit = 0; String StackSizeCommitName = Target.Type == TargetType.Editor ? "DefaultStackSizeCommitEditor" : "DefaultStackSizeCommit"; if (EngineIni.GetInt32(TargetSettingsIniPath, StackSizeCommitName, out IniDefaultStackSizeCommit)) { LinkEnvironment.DefaultStackSizeCommit = IniDefaultStackSizeCommit; } LinkEnvironment.ModuleDefinitionFile = Target.WindowsPlatform.ModuleDefinitionFile; }
/// <summary> /// Allow all registered build platforms to modify the newly created module /// passed in for the given platform. /// This is not required - but allows for hiding details of a particular platform. /// </summary> /// <param name="ModuleName">The name of the module</param> /// <param name="Rules">The module rules</param> /// <param name="Target">The target being build</param> public static void PlatformModifyHostModuleRules(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target) { foreach (KeyValuePair <UnrealTargetPlatform, UEBuildPlatform> PlatformEntry in BuildPlatformDictionary) { PlatformEntry.Value.ModifyModuleRulesForOtherPlatform(ModuleName, Rules, Target); } }
/// <summary> /// Setup the target environment for building /// </summary> /// <param name="Target">Settings for the target being compiled</param> /// <param name="CompileEnvironment">The compile environment for this target</param> /// <param name="LinkEnvironment">The link environment for this target</param> public override void SetUpEnvironment(ReadOnlyTargetRules Target, CppCompileEnvironment CompileEnvironment, LinkEnvironment LinkEnvironment) { base.SetUpEnvironment(Target, CompileEnvironment, LinkEnvironment); CompileEnvironment.Definitions.Add("PLATFORM_TVOS=1"); CompileEnvironment.Definitions.Add("__IPHONE_OS_VERSION_MIN_REQUIRED=__APPLETV_OS_VERSION_MIN_REQUIRED"); }
/// <summary> /// For platforms that need to output multiple files per binary (ie Android "fat" binaries) /// this will emit multiple paths. By default, it simply makes an array from the input /// </summary> public virtual List <FileReference> FinalizeBinaryPaths(FileReference BinaryName, FileReference ProjectFile, ReadOnlyTargetRules Target) { List <FileReference> TempList = new List <FileReference>() { BinaryName }; return(TempList); }
/// <summary> /// Creates a toolchain instance for the given platform. /// </summary> /// <param name="CppPlatform">The platform to create a toolchain for</param> /// <param name="Target">The target being built</param> /// <returns>New toolchain instance.</returns> public override UEToolChain CreateToolChain(CppPlatform CppPlatform, ReadOnlyTargetRules Target) { TVOSProjectSettings ProjectSettings = ((TVOSPlatform)UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.TVOS)).ReadProjectSettings(Target.ProjectFile); return(new TVOSToolChain(Target.ProjectFile, ProjectSettings)); }
/// <summary> /// Modify the rules for a newly created module, in a target that's being built for this platform. /// This is not required - but allows for hiding details of a particular platform. /// </summary> /// <param name="ModuleName">The name of the module</param> /// <param name="Rules">The module rules</param> /// <param name="Target">The target being build</param> public virtual void ModifyModuleRulesForActivePlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target) { }
public override void ModifyModuleRulesForOtherPlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target) { base.ModifyModuleRulesForOtherPlatform(ModuleName, Rules, Target); if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Mac)) { // allow standalone tools to use targetplatform modules, without needing Engine if (Target.bForceBuildTargetPlatforms) { // @todo tvos: Make the module // InModule.AddPlatformSpecificDynamicallyLoadedModule("TVOSTargetPlatform"); } } }
/// <summary> /// Whether this platform should create debug information or not /// </summary> /// <param name="Target">The target being built</param> /// <returns>bool true if debug info should be generated, false if not</returns> public abstract bool ShouldCreateDebugInfo(ReadOnlyTargetRules Target);
/// <summary> /// Modify the rules for a newly created module, where the target is a different host platform. /// This is not required - but allows for hiding details of a particular platform. /// </summary> /// <param name="ModuleName">The name of the module</param> /// <param name="Rules">The module rules</param> /// <param name="Target">The target being build</param> public override void ModifyModuleRulesForOtherPlatform(string ModuleName, ModuleRules Rules, ReadOnlyTargetRules Target) { if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Mac) || (Target.Platform == UnrealTargetPlatform.Linux)) { bool bBuildShaderFormats = Target.bForceBuildShaderFormats; if (!Target.bBuildRequiresCookedData) { if (ModuleName == "Engine") { if (Target.bBuildDeveloperTools) { Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("AndroidTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_PVRTCTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_ATCTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_DXTTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_ETC1TargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_ETC1aTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_ETC2TargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_ASTCTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_MultiTargetPlatform"); } } else if (ModuleName == "TargetPlatform") { bBuildShaderFormats = true; Rules.DynamicallyLoadedModuleNames.Add("TextureFormatPVR"); Rules.DynamicallyLoadedModuleNames.Add("TextureFormatDXT"); Rules.DynamicallyLoadedModuleNames.Add("TextureFormatASTC"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("TextureFormatAndroid"); // ATITC, ETC1 and ETC2 if (Target.bBuildDeveloperTools) { //Rules.DynamicallyLoadedModuleNames.Add("AudioFormatADPCM"); //@todo android: android audio } } } // allow standalone tools to use targetplatform modules, without needing Engine if (ModuleName == "TargetPlatform") { if (Target.bForceBuildTargetPlatforms) { Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("AndroidTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_PVRTCTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_ATCTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_DXTTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_ETC1TargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_ETC1aTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_ETC2TargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_ASTCTargetPlatform"); Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("Android_MultiTargetPlatform"); } if (bBuildShaderFormats) { //Rules.DynamicallyLoadedModuleNames.Add("ShaderFormatAndroid"); //@todo android: ShaderFormatAndroid } } } }