// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using EpicGames.Core;
using UnrealBuildBase;
using Microsoft.Extensions.Logging;
using System.Runtime.Serialization;
namespace UnrealBuildTool
{
///
/// The type of target
///
[Serializable]
public enum TargetType
{
///
/// Cooked monolithic game executable (GameName.exe). Also used for a game-agnostic engine executable (UnrealGame.exe or RocketGame.exe)
///
Game,
///
/// Uncooked modular editor executable and DLLs (UnrealEditor.exe, UnrealEditor*.dll, GameName*.dll)
///
Editor,
///
/// Cooked monolithic game client executable (GameNameClient.exe, but no server code)
///
Client,
///
/// Cooked monolithic game server executable (GameNameServer.exe, but no client code)
///
Server,
///
/// Program (standalone program, e.g. ShaderCompileWorker.exe, can be modular or monolithic depending on the program)
///
Program
}
///
/// Specifies how to link all the modules in this target
///
[Serializable]
public enum TargetLinkType
{
///
/// Use the default link type based on the current target type
///
Default,
///
/// Link all modules into a single binary
///
Monolithic,
///
/// Link modules into individual dynamic libraries
///
Modular,
}
///
/// Specifies whether to share engine binaries and intermediates with other projects, or to create project-specific versions. By default,
/// editor builds always use the shared build environment (and engine binaries are written to Engine/Binaries/Platform), but monolithic builds
/// and programs do not (except in installed builds). Using the shared build environment prevents target-specific modifications to the build
/// environment.
///
[Serializable]
public enum TargetBuildEnvironment
{
///
/// Engine binaries and intermediates are output to the engine folder. Target-specific modifications to the engine build environment will be ignored.
///
Shared,
///
/// Engine binaries and intermediates are specific to this target
///
Unique,
}
///
/// Specifies how UnrealHeaderTool should enforce member pointer declarations in UCLASSes and USTRUCTs. This should match (by name, not value) the
/// EPointerMemberBehavior enum in BaseParser.h so that it can be interpreted correctly by UnrealHeaderTool.
///
[Serializable]
public enum PointerMemberBehavior
{
///
/// Pointer members of the associated type will be disallowed and result in an error emitted from UnrealHeaderTool.
///
Disallow,
///
/// Pointer members of the associated type will be allowed and not emit any messages to log or screen.
///
AllowSilently,
///
/// Pointer members of the associated type will be allowed but will emit messages to log.
///
AllowAndLog,
}
///
/// Determines which version of the engine to take default build settings from. This allows for backwards compatibility as new options are enabled by default.
///
public enum BuildSettingsVersion
{
///
/// Legacy default build settings for 4.23 and earlier.
///
V1,
///
/// New defaults for 4.24: ModuleRules.PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs, ModuleRules.bLegacyPublicIncludePaths = false.
///
V2,
// *** When adding new entries here, be sure to update GameProjectUtils::GetDefaultBuildSettingsVersion() to ensure that new projects are created correctly. ***
///
/// Always use the defaults for the current engine version. Note that this may cause compatibility issues when upgrading.
///
Latest
}
///
/// What version of include order to use when compiling.
///
public enum EngineIncludeOrderVersion
{
///
/// Include order used in Unreal 5.0
///
Unreal5_0,
///
/// Include order used in Unreal 5.1
///
Unreal5_1,
// *** When adding new entries here, be sure to update UEBuildModuleCPP.CurrentIncludeOrderDefine to ensure that the correct guard is used. ***
///
/// Always use the latest version of include order.
///
Latest = Unreal5_1,
///
/// Contains the oldest version of include order that the engine supports.
///
Oldest = Unreal5_0,
}
///
/// Utility class for EngineIncludeOrderVersion defines
///
public class EngineIncludeOrderHelper
{
///
/// Returns a list of every deprecation define available.
///
///
public static List GetAllDeprecationDefines()
{
return new List()
{
"UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_1",
};
}
///
/// Get a list of every deprecation define and their value for the specified engine include order.
///
///
///
public static List GetDeprecationDefines(EngineIncludeOrderVersion InVersion)
{
return new List()
{
"UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_1=" + (InVersion < EngineIncludeOrderVersion.Unreal5_1 ? "1" : "0"),
};
}
}
///
/// Attribute used to mark fields which much match between targets in the shared build environment
///
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
class RequiresUniqueBuildEnvironmentAttribute : Attribute
{
}
///
/// Attribute used to mark configurable sub-objects
///
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
class ConfigSubObjectAttribute : Attribute
{
}
///
/// TargetRules is a data structure that contains the rules for defining a target (application/executable)
///
public abstract partial class TargetRules
{
///
/// Static class wrapping constants aliasing the global TargetType enum.
///
public static class TargetType
{
///
/// Alias for TargetType.Game
///
public const global::UnrealBuildTool.TargetType Game = global::UnrealBuildTool.TargetType.Game;
///
/// Alias for TargetType.Editor
///
public const global::UnrealBuildTool.TargetType Editor = global::UnrealBuildTool.TargetType.Editor;
///
/// Alias for TargetType.Client
///
public const global::UnrealBuildTool.TargetType Client = global::UnrealBuildTool.TargetType.Client;
///
/// Alias for TargetType.Server
///
public const global::UnrealBuildTool.TargetType Server = global::UnrealBuildTool.TargetType.Server;
///
/// Alias for TargetType.Program
///
public const global::UnrealBuildTool.TargetType Program = global::UnrealBuildTool.TargetType.Program;
}
///
/// The name of this target
///
public string Name
{
get
{
if (!String.IsNullOrEmpty(NameOverride))
{
return NameOverride;
}
return DefaultName;
}
set
{
NameOverride = value;
}
}
///
/// If the Name of this target has been overriden
///
public bool IsNameOverriden() { return !String.IsNullOrEmpty(NameOverride); }
///
/// Override the name used for this target
///
[CommandLine("-TargetNameOverride=")]
private string? NameOverride;
private readonly string DefaultName;
///
/// Whether this is a low level tests target.
///
public bool IsTestTarget
{
get { return bIsTestTargetOverride; }
}
///
/// Override this boolean flag in inheriting classes for low level test targets.
///
protected bool bIsTestTargetOverride;
///
/// Whether this is a test target explicitly defined.
/// Explicitley defined test targets always inherit from TestTargetRules and define their own tests.
/// Implicit test targets are created from existing targets when building with -Mode=Test and they include tests from all dependencies.
///
public bool ExplicitTestsTarget
{
get { return bExplicitTestsTargetOverride; }
}
///
/// This flag is automatically set when classes inherit from TestTargetRules.
///
protected bool bExplicitTestsTargetOverride;
///
/// Controls the value of WITH_LOW_LEVEL_TESTS that dictates whether module-specific low level tests are compiled in or not.
///
public bool WithLowLevelTests
{
get
{
return (IsTestTarget && !ExplicitTestsTarget) || bWithLowLevelTestsOverride;
}
}
///
/// Override the value of WithLowLevelTests by setting this to true in inherited classes.
///
protected bool bWithLowLevelTestsOverride;
///
/// File containing the general type for this target (not including platform/group)
///
internal FileReference? File { get; set; }
///
/// File containing the platform/group-specific type for this target
///
internal FileReference? TargetSourceFile { get; set; }
///
/// Logger for output relating to this target. Set before the constructor is run from
///
internal ILogger Logger { get; set; }
///
/// Platform that this target is being built for.
///
public readonly UnrealTargetPlatform Platform;
///
/// The configuration being built.
///
public readonly UnrealTargetConfiguration Configuration;
///
/// Architecture that the target is being built for (or an empty string for the default).
///
public readonly string Architecture;
///
/// Path to the project file for the project containing this target.
///
public readonly FileReference? ProjectFile;
///
/// The current build version
///
public readonly ReadOnlyBuildVersion Version;
///
/// The type of target.
///
public global::UnrealBuildTool.TargetType Type = global::UnrealBuildTool.TargetType.Game;
///
/// Specifies the engine version to maintain backwards-compatible default build settings with (eg. DefaultSettingsVersion.Release_4_23, DefaultSettingsVersion.Release_4_24). Specify DefaultSettingsVersion.Latest to always
/// use defaults for the current engine version, at the risk of introducing build errors while upgrading.
///
public BuildSettingsVersion DefaultBuildSettings
{
get { return DefaultBuildSettingsPrivate ?? BuildSettingsVersion.V1; }
set { DefaultBuildSettingsPrivate = value; }
}
private BuildSettingsVersion? DefaultBuildSettingsPrivate; // Cannot be initialized inline; potentially overridden before the constructor is called.
///
/// Force the include order to a specific version. Overrides any Target and Module rules.
///
[CommandLine("-ForceIncludeOrder=")]
public EngineIncludeOrderVersion? ForcedIncludeOrder = null;
///
/// What version of include order to use when compiling this target. Can be overridden via -ForceIncludeOrder on the command line. ModuleRules.IncludeOrderVersion takes precedence.
///
public EngineIncludeOrderVersion IncludeOrderVersion
{
get
{
if (ForcedIncludeOrder != null)
{
return ForcedIncludeOrder.Value;
}
return IncludeOrderVersionPrivate ?? EngineIncludeOrderVersion.Oldest;
}
set { IncludeOrderVersionPrivate = value; }
}
private EngineIncludeOrderVersion? IncludeOrderVersionPrivate;
///
/// Path to the output file for the main executable, relative to the Engine or project directory.
/// This setting is only typically useful for non-UE programs, since the engine uses paths relative to the executable to find other known folders (eg. Content).
///
public string? OutputFile;
///
/// Tracks a list of config values read while constructing this target
///
internal readonly ConfigValueTracker ConfigValueTracker;
///
/// Whether the target uses Steam.
///
public bool bUsesSteam;
///
/// Whether the target uses CEF3.
///
public bool bUsesCEF3;
///
/// Whether the project uses visual Slate UI (as opposed to the low level windowing/messaging, which is always available).
///
public bool bUsesSlate = true;
///
/// Forces linking against the static CRT. This is not fully supported across the engine due to the need for allocator implementations to be shared (for example), and TPS
/// libraries to be consistent with each other, but can be used for utility programs.
///
[RequiresUniqueBuildEnvironment]
public bool bUseStaticCRT = false;
///
/// Enables the debug C++ runtime (CRT) for debug builds. By default we always use the release runtime, since the debug
/// version isn't particularly useful when debugging Unreal Engine projects, and linking against the debug CRT libraries forces
/// our third party library dependencies to also be compiled using the debug CRT (and often perform more slowly). Often
/// it can be inconvenient to require a separate copy of the debug versions of third party static libraries simply
/// so that you can debug your program's code.
///
[RequiresUniqueBuildEnvironment]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bDebugBuildsActuallyUseDebugCRT = false;
///
/// Whether the output from this target can be publicly distributed, even if it has dependencies on modules that are in folders
/// with special restrictions (eg. CarefullyRedist, NotForLicensees, NoRedist).
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bLegalToDistributeBinary = false;
///
/// Specifies the configuration whose binaries do not require a "-Platform-Configuration" suffix.
///
[RequiresUniqueBuildEnvironment]
public UnrealTargetConfiguration UndecoratedConfiguration = UnrealTargetConfiguration.Development;
///
/// Whether this target supports hot reload
///
public bool bAllowHotReload
{
get { return bAllowHotReloadOverride ?? (Type == TargetType.Editor && LinkType == TargetLinkType.Modular); }
set { bAllowHotReloadOverride = value; }
}
private bool? bAllowHotReloadOverride;
///
/// Build all the modules that are valid for this target type. Used for CIS and making installed engine builds.
///
[CommandLine("-AllModules")]
public bool bBuildAllModules = false;
///
/// Set this to reference a VSTest run settings file from generated projects.
///
public FileReference? VSTestRunSettingsFile;
///
/// Additional plugins that are built for this target type but not enabled.
///
[CommandLine("-BuildPlugin=", ListSeparator = '+')]
public List BuildPlugins = new List();
///
/// If this is true, then the BuildPlugins list will be used to populate RuntimeDependencies, rather than EnablePlugins
///
public bool bRuntimeDependenciesComeFromBuildPlugins = false;
///
/// A list of additional plugins which need to be included in this target. This allows referencing non-optional plugin modules
/// which cannot be disabled, and allows building against specific modules in program targets which do not fit the categories
/// in ModuleHostType.
///
public List AdditionalPlugins = new List();
///
/// Additional plugins that should be included for this target.
///
[CommandLine("-EnablePlugin=", ListSeparator = '+')]
public List EnablePlugins = new List();
///
/// List of plugins to be disabled for this target. Note that the project file may still reference them, so they should be marked
/// as optional to avoid failing to find them at runtime.
///
[CommandLine("-DisablePlugin=", ListSeparator = '+')]
public List DisablePlugins = new List();
///
/// A list of Plugin names that are allowed to exist as dependencies without being defined in the uplugin descriptor
///
public List InternalPluginDependencies = new List();
///
/// Path to the set of pak signing keys to embed in the executable.
///
public string PakSigningKeysFile = "";
///
/// Allows a Program Target to specify it's own solution folder path.
///
public string SolutionDirectory = String.Empty;
///
/// Whether the target should be included in the default solution build configuration
/// Setting this to false will skip building when running in the IDE
///
public bool? bBuildInSolutionByDefault = null;
///
/// Whether this target should be compiled as a DLL. Requires LinkType to be set to TargetLinkType.Monolithic.
///
[RequiresUniqueBuildEnvironment]
[CommandLine("-CompileAsDll")]
public bool bShouldCompileAsDLL = false;
///
/// Extra subdirectory to load config files out of, for making multiple types of builds with the same platform
/// This will get baked into the game executable as CUSTOM_CONFIG and used when staging to filter files and settings
///
[RequiresUniqueBuildEnvironment]
public string CustomConfig = String.Empty;
///
/// Subfolder to place executables in, relative to the default location.
///
[RequiresUniqueBuildEnvironment]
public string ExeBinariesSubFolder = String.Empty;
///
/// Allow target module to override UHT code generation version.
///
public EGeneratedCodeVersion GeneratedCodeVersion = EGeneratedCodeVersion.None;
///
/// Whether to enable the mesh editor.
///
[RequiresUniqueBuildEnvironment]
public bool bEnableMeshEditor = false;
///
/// Whether to use the verse script interface.
///
[RequiresUniqueBuildEnvironment]
[CommandLine("-NoUseVerse", Value = "false")]
[CommandLine("-UseVerse", Value = "true")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUseVerse = false;
///
/// Whether to compile the Chaos physics plugin.
///
[RequiresUniqueBuildEnvironment]
[CommandLine("-NoCompileChaos", Value = "false")]
[CommandLine("-CompileChaos", Value = "true")]
[Obsolete("Deprecated in UE5.1 - No longer used as Chaos is always enabled.")]
public bool bCompileChaos = true;
///
/// Whether to use the Chaos physics interface. This overrides the physx flags to disable APEX and NvCloth
///
[RequiresUniqueBuildEnvironment]
[CommandLine("-NoUseChaos", Value = "false")]
[CommandLine("-UseChaos", Value = "true")]
[Obsolete("Deprecated in UE5.1 - No longer used as Chaos is always enabled.")]
public bool bUseChaos = true;
///
/// Whether to compile in checked chaos features for debugging
///
[RequiresUniqueBuildEnvironment]
public bool bUseChaosChecked = false;
///
/// Whether to compile in chaos memory tracking features
///
[RequiresUniqueBuildEnvironment]
public bool bUseChaosMemoryTracking = false;
///
/// Whether scene query acceleration is done by UE. The physx scene query structure is still created, but we do not use it.
///
[RequiresUniqueBuildEnvironment]
[Obsolete("Deprecated in UE5.1 - No longer used in engine.")]
public bool bCustomSceneQueryStructure = false;
///
/// Whether to include PhysX support.
///
[RequiresUniqueBuildEnvironment]
[Obsolete("Deprecated in UE5.1 - No longer used as Chaos is always enabled.")]
public bool bCompilePhysX = false;
///
/// Whether to include PhysX APEX support.
///
[RequiresUniqueBuildEnvironment]
[ConfigFile(ConfigHierarchyType.Engine, "/Script/BuildSettings.BuildSettings", "bCompileApex")]
[Obsolete("Deprecated in UE5.1 - No longer used as Chaos is always enabled.")]
public bool bCompileAPEX = false;
///
/// Whether to include NvCloth.
///
[RequiresUniqueBuildEnvironment]
[Obsolete("Deprecated in UE5.1 - No longer used as Chaos is always enabled.")]
public bool bCompileNvCloth = false;
///
/// Whether to include ICU unicode/i18n support in Core.
///
[RequiresUniqueBuildEnvironment]
[ConfigFile(ConfigHierarchyType.Engine, "/Script/BuildSettings.BuildSettings", "bCompileICU")]
public bool bCompileICU = true;
///
/// Whether to compile CEF3 support.
///
[RequiresUniqueBuildEnvironment]
[ConfigFile(ConfigHierarchyType.Engine, "/Script/BuildSettings.BuildSettings", "bCompileCEF3")]
public bool bCompileCEF3 = true;
///
/// Whether to compile using ISPC.
///
[RequiresUniqueBuildEnvironment]
public bool bCompileISPC = false;
///
/// Whether to compile IntelMetricsDiscovery.
///
[RequiresUniqueBuildEnvironment]
public bool bCompileIntelMetricsDiscovery = true;
///
/// Whether to compile in python support
///
[RequiresUniqueBuildEnvironment]
public bool bCompilePython = true;
///
/// Whether we are compiling editor code or not. Prefer the more explicit bCompileAgainstEditor instead.
///
public bool bBuildEditor
{
get { return (Type == TargetType.Editor || bCompileAgainstEditor); }
set { Logger.LogWarning("Setting {Type}.bBuildEditor is deprecated. Set {Type}.Type instead.", GetType().Name); }
}
///
/// Whether to compile code related to building assets. Consoles generally cannot build assets. Desktop platforms generally can.
///
[RequiresUniqueBuildEnvironment]
public bool bBuildRequiresCookedData
{
get { return bBuildRequiresCookedDataOverride ?? (Type == TargetType.Game || Type == TargetType.Client || Type == TargetType.Server); }
set { bBuildRequiresCookedDataOverride = value; }
}
bool? bBuildRequiresCookedDataOverride;
///
/// Whether to compile WITH_EDITORONLY_DATA disabled. Only Windows will use this, other platforms force this to false.
///
[RequiresUniqueBuildEnvironment]
public bool bBuildWithEditorOnlyData
{
get { return bBuildWithEditorOnlyDataOverride ?? (Type == TargetType.Editor || Type == TargetType.Program); }
set { bBuildWithEditorOnlyDataOverride = value; }
}
private bool? bBuildWithEditorOnlyDataOverride;
///
/// Manually specified value for bBuildDeveloperTools.
///
bool? bBuildDeveloperToolsOverride;
///
/// Whether to compile the developer tools.
///
[RequiresUniqueBuildEnvironment]
public bool bBuildDeveloperTools
{
set { bBuildDeveloperToolsOverride = value; }
get { return bBuildDeveloperToolsOverride ?? (bCompileAgainstEngine && (Type == TargetType.Editor || Type == TargetType.Program || (Configuration != UnrealTargetConfiguration.Test && Configuration != UnrealTargetConfiguration.Shipping))); }
}
///
/// Manually specified value for bBuildTargetDeveloperTools.
///
bool? bBuildTargetDeveloperToolsOverride;
///
/// Whether to compile the developer tools that are for target platforms or connected devices (defaults to bBuildDeveloperTools)
///
[RequiresUniqueBuildEnvironment]
public bool bBuildTargetDeveloperTools
{
set { bBuildTargetDeveloperToolsOverride = value; }
get { return bBuildTargetDeveloperToolsOverride ?? bBuildDeveloperTools; }
}
///
/// Whether to force compiling the target platform modules, even if they wouldn't normally be built.
///
public bool bForceBuildTargetPlatforms = false;
///
/// Whether to force compiling shader format modules, even if they wouldn't normally be built.
///
public bool bForceBuildShaderFormats = false;
///
/// Override for including extra shader formats
///
public bool? bNeedsExtraShaderFormatsOverride;
///
/// Whether we should include any extra shader formats. By default this is only enabled for Program and Editor targets.
///
public bool bNeedsExtraShaderFormats
{
set { bNeedsExtraShaderFormatsOverride = value; }
get { return bNeedsExtraShaderFormatsOverride ?? (bForceBuildShaderFormats || bBuildDeveloperTools) && (Type == TargetType.Editor || Type == TargetType.Program); }
}
///
/// Whether we should compile SQLite using the custom "Unreal" platform (true), or using the native platform (false).
///
[RequiresUniqueBuildEnvironment]
[ConfigFile(ConfigHierarchyType.Engine, "/Script/BuildSettings.BuildSettings", "bCompileCustomSQLitePlatform")]
public bool bCompileCustomSQLitePlatform = true;
///
/// Whether to utilize cache freed OS allocs with MallocBinned
///
[RequiresUniqueBuildEnvironment]
[ConfigFile(ConfigHierarchyType.Engine, "/Script/BuildSettings.BuildSettings", "bUseCacheFreedOSAllocs")]
public bool bUseCacheFreedOSAllocs = true;
///
/// Enabled for all builds that include the engine project. Disabled only when building standalone apps that only link with Core.
///
[RequiresUniqueBuildEnvironment]
public virtual bool bCompileAgainstEngine
{
get { return bCompileAgainstEnginePrivate; }
set { bCompileAgainstEnginePrivate = value; }
}
private bool bCompileAgainstEnginePrivate = true;
///
/// Enabled for all builds that include the CoreUObject project. Disabled only when building standalone apps that only link with Core.
///
[RequiresUniqueBuildEnvironment]
public virtual bool bCompileAgainstCoreUObject
{
get { return bCompileAgainstCoreUObjectPrivate; }
set { bCompileAgainstCoreUObjectPrivate = value; }
}
private bool bCompileAgainstCoreUObjectPrivate = true;
///
/// Enabled for builds that need to initialize the ApplicationCore module. Command line utilities do not normally need this.
///
[RequiresUniqueBuildEnvironment]
public virtual bool bCompileAgainstApplicationCore
{
get { return bCompileAgainstApplicationCorePrivate; }
set { bCompileAgainstApplicationCorePrivate = value; }
}
private bool bCompileAgainstApplicationCorePrivate = true;
///
/// Manually specified value for bCompileAgainstEditor.
///
bool? bCompileAgainstEditorOverride;
///
/// Enabled for editor builds (TargetType.Editor). Can be overridden for programs (TargetType.Program) that would need to compile against editor code. Not available for other target types.
/// Mainly drives the value of WITH_EDITOR.
///
[RequiresUniqueBuildEnvironment]
public virtual bool bCompileAgainstEditor
{
set { bCompileAgainstEditorOverride = value; }
get { return bCompileAgainstEditorOverride ?? (Type == TargetType.Editor); }
}
///
/// Whether to compile Recast navmesh generation.
///
[RequiresUniqueBuildEnvironment]
[ConfigFile(ConfigHierarchyType.Engine, "/Script/BuildSettings.BuildSettings", "bCompileRecast")]
public bool bCompileRecast = true;
///
/// Whether to compile with navmesh segment links.
///
[RequiresUniqueBuildEnvironment]
public bool bCompileNavmeshSegmentLinks = true;
///
/// Whether to compile with navmesh cluster links.
///
[RequiresUniqueBuildEnvironment]
public bool bCompileNavmeshClusterLinks = true;
///
/// Whether to compile SpeedTree support.
///
[ConfigFile(ConfigHierarchyType.Engine, "/Script/BuildSettings.BuildSettings", "bCompileSpeedTree")]
bool? bOverrideCompileSpeedTree;
///
/// Whether we should compile in support for SpeedTree or not.
///
[RequiresUniqueBuildEnvironment]
public bool bCompileSpeedTree
{
set { bOverrideCompileSpeedTree = value; }
get { return bOverrideCompileSpeedTree ?? Type == TargetType.Editor; }
}
///
/// Enable exceptions for all modules.
///
[RequiresUniqueBuildEnvironment]
public bool bForceEnableExceptions = false;
///
/// Enable inlining for all modules.
///
[RequiresUniqueBuildEnvironment]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUseInlining = true;
///
/// Enable exceptions for all modules.
///
[RequiresUniqueBuildEnvironment]
public bool bForceEnableObjCExceptions = false;
///
/// Enable RTTI for all modules.
///
[CommandLine("-rtti")]
[RequiresUniqueBuildEnvironment]
public bool bForceEnableRTTI = false;
///
/// Compile server-only code.
///
[RequiresUniqueBuildEnvironment]
public bool bWithServerCode
{
get { return bWithServerCodeOverride ?? (Type != TargetType.Client); }
set { bWithServerCodeOverride = value; }
}
private bool? bWithServerCodeOverride;
///
/// Compile with FName storing the number part in the name table.
/// Saves memory when most names are not numbered and those that are are referenced multiple times.
/// The game and engine must ensure they reuse numbered names similarly to name strings to avoid leaking memory.
///
[RequiresUniqueBuildEnvironment]
public bool bFNameOutlineNumber
{
get { return bFNameOutlineNumberOverride ?? false; }
set { bFNameOutlineNumberOverride = value; }
}
private bool? bFNameOutlineNumberOverride;
///
/// When enabled, Push Model Networking support will be compiled in.
/// This can help reduce CPU overhead of networking, at the cost of more memory.
/// Always enabled in editor builds.
///
[RequiresUniqueBuildEnvironment]
public bool bWithPushModel
{
get
{
return bWithPushModelOverride ?? (Type == TargetType.Editor);
}
set
{
bWithPushModelOverride = value;
}
}
private bool? bWithPushModelOverride;
///
/// Whether to include stats support even without the engine.
///
[RequiresUniqueBuildEnvironment]
public bool bCompileWithStatsWithoutEngine = false;
///
/// Whether to include plugin support.
///
[RequiresUniqueBuildEnvironment]
[ConfigFile(ConfigHierarchyType.Engine, "/Script/BuildSettings.BuildSettings", "bCompileWithPluginSupport")]
public bool bCompileWithPluginSupport = false;
///
/// Whether to allow plugins which support all target platforms.
///
[RequiresUniqueBuildEnvironment]
public bool bIncludePluginsForTargetPlatforms
{
get { return bIncludePluginsForTargetPlatformsOverride ?? (Type == TargetType.Editor); }
set { bIncludePluginsForTargetPlatformsOverride = value; }
}
private bool? bIncludePluginsForTargetPlatformsOverride;
///
/// Whether to allow accessibility code in both Slate and the OS layer.
///
[RequiresUniqueBuildEnvironment]
public bool bCompileWithAccessibilitySupport = true;
///
/// Whether to include PerfCounters support.
///
[RequiresUniqueBuildEnvironment]
public bool bWithPerfCounters
{
get { return bWithPerfCountersOverride ?? (Type == TargetType.Editor || Type == TargetType.Server); }
set { bWithPerfCountersOverride = value; }
}
[ConfigFile(ConfigHierarchyType.Engine, "/Script/BuildSettings.BuildSettings", "bWithPerfCounters")]
bool? bWithPerfCountersOverride;
///
/// Whether to enable support for live coding
///
[RequiresUniqueBuildEnvironment]
public bool bWithLiveCoding
{
get { return bWithLiveCodingPrivate ?? (Platform == UnrealTargetPlatform.Win64 && Configuration != UnrealTargetConfiguration.Shipping && Configuration != UnrealTargetConfiguration.Test && Type != TargetType.Program); }
set { bWithLiveCodingPrivate = value; }
}
bool? bWithLiveCodingPrivate;
///
/// Whether to enable support for live coding
///
[RequiresUniqueBuildEnvironment]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUseDebugLiveCodingConsole = false;
///
/// Whether to enable support for DirectX Math
/// LWC_TODO: No longer supported. Needs removing.
///
[RequiresUniqueBuildEnvironment]
public bool bWithDirectXMath = false;
///
/// Whether to turn on logging for test/shipping builds.
///
[RequiresUniqueBuildEnvironment]
public bool bUseLoggingInShipping = false;
///
/// Whether to turn on logging to memory for test/shipping builds.
///
[RequiresUniqueBuildEnvironment]
public bool bLoggingToMemoryEnabled;
///
/// Whether to check that the process was launched through an external launcher.
///
public bool bUseLauncherChecks = false;
///
/// Whether to turn on checks (asserts) for test/shipping builds.
///
[RequiresUniqueBuildEnvironment]
public bool bUseChecksInShipping = false;
///
/// Whether to turn on UTF-8 mode, mapping TCHAR to UTF8CHAR.
///
[RequiresUniqueBuildEnvironment]
public bool bTCHARIsUTF8 = false;
///
/// Whether to use the EstimatedUtcNow or PlatformUtcNow. EstimatedUtcNow is appropriate in
/// cases where PlatformUtcNow can be slow.
///
[RequiresUniqueBuildEnvironment]
public bool bUseEstimatedUtcNow = false;
///
/// True if we need FreeType support.
///
[RequiresUniqueBuildEnvironment]
[ConfigFile(ConfigHierarchyType.Engine, "/Script/BuildSettings.BuildSettings", "bCompileFreeType")]
public bool bCompileFreeType = true;
///
/// True if we want to favor optimizing size over speed.
///
[RequiresUniqueBuildEnvironment]
[ConfigFile(ConfigHierarchyType.Engine, "/Script/BuildSettings.BuildSettings", "bCompileForSize")]
public bool bCompileForSize = false;
///
/// Whether to compile development automation tests.
///
public bool bForceCompileDevelopmentAutomationTests = false;
///
/// Whether to compile performance automation tests.
///
public bool bForceCompilePerformanceAutomationTests = false;
///
/// Whether to override the defaults for automation tests (Debug/Development configs)
///
public bool bForceDisableAutomationTests = false;
///
/// If true, event driven loader will be used in cooked builds. @todoio This needs to be replaced by a runtime solution after async loading refactor.
///
[RequiresUniqueBuildEnvironment]
public bool bEventDrivenLoader;
///
/// Used to override the behavior controlling whether UCLASSes and USTRUCTs are allowed to have native pointer members, if disallowed they will be a UHT error and should be substituted with TObjectPtr members instead.
///
public PointerMemberBehavior? NativePointerMemberBehaviorOverride = null;
///
/// Whether the XGE controller worker and modules should be included in the engine build.
/// These are required for distributed shader compilation using the XGE interception interface.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUseXGEController = true;
///
/// Enables "include what you use" by default for modules in this target. Changes the default PCH mode for any module in this project to PCHUsageMode.UseExplicitOrSharedPCHs.
///
[CommandLine("-IWYU")]
public bool bIWYU = false;
///
/// Enforce "include what you use" rules; warns if monolithic headers (Engine.h, UnrealEd.h, etc...) are used, and checks that source files include their matching header first.
///
public bool bEnforceIWYU = true;
///
/// Whether the final executable should export symbols.
///
public bool bHasExports
{
get { return bHasExportsOverride ?? (LinkType == TargetLinkType.Modular); }
set { bHasExportsOverride = value; }
}
private bool? bHasExportsOverride;
///
/// Make static libraries for all engine modules as intermediates for this target.
///
[CommandLine("-Precompile")]
public bool bPrecompile = false;
///
/// Whether we should compile with support for OS X 10.9 Mavericks. Used for some tools that we need to be compatible with this version of OS X.
///
public bool bEnableOSX109Support = false;
///
/// True if this is a console application that's being built.
///
public bool bIsBuildingConsoleApplication = false;
///
/// If true, creates an additional console application. Hack for Windows, where it's not possible to conditionally inherit a parent's console Window depending on how
/// the application is invoked; you have to link the same executable with a different subsystem setting.
///
public bool bBuildAdditionalConsoleApp
{
get { return bBuildAdditionalConsoleAppOverride ?? (Type == TargetType.Editor); }
set { bBuildAdditionalConsoleAppOverride = value; }
}
private bool? bBuildAdditionalConsoleAppOverride;
///
/// True if debug symbols that are cached for some platforms should not be created.
///
public bool bDisableSymbolCache = true;
///
/// Whether to unify C++ code into larger files for faster compilation.
///
public bool bUseUnityBuild
{
get { return bUseUnityBuildOverride ?? !bEnableCppModules; }
set { bUseUnityBuildOverride = value; }
}
///
/// Whether to unify C++ code into larger files for faster compilation.
///
[CommandLine("-DisableUnity", Value = "false")]
[XmlConfigFile(Category = "BuildConfiguration", Name = nameof(bUseUnityBuild))]
bool? bUseUnityBuildOverride = null;
///
/// Whether to force C++ source files to be combined into larger files for faster compilation.
///
[CommandLine("-ForceUnity")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bForceUnityBuild = false;
///
/// Use a heuristic to determine which files are currently being iterated on and exclude them from unity blobs, result in faster
/// incremental compile times. The current implementation uses the read-only flag to distinguish the working set, assuming that files will
/// be made writable by the source control system if they are being modified. This is true for Perforce, but not for Git.
///
[CommandLine("-DisableAdaptiveUnity", Value = "false")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUseAdaptiveUnityBuild = true;
///
/// Disable optimization for files that are in the adaptive non-unity working set.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bAdaptiveUnityDisablesOptimizations = false;
///
/// Disables force-included PCHs for files that are in the adaptive non-unity working set.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bAdaptiveUnityDisablesPCH = false;
///
/// Backing storage for bAdaptiveUnityDisablesProjectPCH.
///
[XmlConfigFile(Category = "BuildConfiguration")]
bool? bAdaptiveUnityDisablesProjectPCHForProjectPrivate;
///
/// Whether to disable force-included PCHs for project source files in the adaptive non-unity working set. Defaults to bAdaptiveUnityDisablesPCH;
///
public bool bAdaptiveUnityDisablesPCHForProject
{
get { return bAdaptiveUnityDisablesProjectPCHForProjectPrivate ?? bAdaptiveUnityDisablesPCH; }
set { bAdaptiveUnityDisablesProjectPCHForProjectPrivate = value; }
}
///
/// Creates a dedicated PCH for each source file in the working set, allowing faster iteration on cpp-only changes.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bAdaptiveUnityCreatesDedicatedPCH = false;
///
/// Creates a dedicated PCH for each source file in the working set, allowing faster iteration on cpp-only changes.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bAdaptiveUnityEnablesEditAndContinue = false;
///
/// Creates a dedicated source file for each header file in the working set to detect missing includes in headers.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bAdaptiveUnityCompilesHeaderFiles = false;
///
/// The number of source files in a game module before unity build will be activated for that module. This
/// allows small game modules to have faster iterative compile times for single files, at the expense of slower full
/// rebuild times. This setting can be overridden by the bFasterWithoutUnity option in a module's Build.cs file.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public int MinGameModuleSourceFilesForUnityBuild = 32;
///
/// Default treatment of uncategorized warnings
///
public WarningLevel DefaultWarningLevel
{
get => (DefaultWarningLevelPrivate == WarningLevel.Default)? (bWarningsAsErrors ? WarningLevel.Error : WarningLevel.Warning) : DefaultWarningLevelPrivate;
set => DefaultWarningLevelPrivate = value;
}
///
[XmlConfigFile(Category = "BuildConfiguration", Name = nameof(DefaultWarningLevel))]
private WarningLevel DefaultWarningLevelPrivate;
///
/// Level to report deprecation warnings as errors
///
public WarningLevel DeprecationWarningLevel
{
get => (DeprecationWarningLevelPrivate == WarningLevel.Default)? DefaultWarningLevel : DeprecationWarningLevelPrivate;
set => DeprecationWarningLevelPrivate = value;
}
///
[XmlConfigFile(Category = "BuildConfiguration", Name = nameof(DeprecationWarningLevel))]
private WarningLevel DeprecationWarningLevelPrivate;
///
/// Forces shadow variable warnings to be treated as errors on platforms that support it.
///
[CommandLine("-ShadowVariableErrors", Value = nameof(WarningLevel.Error))]
public WarningLevel ShadowVariableWarningLevel = WarningLevel.Warning;
///
/// Whether to enable all warnings as errors. UE enables most warnings as errors already, but disables a few (such as deprecation warnings).
///
[XmlConfigFile(Category = "BuildConfiguration")]
[CommandLine("-WarningsAsErrors")]
public bool bWarningsAsErrors = false;
///
/// Indicates what warning/error level to treat unsafe type casts as on platforms that support it (e.g., double->float or int64->int32)
///
[XmlConfigFile(Category = "BuildConfiguration")]
public WarningLevel UnsafeTypeCastWarningLevel = WarningLevel.Off;
///
/// Forces the use of undefined identifiers in conditional expressions to be treated as errors.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUndefinedIdentifierErrors = true;
///
/// Forces frame pointers to be retained this is usually required when you want reliable callstacks e.g. mallocframeprofiler
///
public bool bRetainFramePointers
{
get
{
// Default to disabled on Linux to maintain legacy behavior
return bRetainFramePointersOverride ?? Platform.IsInGroup(UnrealPlatformGroup.Linux) == false;
}
set { bRetainFramePointersOverride = value; }
}
///
/// Forces frame pointers to be retained this is usually required when you want reliable callstacks e.g. mallocframeprofiler
///
[XmlConfigFile(Category = "BuildConfiguration", Name="bRetainFramePointers")]
[CommandLine("-RetainFramePointers", Value="true")]
[CommandLine("-NoRetainFramePointers", Value="false")]
public bool? bRetainFramePointersOverride = null;
///
/// New Monolithic Graphics drivers have optional "fast calls" replacing various D3d functions
///
[CommandLine("-FastMonoCalls", Value = "true")]
[CommandLine("-NoFastMonoCalls", Value = "false")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUseFastMonoCalls = true;
///
/// An approximate number of bytes of C++ code to target for inclusion in a single unified C++ file.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public int NumIncludedBytesPerUnityCPP = 384 * 1024;
///
/// Whether to stress test the C++ unity build robustness by including all C++ files files in a project from a single unified file.
///
[CommandLine("-StressTestUnity")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bStressTestUnity = false;
///
/// Whether to force debug info to be generated.
///
[CommandLine("-ForceDebugInfo")]
public bool bForceDebugInfo = false;
///
/// Whether to globally disable debug info generation; see DebugInfoHeuristics.cs for per-config and per-platform options.
///
[CommandLine("-NoDebugInfo")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bDisableDebugInfo = false;
///
/// Whether to disable debug info generation for generated files. This improves link times for modules that have a lot of generated glue code.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bDisableDebugInfoForGeneratedCode = false;
///
/// Whether to disable debug info on PC/Mac in development builds (for faster developer iteration, as link times are extremely fast with debug info disabled).
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bOmitPCDebugInfoInDevelopment = false;
///
/// Whether PDB files should be used for Visual C++ builds.
///
[CommandLine("-NoPDB", Value = "false")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUsePDBFiles = false;
///
/// Whether PCH files should be used.
///
[CommandLine("-NoPCH", Value = "false")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUsePCHFiles = true;
///
/// Whether to just preprocess source files for this target, and skip compilation
///
[CommandLine("-Preprocess")]
public bool bPreprocessOnly = false;
///
/// The minimum number of files that must use a pre-compiled header before it will be created and used.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public int MinFilesUsingPrecompiledHeader = 6;
///
/// When enabled, a precompiled header is always generated for game modules, even if there are only a few source files
/// in the module. This greatly improves compile times for iterative changes on a few files in the project, at the expense of slower
/// full rebuild times for small game projects. This can be overridden by setting MinFilesUsingPrecompiledHeaderOverride in
/// a module's Build.cs file.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bForcePrecompiledHeaderForGameModules = true;
///
/// Whether to use incremental linking or not. Incremental linking can yield faster iteration times when making small changes.
/// Currently disabled by default because it tends to behave a bit buggy on some computers (PDB-related compile errors).
///
[CommandLine("-IncrementalLinking")]
[CommandLine("-NoIncrementalLinking", Value = "false")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUseIncrementalLinking = false;
///
/// Whether to allow the use of link time code generation (LTCG).
///
[CommandLine("-LTCG")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bAllowLTCG = false;
///
/// When Link Time Code Generation (LTCG) is enabled, whether to
/// prefer using the lighter weight version on supported platforms.
///
[CommandLine("-ThinLTO")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bPreferThinLTO = false;
///
/// Whether to enable Profile Guided Optimization (PGO) instrumentation in this build.
///
[CommandLine("-PGOProfile", Value = "true")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bPGOProfile = false;
///
/// Whether to optimize this build with Profile Guided Optimization (PGO).
///
[CommandLine("-PGOOptimize", Value = "true")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bPGOOptimize = false;
///
/// Whether to support edit and continue. Only works on Microsoft compilers.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bSupportEditAndContinue = false;
///
/// Whether to omit frame pointers or not. Disabling is useful for e.g. memory profiling on the PC.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bOmitFramePointers = true;
///
/// Whether to enable support for C++20 modules
///
public bool bEnableCppModules = false;
///
/// Whether to enable support for C++20 coroutines
/// This option is provided to facilitate evaluation of the feature.
/// Expect the name of the option to change. Use of coroutines in with UE is untested and unsupported.
///
public bool bEnableCppCoroutinesForEvaluation = false;
///
/// If true, then enable memory profiling in the build (defines USE_MALLOC_PROFILER=1 and forces bOmitFramePointers=false).
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUseMallocProfiler = false;
///
/// Enables "Shared PCHs", a feature which significantly speeds up compile times by attempting to
/// share certain PCH files between modules that UBT detects is including those PCH's header files.
///
[CommandLine("-NoSharedPCH", Value = "false")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUseSharedPCHs = true;
///
/// True if Development and Release builds should use the release configuration of PhysX/APEX.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUseShippingPhysXLibraries = false;
///
/// True if Development and Release builds should use the checked configuration of PhysX/APEX. if bUseShippingPhysXLibraries is true this is ignored.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bUseCheckedPhysXLibraries = false;
///
/// Tells the UBT to check if module currently being built is violating EULA.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bCheckLicenseViolations = true;
///
/// Tells the UBT to break build if module currently being built is violating EULA.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bBreakBuildOnLicenseViolation = true;
///
/// Whether to use the :FASTLINK option when building with /DEBUG to create local PDBs on Windows. Fast, but currently seems to have problems finding symbols in the debugger.
///
[CommandLine("-FastPDB")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool? bUseFastPDBLinking;
///
/// Outputs a map file as part of the build.
///
[CommandLine("-MapFile")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bCreateMapFile = false;
///
/// True if runtime symbols files should be generated as a post build step for some platforms.
/// These files are used by the engine to resolve symbol names of callstack backtraces in logs.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bAllowRuntimeSymbolFiles = true;
///
/// Package full path (directory + filename) where to store input files used at link time
/// Normally used to debug a linker crash for platforms that support it
///
[CommandLine("-PackagePath")]
[XmlConfigFile(Category = "BuildConfiguration")]
public string? PackagePath = null;
///
/// Directory where to put crash report files for platforms that support it
///
[CommandLine("-CrashDiagnosticDirectory")]
[XmlConfigFile(Category = "BuildConfiguration")]
public string? CrashDiagnosticDirectory = null;
///
/// Bundle version for Mac apps.
///
[CommandLine("-BundleVersion")]
public string? BundleVersion = null;
///
/// Whether to deploy the executable after compilation on platforms that require deployment.
///
[CommandLine("-Deploy")]
public bool bDeployAfterCompile = false;
///
/// Whether to force skipping deployment for platforms that require deployment by default.
///
[CommandLine("-SkipDeploy")]
private bool bForceSkipDeploy = false;
///
/// When enabled, allows XGE to compile pre-compiled header files on remote machines. Otherwise, PCHs are always generated locally.
///
public bool bAllowRemotelyCompiledPCHs = false;
///
/// Whether headers in system paths should be checked for modification when determining outdated actions.
///
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bCheckSystemHeadersForModification;
///
/// Whether to disable linking for this target.
///
[CommandLine("-NoLink")]
public bool bDisableLinking = false;
///
/// Whether to ignore tracking build outputs for this target.
///
public bool bIgnoreBuildOutputs = false;
///
/// Indicates that this is a formal build, intended for distribution. This flag is automatically set to true when Build.version has a changelist set.
/// The only behavior currently bound to this flag is to compile the default resource file separately for each binary so that the OriginalFilename field is set correctly.
/// By default, we only compile the resource once to reduce build times.
///
[CommandLine("-Formal")]
public bool bFormalBuild = false;
///
/// Whether to clean Builds directory on a remote Mac before building.
///
[CommandLine("-FlushMac")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bFlushBuildDirOnRemoteMac = false;
///
/// Whether to write detailed timing info from the compiler and linker.
///
[CommandLine("-Timing")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bPrintToolChainTimingInfo = false;
///
/// Whether to parse timing data into a tracing file compatible with chrome://tracing.
///
[CommandLine("-Tracing")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bParseTimingInfoForTracing = false;
///
/// Whether to expose all symbols as public by default on POSIX platforms
///
[CommandLine("-PublicSymbolsByDefault")]
[XmlConfigFile(Category = "BuildConfiguration")]
public bool bPublicSymbolsByDefault = false;
///
/// Allows overriding the toolchain to be created for this target. This must match the name of a class declared in the UnrealBuildTool assembly.
///
[CommandLine("-ToolChain")]
public string? ToolChainName = null;
///
/// Whether to allow engine configuration to determine if we can load unverified certificates.
///
public bool bDisableUnverifiedCertificates = false;
///
/// Whether to load generated ini files in cooked build, (GameUserSettings.ini loaded either way)
///
public bool bAllowGeneratedIniWhenCooked = true;
///
/// Whether to load non-ufs ini files in cooked build, (GameUserSettings.ini loaded either way)
///
public bool bAllowNonUFSIniWhenCooked = true;
///
/// Add all the public folders as include paths for the compile environment.
///
public bool bLegacyPublicIncludePaths
{
get { return bLegacyPublicIncludePathsPrivate ?? (DefaultBuildSettings < BuildSettingsVersion.V2); }
set { bLegacyPublicIncludePathsPrivate = value; }
}
private bool? bLegacyPublicIncludePathsPrivate;
///
/// Which C++ stanard to use for compiling this target
///
[RequiresUniqueBuildEnvironment]
[CommandLine("-CppStd")]
[XmlConfigFile(Category = "BuildConfiguration")]
public CppStandardVersion CppStandard = CppStandardVersion.Default;
///
/// Do not allow manifest changes when building this target. Used to cause earlier errors when building multiple targets with a shared build environment.
///
[CommandLine("-NoManifestChanges")]
internal bool bNoManifestChanges = false;
///
/// The build version string
///
[CommandLine("-BuildVersion")]
public string? BuildVersion;
///
/// Specifies how to link modules in this target (monolithic or modular). This is currently protected for backwards compatibility. Call the GetLinkType() accessor
/// until support for the deprecated ShouldCompileMonolithic() override has been removed.
///
public TargetLinkType LinkType
{
get
{
return (LinkTypePrivate != TargetLinkType.Default) ? LinkTypePrivate : ((Type == global::UnrealBuildTool.TargetType.Editor) ? TargetLinkType.Modular : TargetLinkType.Monolithic);
}
set
{
LinkTypePrivate = value;
}
}
///
/// Backing storage for the LinkType property.
///
[RequiresUniqueBuildEnvironment]
[CommandLine("-Monolithic", Value ="Monolithic")]
[CommandLine("-Modular", Value ="Modular")]
TargetLinkType LinkTypePrivate = TargetLinkType.Default;
///
/// Macros to define globally across the whole target.
///
[RequiresUniqueBuildEnvironment]
[CommandLine("-Define:")]
public List GlobalDefinitions = new List();
///
/// Macros to define across all macros in the project.
///
[CommandLine("-ProjectDefine:")]
public List ProjectDefinitions = new List();
///
/// Specifies the name of the launch module. For modular builds, this is the module that is compiled into the target's executable.
///
public string? LaunchModuleName
{
get
{
return (LaunchModuleNamePrivate == null && Type != global::UnrealBuildTool.TargetType.Program) ? "Launch" : LaunchModuleNamePrivate;
}
set
{
LaunchModuleNamePrivate = value;
}
}
///
/// Backing storage for the LaunchModuleName property.
///
private string? LaunchModuleNamePrivate;
///
/// Specifies the path to write a header containing public definitions for this target. Useful when building a DLL to be consumed by external build processes.
///
public string? ExportPublicHeader;
///
/// List of additional modules to be compiled into the target.
///
public List ExtraModuleNames = new List();
///
/// Path to a manifest to output for this target
///
[CommandLine("-Manifest")]
public List ManifestFileNames = new List();
///
/// Path to a list of dependencies for this target, when precompiling
///
[CommandLine("-DependencyList")]
public List DependencyListFileNames = new List();
///
/// Backing storage for the BuildEnvironment property
///
[CommandLine("-SharedBuildEnvironment", Value = "Shared")]
[CommandLine("-UniqueBuildEnvironment", Value = "Unique")]
private TargetBuildEnvironment? BuildEnvironmentOverride;
///
/// Specifies the build environment for this target. See TargetBuildEnvironment for more information on the available options.
///
public TargetBuildEnvironment BuildEnvironment
{
get
{
if(BuildEnvironmentOverride.HasValue)
{
return BuildEnvironmentOverride.Value;
}
if (Type == TargetType.Program && ProjectFile != null && File!.IsUnderDirectory(ProjectFile.Directory))
{
return TargetBuildEnvironment.Unique;
}
else if (Unreal.IsEngineInstalled() || LinkType != TargetLinkType.Monolithic)
{
return TargetBuildEnvironment.Shared;
}
else
{
return TargetBuildEnvironment.Unique;
}
}
set
{
BuildEnvironmentOverride = value;
}
}
///
/// Whether to ignore violations to the shared build environment (eg. editor targets modifying definitions)
///
[CommandLine("-OverrideBuildEnvironment")]
public bool bOverrideBuildEnvironment = false;
///
/// Specifies a list of targets which should be built before this target is built.
///
public List PreBuildTargets = new List();
///
/// Specifies a list of steps which should be executed before this target is built, in the context of the host platform's shell.
/// The following variables will be expanded before execution:
/// $(EngineDir), $(ProjectDir), $(TargetName), $(TargetPlatform), $(TargetConfiguration), $(TargetType), $(ProjectFile).
///
public List PreBuildSteps = new List();
///
/// Specifies a list of steps which should be executed after this target is built, in the context of the host platform's shell.
/// The following variables will be expanded before execution:
/// $(EngineDir), $(ProjectDir), $(TargetName), $(TargetPlatform), $(TargetConfiguration), $(TargetType), $(ProjectFile).
///
public List PostBuildSteps = new List();
///
/// Specifies additional build products produced as part of this target.
///
public List AdditionalBuildProducts = new List();
///
/// Additional arguments to pass to the compiler
///
[RequiresUniqueBuildEnvironment]
[CommandLine("-CompilerArguments=")]
public string? AdditionalCompilerArguments;
///
/// Additional arguments to pass to the linker
///
[RequiresUniqueBuildEnvironment]
[CommandLine("-LinkerArguments=")]
public string? AdditionalLinkerArguments;
///
/// Max amount of memory that each compile action may require. Used by ParallelExecutor to decide the maximum
/// number of parallel actions to start at one time.
///
public double MemoryPerActionGB = 0.0;
///
/// List of modules to disable unity builds for
///
[XmlConfigFile(Category = "ModuleConfiguration", Name = "DisableUnityBuild")]
public string[]? DisableUnityBuildForModules = null;
///
/// List of modules to enable optimizations for
///
[XmlConfigFile(Category = "ModuleConfiguration", Name = "EnableOptimizeCode")]
public string[]? EnableOptimizeCodeForModules = null;
///
/// List of modules to disable optimizations for
///
[XmlConfigFile(Category = "ModuleConfiguration", Name = "DisableOptimizeCode")]
public string[]? DisableOptimizeCodeForModules = null;
///
/// When generating project files, specifies the name of the project file to use when there are multiple targets of the same type.
///
public string? GeneratedProjectName;
///
/// If this is non-null, then any platforms NOT listed will not be allowed to have modules in their directories be created
///
public UnrealTargetPlatform[]? OptedInModulePlatforms = null;
///
/// Android-specific target settings.
///
[ConfigSubObject]
public AndroidTargetRules AndroidPlatform = new AndroidTargetRules();
///
/// IOS-specific target settings.
///
[ConfigSubObject]
public IOSTargetRules IOSPlatform = new IOSTargetRules();
///
/// Linux-specific target settings.
///
[ConfigSubObject]
public LinuxTargetRules LinuxPlatform = new LinuxTargetRules();
///
/// Mac-specific target settings.
///
[ConfigSubObject]
public MacTargetRules MacPlatform = new MacTargetRules();
///
/// Windows-specific target settings.
///
[ConfigSubObject]
public WindowsTargetRules WindowsPlatform; // Requires 'this' parameter; initialized in constructor
///
/// Create a TargetRules instance
///
/// Type to create
/// Target info
/// Path to the file for the rules assembly
/// Path to the platform specific rules file
///
/// Logger for the new target rules
/// Target instance
public static TargetRules Create(Type RulesType, TargetInfo TargetInfo, FileReference? BaseFile, FileReference? PlatformFile, BuildSettingsVersion? DefaultBuildSettings, ILogger Logger)
{
TargetRules Rules = (TargetRules)FormatterServices.GetUninitializedObject(RulesType);
if (DefaultBuildSettings.HasValue)
{
Rules.DefaultBuildSettings = DefaultBuildSettings.Value;
}
// The base target file name: this affects where the resulting build product is created so the platform/group is not desired in this case.
Rules.File = BaseFile;
// The platform/group-specific target file name
Rules.TargetSourceFile = PlatformFile;
// Initialize the logger
Rules.Logger = Logger;
// Find the constructor
ConstructorInfo? Constructor = RulesType.GetConstructor(new Type[] { typeof(TargetInfo) });
if (Constructor == null)
{
throw new BuildException("No constructor found on {0} which takes an argument of type TargetInfo.", RulesType.Name);
}
// Invoke the regular constructor
try
{
Constructor.Invoke(Rules, new object[] { TargetInfo });
}
catch (Exception Ex)
{
throw new BuildException(Ex, "Unable to instantiate instance of '{0}' object type from compiled assembly '{1}'. Unreal Build Tool creates an instance of your module's 'Rules' object in order to find out about your module's requirements. The CLR exception details may provide more information: {2}", RulesType.Name, Path.GetFileNameWithoutExtension(RulesType.Assembly?.Location), Ex.ToString());
}
return Rules;
}
///
/// Constructor.
///
/// Information about the target being built
public TargetRules(TargetInfo Target)
{
this.DefaultName = Target.Name;
this.Platform = Target.Platform;
this.Configuration = Target.Configuration;
this.Architecture = Target.Architecture;
this.ProjectFile = Target.ProjectFile;
this.Version = Target.Version;
this.WindowsPlatform = new WindowsTargetRules(this);
// Make sure the logger was initialized by the caller
if (Logger == null)
{
throw new NotSupportedException("Logger property must be initialized by the caller.");
}
// Read settings from config files
Dictionary?> ConfigValues = new Dictionary?>();
foreach (object ConfigurableObject in GetConfigurableObjects())
{
ConfigCache.ReadSettings(DirectoryReference.FromFile(ProjectFile), Platform, ConfigurableObject, ConfigValues);
XmlConfig.ApplyTo(ConfigurableObject);
if (Target.Arguments != null)
{
Target.Arguments.ApplyTo(ConfigurableObject);
}
}
ConfigValueTracker = new ConfigValueTracker(ConfigValues);
// If we've got a changelist set, set that we're making a formal build
bFormalBuild = (Version.Changelist != 0 && Version.IsPromotedBuild);
// Allow the build platform to set defaults for this target
UEBuildPlatform.GetBuildPlatform(Platform).ResetTarget(this);
bDeployAfterCompile = bForceSkipDeploy ? false : bDeployAfterCompile;
// Set the default build version
if(String.IsNullOrEmpty(BuildVersion))
{
if(String.IsNullOrEmpty(Target.Version.BuildVersionString))
{
BuildVersion = String.Format("{0}-CL-{1}", Target.Version.BranchName, Target.Version.Changelist);
}
else
{
BuildVersion = Target.Version.BuildVersionString;
}
}
// Get the directory to use for crypto settings. We can build engine targets (eg. UHT) with
// a project file, but we can't use that to determine crypto settings without triggering
// constant rebuilds of UHT.
DirectoryReference? CryptoSettingsDir = DirectoryReference.FromFile(ProjectFile);
if (CryptoSettingsDir != null && File != null && !File.IsUnderDirectory(CryptoSettingsDir))
{
CryptoSettingsDir = null;
}
// Setup macros for signing and encryption keys
EncryptionAndSigning.CryptoSettings CryptoSettings = EncryptionAndSigning.ParseCryptoSettings(CryptoSettingsDir, Platform, Logger);
if (CryptoSettings.IsAnyEncryptionEnabled())
{
ProjectDefinitions.Add(String.Format("IMPLEMENT_ENCRYPTION_KEY_REGISTRATION()=UE_REGISTER_ENCRYPTION_KEY({0})", FormatHexBytes(CryptoSettings.EncryptionKey!.Key!)));
}
else
{
ProjectDefinitions.Add("IMPLEMENT_ENCRYPTION_KEY_REGISTRATION()=");
}
if (CryptoSettings.IsPakSigningEnabled())
{
ProjectDefinitions.Add(String.Format("IMPLEMENT_SIGNING_KEY_REGISTRATION()=UE_REGISTER_SIGNING_KEY(UE_LIST_ARGUMENT({0}), UE_LIST_ARGUMENT({1}))", FormatHexBytes(CryptoSettings.SigningKey!.PublicKey.Exponent!), FormatHexBytes(CryptoSettings.SigningKey.PublicKey.Modulus!)));
}
else
{
ProjectDefinitions.Add("IMPLEMENT_SIGNING_KEY_REGISTRATION()=");
}
}
///
/// Formats an array of bytes as a sequence of values
///
/// The data to convert into a string
/// List of hexadecimal bytes
private static string FormatHexBytes(byte[] Data)
{
return String.Join(",", Data.Select(x => String.Format("0x{0:X2}", x)));
}
///
/// Override any settings required for the selected target type
///
internal void SetOverridesForTargetType()
{
if(Type == global::UnrealBuildTool.TargetType.Game)
{
GlobalDefinitions.Add("UE_GAME=1");
}
else if (Type == global::UnrealBuildTool.TargetType.Client)
{
GlobalDefinitions.Add("UE_GAME=1");
GlobalDefinitions.Add("UE_CLIENT=1");
}
else if (Type == global::UnrealBuildTool.TargetType.Editor)
{
GlobalDefinitions.Add("UE_EDITOR=1");
}
else if (Type == global::UnrealBuildTool.TargetType.Server)
{
GlobalDefinitions.Add("UE_SERVER=1");
GlobalDefinitions.Add("USE_NULL_RHI=1");
}
}
///
/// Override settings that all cooked editor targets will want
///
protected void SetDefaultsForCookedEditor(bool bIsCookedCooker, bool bIsForExternalUse)
{
LinkType = TargetLinkType.Monolithic;
if (!bIsCookedCooker)
{
bBuildAdditionalConsoleApp = false;
}
GlobalDefinitions.Add("ASSETREGISTRY_ENABLE_PREMADE_REGISTRY_IN_EDITOR=1");
bUseLoggingInShipping = true;
GlobalDefinitions.Add("UE_IS_COOKED_EDITOR=1");
// remove some insecure things external users may not want
if (bIsForExternalUse)
{
bWithServerCode = false;
bBuildTargetDeveloperTools = false;
GlobalDefinitions.Add("AUTOSDKS_ENABLED=0");
}
// this will allow shader compiling to work based on whether or not the shaders directory is present
// to determine if we should allow shader compilation
GlobalDefinitions.Add("UE_ALLOW_SHADER_COMPILING_BASED_ON_SHADER_DIRECTORY_EXISTENCE=1");
// this setting can be used to compile out the shader compiler if that is important
//GlobalDefinitions.Add("UE_ALLOW_SHADER_COMPILING=0");
ConfigHierarchy ProjectGameIni = ConfigCache.ReadHierarchy(ConfigHierarchyType.Game, ProjectFile?.Directory, Platform);
List? DisabledPlugins;
List AllDisabledPlugins = new List();
if (ProjectGameIni.GetArray("CookedEditorSettings", "DisabledPlugins", out DisabledPlugins))
{
AllDisabledPlugins.AddRange(DisabledPlugins);
}
if (ProjectGameIni.GetArray("CookedEditorSettings" + (bIsCookedCooker ? "_CookedCooker" : "_CookedEditor"), "DisabledPlugins", out DisabledPlugins))
{
AllDisabledPlugins.AddRange(DisabledPlugins);
}
if (Configuration == UnrealTargetConfiguration.Shipping)
{
if (ProjectGameIni.GetArray("CookedEditorSettings", "DisabledPluginsInShipping", out DisabledPlugins))
{
AllDisabledPlugins.AddRange(DisabledPlugins);
}
if (ProjectGameIni.GetArray("CookedEditorSettings" + (bIsCookedCooker ? "_CookedCooker" : "_CookedEditor"), "DisabledPluginsInShipping", out DisabledPlugins))
{
AllDisabledPlugins.AddRange(DisabledPlugins);
}
}
// disable them, and remove them from Enabled in case they were there
foreach (string PluginName in AllDisabledPlugins)
{
DisablePlugins.Add(PluginName);
EnablePlugins.Remove(PluginName);
}
}
///
/// Gets a list of platforms that this target supports
///
/// Array of platforms that the target supports
internal UnrealTargetPlatform[] GetSupportedPlatforms()
{
// Take the SupportedPlatformsAttribute from the first type in the inheritance chain that supports it
for (Type? CurrentType = GetType(); CurrentType != null; CurrentType = CurrentType.BaseType)
{
object[] Attributes = CurrentType.GetCustomAttributes(typeof(SupportedPlatformsAttribute), false);
if (Attributes.Length > 0)
{
return Attributes.OfType().SelectMany(x => x.Platforms).Distinct().ToArray();
}
}
// Otherwise, get the default for the target type
if (Type == TargetType.Program)
{
return Utils.GetPlatformsInClass(UnrealPlatformClass.Desktop);
}
else if (Type == TargetType.Editor)
{
return Utils.GetPlatformsInClass(UnrealPlatformClass.Editor);
}
else
{
return Utils.GetPlatformsInClass(UnrealPlatformClass.All);
}
}
///
/// Gets a list of configurations that this target supports
///
/// Array of configurations that the target supports
internal UnrealTargetConfiguration[] GetSupportedConfigurations()
{
// Otherwise take the SupportedConfigurationsAttribute from the first type in the inheritance chain that supports it
for (Type? CurrentType = GetType(); CurrentType != null; CurrentType = CurrentType.BaseType)
{
object[] Attributes = CurrentType.GetCustomAttributes(typeof(SupportedConfigurationsAttribute), false);
if (Attributes.Length > 0)
{
return Attributes.OfType().SelectMany(x => x.Configurations).Distinct().ToArray();
}
}
// Otherwise, get the default for the target type
if (Type == TargetType.Editor)
{
return new[] { UnrealTargetConfiguration.Debug, UnrealTargetConfiguration.DebugGame, UnrealTargetConfiguration.Development };
}
else
{
return ((UnrealTargetConfiguration[])Enum.GetValues(typeof(UnrealTargetConfiguration))).Where(x => x != UnrealTargetConfiguration.Unknown).ToArray();
}
}
///
/// Finds all the subobjects which can be configured by command line options and config files
///
/// Sequence of objects
internal IEnumerable