// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using Tools.DotNETCommon; namespace UnrealBuildTool { /// /// ModuleRules is a data structure that contains the rules for defining a module /// public class ModuleRules { /// /// Type of module /// public enum ModuleType { /// /// C++ /// CPlusPlus, /// /// External (third-party) /// External, } /// /// Code optimization settings /// public enum CodeOptimization { /// /// Code should never be optimized if possible. /// Never, /// /// Code should only be optimized in non-debug builds (not in Debug). /// InNonDebugBuilds, /// /// Code should only be optimized in shipping builds (not in Debug, DebugGame, Development) /// InShippingBuildsOnly, /// /// Code should always be optimized if possible. /// Always, /// /// Default: 'InNonDebugBuilds' for game modules, 'Always' otherwise. /// Default, } /// /// What type of PCH to use for this module. /// public enum PCHUsageMode { /// /// Default: Engine modules use shared PCHs, game modules do not /// Default, /// /// Never use any PCHs. /// NoPCHs, /// /// Never use shared PCHs. Always generate a unique PCH for this module if appropriate /// NoSharedPCHs, /// /// Shared PCHs are OK! /// UseSharedPCHs, /// /// Shared PCHs may be used if an explicit private PCH is not set through PrivatePCHHeaderFile. In either case, none of the source files manually include a module PCH, and should include a matching header instead. /// UseExplicitOrSharedPCHs, } /// /// Which type of targets this module should be precompiled for /// public enum PrecompileTargetsType { /// /// Never precompile this module. /// None, /// /// Inferred from the module's directory. Engine modules under Engine/Source/Runtime will be compiled for games, those under Engine/Source/Editor will be compiled for the editor, etc... /// Default, /// /// Any game targets. /// Game, /// /// Any editor targets. /// Editor, /// /// Any targets. /// Any, } /// /// Control visibility of symbols in this module for special cases /// public enum SymbolVisibility { /// /// Standard visibility rules /// Default, /// /// Make sure symbols in this module are visible in Dll builds /// VisibileForDll, } /// /// Information about a file which is required by the target at runtime, and must be moved around with it. /// [Serializable] public class RuntimeDependency { /// /// The file that should be staged. Should use $(EngineDir) and $(ProjectDir) variables as a root, so that the target can be relocated to different machines. /// public string Path; /// /// The initial location for this file. It will be copied to Path at build time, ready for staging. /// public string SourcePath; /// /// How to stage this file. /// public StagedFileType Type; /// /// Constructor /// /// Path to the runtime dependency /// How to stage the given path public RuntimeDependency(string InPath, StagedFileType InType = StagedFileType.NonUFS) { Path = InPath; Type = InType; } /// /// Constructor /// /// Path to the runtime dependency /// Source path for the file in the working tree /// How to stage the given path public RuntimeDependency(string InPath, string InSourcePath, StagedFileType InType = StagedFileType.NonUFS) { Path = InPath; SourcePath = InSourcePath; Type = InType; } } /// /// List of runtime dependencies, with convenience methods for adding new items /// [Serializable] public class RuntimeDependencyList { /// /// Inner list of runtime dependencies /// internal List Inner = new List(); /// /// Default constructor /// public RuntimeDependencyList() { } /// /// Add a runtime dependency to the list /// /// Path to the runtime dependency. May include wildcards. public void Add(string InPath) { Inner.Add(new RuntimeDependency(InPath)); } /// /// Add a runtime dependency to the list /// /// Path to the runtime dependency. May include wildcards. /// How to stage this file public void Add(string InPath, StagedFileType InType) { Inner.Add(new RuntimeDependency(InPath, InType)); } /// /// Add a runtime dependency to the list /// /// Path to the runtime dependency. May include wildcards. /// Source path for the file to be added as a dependency. May include wildcards. /// How to stage this file public void Add(string InPath, string InSourcePath, StagedFileType InType = StagedFileType.NonUFS) { Inner.Add(new RuntimeDependency(InPath, InSourcePath, InType)); } /// /// Add a runtime dependency to the list /// /// RuntimeDependency instance [Obsolete("Constructing a RuntimeDependency object is deprecated. Call RuntimeDependencies.Add() with the path to the file to stage.")] public void Add(RuntimeDependency InRuntimeDependency) { Inner.Add(InRuntimeDependency); } } /// /// List of runtime dependencies, with convenience methods for adding new items /// [Serializable] public class ReceiptPropertyList { /// /// Inner list of runtime dependencies /// internal List Inner = new List(); /// /// Default constructor /// public ReceiptPropertyList() { } /// /// Add a receipt property to the list /// /// Name of the property /// Value for the property public void Add(string Name, string Value) { Inner.Add(new ReceiptProperty(Name, Value)); } /// /// Add a receipt property to the list /// /// ReceiptProperty instance [Obsolete("Constructing a ReceiptProperty object is deprecated. Call ReceiptProperties.Add() with the path to the file to stage.")] public void Add(ReceiptProperty InReceiptProperty) { Inner.Add(InReceiptProperty); } } /// /// Stores information about a framework on IOS or MacOS /// public class Framework { /// /// Name of the framework /// internal string Name; /// /// For non-system frameworks, specifies the path to a zip file that contains it. /// internal string ZipPath; /// /// /// internal string CopyBundledAssets = null; /// /// Constructor /// /// Name of the framework /// Path to a zip file containing the framework. May be null. /// public Framework(string Name, string ZipPath = null, string CopyBundledAssets = null) { this.Name = Name; this.ZipPath = ZipPath; this.CopyBundledAssets = CopyBundledAssets; } } /// /// Deprecated; wrapper for Framework. /// [Obsolete("The UEBuildFramework class has been deprecated in UE 4.22. Please use the Framework class instead.")] public class UEBuildFramework : Framework { /// /// Constructor /// /// Name of the framework /// Path to a zip file containing the framework. May be null. /// public UEBuildFramework(string Name, string ZipPath = null, string CopyBundledAssets = null) : base(Name, ZipPath, CopyBundledAssets) { } } /// /// /// public class BundleResource { /// /// /// public string ResourcePath = null; /// /// /// public string BundleContentsSubdir = null; /// /// /// public bool bShouldLog = true; /// /// Constructor /// /// /// /// public BundleResource(string ResourcePath, string BundleContentsSubdir = "Resources", bool bShouldLog = true) { this.ResourcePath = ResourcePath; this.BundleContentsSubdir = BundleContentsSubdir; this.bShouldLog = bShouldLog; } } /// /// Deprecated; wrapper for BundleResource. /// [Obsolete("The UEBuildBundleResource class has been deprecated in UE 4.22. Please use the BundleResource class instead.")] public class UEBuildBundleResource : BundleResource { /// /// Constructor /// /// /// /// public UEBuildBundleResource(string InResourcePath, string InBundleContentsSubdir = "Resources", bool bInShouldLog = true) : base(InResourcePath, InBundleContentsSubdir, bInShouldLog) { } } /// /// Name of this module /// public string Name { get; internal set; } /// /// File containing this module /// internal FileReference File; /// /// Directory containing this module /// internal DirectoryReference Directory; /// /// Additional directories that contribute to this module (likely in UnrealBuildTool.PlatformExtensionsDirectory). /// The dictionary tracks module subclasses /// internal Dictionary DirectoriesForModuleSubClasses; /// /// Plugin containing this module /// internal PluginInfo Plugin; /// /// The rules context for this instance /// internal ModuleRulesContext Context; /// /// Rules for the target that this module belongs to /// public readonly ReadOnlyTargetRules Target; /// /// Type of module /// public ModuleType Type = ModuleType.CPlusPlus; /// /// Subfolder of Binaries/PLATFORM folder to put this module in when building DLLs. This should only be used by modules that are found via searching like the /// TargetPlatform or ShaderFormat modules. If FindModules is not used to track them down, the modules will not be found. /// public string BinariesSubFolder = ""; /// /// When this module's code should be optimized. /// public CodeOptimization OptimizeCode = CodeOptimization.Default; /// /// Explicit private PCH for this module. Implies that this module will not use a shared PCH. /// public string PrivatePCHHeaderFile; /// /// Header file name for a shared PCH provided by this module. Must be a valid relative path to a public C++ header file. /// This should only be set for header files that are included by a significant number of other C++ modules. /// public string SharedPCHHeaderFile; /// /// Specifies an alternate name for intermediate directories and files for intermediates of this module. Useful when hitting path length limitations. /// public string ShortName = null; /// /// Precompiled header usage for this module /// public PCHUsageMode PCHUsage = PCHUsageMode.Default; /// /// Whether this module should be treated as an engine module (eg. using engine definitions, PCHs, compiled with optimizations enabled in DebugGame configurations, etc...). /// Initialized to a default based on the rules assembly it was created from. /// public bool bTreatAsEngineModule; /// /// Whether to use backwards compatible defaults for this module. By default, engine modules always use the latest default settings, while project modules do not (to support /// an easier migration path). /// public bool bUseBackwardsCompatibleDefaults; /// /// Use run time type information /// public bool bUseRTTI = false; /// /// Use AVX instructions /// public bool bUseAVX = false; /// /// Enable buffer security checks. This should usually be enabled as it prevents severe security risks. /// public bool bEnableBufferSecurityChecks = true; /// /// Enable exception handling /// public bool bEnableExceptions = false; /// /// Enable objective C exception handling /// public bool bEnableObjCExceptions = false; /// /// Enable warnings for shadowed variables /// public bool bEnableShadowVariableWarnings = true; /// /// Enable warnings for using undefined identifiers in #if expressions /// public bool bEnableUndefinedIdentifierWarnings = true; /// /// If true and unity builds are enabled, this module will build without unity. /// public bool bFasterWithoutUnity = false; /// /// The number of source files in this module before unity build will be activated for that module. If set to /// anything besides -1, will override the default setting which is controlled by MinGameModuleSourceFilesForUnityBuild /// public int MinSourceFilesForUnityBuildOverride = 0; /// /// Overrides BuildConfiguration.MinFilesUsingPrecompiledHeader if non-zero. /// public int MinFilesUsingPrecompiledHeaderOverride = 0; /// /// Module uses a #import so must be built locally when compiling with SN-DBS /// public bool bBuildLocallyWithSNDBS = false; /// /// Redistribution override flag for this module. /// public bool? IsRedistributableOverride = null; /// /// Whether the output from this module can be publicly distributed, even if it has code/ /// dependencies on modules that are not (i.e. CarefullyRedist, NotForLicensees, NoRedist). /// This should be used when you plan to release binaries but not source. /// public bool bOutputPubliclyDistributable = false; /// /// List of folders which are whitelisted to be referenced when compiling this binary, without propagating restricted folder names /// public List WhitelistRestrictedFolders = new List(); /// /// Enforce "include what you use" rules when PCHUsage is set to ExplicitOrSharedPCH; warns when monolithic headers (Engine.h, UnrealEd.h, etc...) /// are used, and checks that source files include their matching header first. /// public bool bEnforceIWYU = true; /// /// Whether to add all the default include paths to the module (eg. the Source/Classes folder, subfolders under Source/Public). /// public bool bAddDefaultIncludePaths = true; /// /// Whether to ignore dangling (i.e. unresolved external) symbols in modules /// public bool bIgnoreUnresolvedSymbols = false; /// /// Whether this module should be precompiled. Defaults to the bPrecompile flag from the target. Clear this flag to prevent a module being precompiled. /// public bool bPrecompile; /// /// Whether this module should use precompiled data. Always true for modules created from installed assemblies. /// public bool bUsePrecompiled; /// /// Whether this module can use PLATFORM_XXXX style defines, where XXXX is a confidential platform name. This is used to ensure engine or other /// shared code does not reveal confidential information inside an #if PLATFORM_XXXX block. Licensee game code may want to allow for them, however. /// Note: this is future looking, and previous confidential platforms (like PS4) are unlikely to be restricted /// public bool bAllowConfidentialPlatformDefines = false; /// /// List of modules names (no path needed) with header files that our module's public headers needs access to, but we don't need to "import" or link against. /// public List PublicIncludePathModuleNames = new List(); /// /// List of public dependency module names (no path needed) (automatically does the private/public include). These are modules that are required by our public source files. /// public List PublicDependencyModuleNames = new List(); /// /// List of modules name (no path needed) with header files that our module's private code files needs access to, but we don't need to "import" or link against. /// public List PrivateIncludePathModuleNames = new List(); /// /// List of private dependency module names. These are modules that our private code depends on but nothing in our public /// include files depend on. /// public List PrivateDependencyModuleNames = new List(); /// /// Only for legacy reason, should not be used in new code. List of module dependencies that should be treated as circular references. This modules must have already been added to /// either the public or private dependent module list. /// public List CircularlyReferencedDependentModules = new List(); /// /// List of system/library include paths - typically used for External (third party) modules. These are public stable header file directories that are not checked when resolving header dependencies. /// public List PublicSystemIncludePaths = new List(); /// /// (This setting is currently not need as we discover all files from the 'Public' folder) List of all paths to include files that are exposed to other modules /// public List PublicIncludePaths = new List(); /// /// List of all paths to this module's internal include files, not exposed to other modules (at least one include to the 'Private' path, more if we want to avoid relative paths) /// public List PrivateIncludePaths = new List(); /// /// List of system/library paths (directory of .lib files) - typically used for External (third party) modules /// public List PublicLibraryPaths = new List(); /// /// List of search paths for libraries at runtime (eg. .so files) /// public List PrivateRuntimeLibraryPaths = new List(); /// /// List of search paths for libraries at runtime (eg. .so files) /// public List PublicRuntimeLibraryPaths = new List(); /// /// List of additional libraries (names of the .lib files including extension) - typically used for External (third party) modules /// public List PublicAdditionalLibraries = new List(); /// /// List of XCode frameworks (iOS and MacOS) /// public List PublicFrameworks = new List(); /// /// List of weak frameworks (for OS version transitions) /// public List PublicWeakFrameworks = new List(); /// /// List of addition frameworks - typically used for External (third party) modules on Mac and iOS /// public List PublicAdditionalFrameworks = new List(); /// /// List of addition resources that should be copied to the app bundle for Mac or iOS /// public List AdditionalBundleResources = new List(); /// /// For builds that execute on a remote machine (e.g. iOS), this list contains additional files that /// need to be copied over in order for the app to link successfully. Source/header files and PCHs are /// automatically copied. Usually this is simply a list of precompiled third party library dependencies. /// [Obsolete("To specify files to be transferred to a remote Mac for compilation, create a [Project]/Build/Rsync/RsyncProject.txt file. See https://linux.die.net/man/1/rsync for more information about Rsync filter rules.")] public List PublicAdditionalShadowFiles = new List(); /// /// List of delay load DLLs - typically used for External (third party) modules /// public List PublicDelayLoadDLLs = new List(); /// /// Accessor for the PublicDefinitions list /// [Obsolete("The 'Definitions' property has been deprecated. Please use 'PublicDefinitions' instead.")] public List Definitions { get { return PublicDefinitions; } } /// /// Private compiler definitions for this module /// public List PrivateDefinitions = new List(); /// /// Public compiler definitions for this module /// public List PublicDefinitions = new List(); // @ATG_CHANGE : BEGIN winmd support /// /// Force enable /ZW for this module /// public bool bEnableWinRTComponentExtensions = false; /// /// /ZW modules only: The winmds referenced by the module and exposed over its interface. /// public List PublicWinMDReferences = new List(); /// /// /ZW modules only: The winmds referenced by the module's private implementation. /// public List PrivateWinMDReferences = new List(); // @ATG_CHANGE : END /// /// Append (or create) /// /// /// public void AppendStringToPublicDefinition(string Definition, string Text) { string WithEquals = Definition + "="; for (int Index=0; Index < PublicDefinitions.Count; Index++) { if (PublicDefinitions[Index].StartsWith(WithEquals)) { PublicDefinitions[Index] = PublicDefinitions[Index] + Text; return; } } // if we get here, we need to make a new entry PublicDefinitions.Add(Definition + "=" + Text); } /// /// Addition modules this module may require at run-time /// public List DynamicallyLoadedModuleNames = new List(); /// /// Extra modules this module may require at run time, that are on behalf of another platform (i.e. shader formats and the like) /// [Obsolete("PlatformSpecificDynamicallyLoadedModuleNames is deprecated; use DynamicallyLoadedModuleNames instead")] public List PlatformSpecificDynamicallyLoadedModuleNames { get { return DynamicallyLoadedModuleNames; } } /// /// List of files which this module depends on at runtime. These files will be staged along with the target. /// public RuntimeDependencyList RuntimeDependencies = new RuntimeDependencyList(); /// /// List of additional properties to be added to the build receipt /// public ReceiptPropertyList AdditionalPropertiesForReceipt = new ReceiptPropertyList(); /// /// Which targets this module should be precompiled for /// public PrecompileTargetsType PrecompileForTargets = PrecompileTargetsType.Default; /// /// External files which invalidate the makefile if modified. Relative paths are resolved relative to the .build.cs file. /// public List ExternalDependencies = new List(); /// /// Whether this module requires the IMPLEMENT_MODULE macro to be implemented. Most UE4 modules require this, since we use the IMPLEMENT_MODULE macro /// to do other global overloads (eg. operator new/delete forwarding to GMalloc). /// public bool? bRequiresImplementModule; /// /// Whether this module qualifies included headers from other modules relative to the root of their 'Public' folder. This reduces the number /// of search paths that have to be passed to the compiler, improving performance and reducing the length of the compiler command line. /// public bool? bLegacyPublicIncludePaths; /// /// Which stanard to use for compiling this module /// public CppStandardVersion CppStandard = CppStandardVersion.Default; /// /// Control visibility of symbols /// public SymbolVisibility ModuleSymbolVisibility = ModuleRules.SymbolVisibility.Default; /// /// The current engine directory /// public string EngineDirectory { get { return UnrealBuildTool.EngineDirectory.FullName; } } /// /// Property for the directory containing this plugin. Useful for adding paths to third party dependencies. /// public string PluginDirectory { get { if(Plugin == null) { throw new BuildException("Module '{0}' does not belong to a plugin; PluginDirectory property is invalid.", Name); } else { return Plugin.Directory.FullName; } } } /// /// Property for the directory containing this module. Useful for adding paths to third party dependencies. /// public string ModuleDirectory { get { return Directory.FullName; } } /// /// Constructor. For backwards compatibility while the parameterless constructor is being phased out, initialization which would happen here is done by /// RulesAssembly.CreateModulRules instead. /// /// Rules for building this target public ModuleRules(ReadOnlyTargetRules Target) { this.Target = Target; } /// /// Add the given Engine ThirdParty modules as static private dependencies /// Statically linked to this module, meaning they utilize exports from the other module /// Private, meaning the include paths for the included modules will not be exposed when giving this modules include paths /// NOTE: There is no AddThirdPartyPublicStaticDependencies function. /// /// The target this module belongs to /// The names of the modules to add public void AddEngineThirdPartyPrivateStaticDependencies(ReadOnlyTargetRules Target, params string[] ModuleNames) { if (!bUsePrecompiled || Target.LinkType == TargetLinkType.Monolithic) { PrivateDependencyModuleNames.AddRange(ModuleNames); } } /// /// Add the given Engine ThirdParty modules as dynamic private dependencies /// Dynamically linked to this module, meaning they do not utilize exports from the other module /// Private, meaning the include paths for the included modules will not be exposed when giving this modules include paths /// NOTE: There is no AddThirdPartyPublicDynamicDependencies function. /// /// Rules for the target being built /// The names of the modules to add public void AddEngineThirdPartyPrivateDynamicDependencies(ReadOnlyTargetRules Target, params string[] ModuleNames) { if (!bUsePrecompiled || Target.LinkType == TargetLinkType.Monolithic) { PrivateIncludePathModuleNames.AddRange(ModuleNames); DynamicallyLoadedModuleNames.AddRange(ModuleNames); } } /// /// Setup this module for physics support (based on the settings in UEBuildConfiguration) /// public void EnableMeshEditorSupport(ReadOnlyTargetRules Target) { if (Target.bEnableMeshEditor == true) { PublicDefinitions.Add("ENABLE_MESH_EDITOR=1"); } else { PublicDefinitions.Add("ENABLE_MESH_EDITOR=0"); } } /// /// Setup this module for physics support (based on the settings in UEBuildConfiguration) /// public void SetupModulePhysicsSupport(ReadOnlyTargetRules Target) { PublicIncludePathModuleNames.Add("PhysicsCore"); PublicDependencyModuleNames.Add("PhysicsCore"); bool bUseNonPhysXInterface = Target.bUseChaos == true || Target.bCompileImmediatePhysics == true; // if (Target.bCompileChaos == true || Target.bUseChaos == true) { PublicDefinitions.Add("INCLUDE_CHAOS=1"); PublicIncludePathModuleNames.AddRange( new string[] { "Chaos", "FieldSystemCore" } ); PublicDependencyModuleNames.AddRange( new string[] { "Chaos", "FieldSystemCore" } ); } else { PublicDefinitions.Add("INCLUDE_CHAOS=0"); } // definitions used outside of PhysX/APEX need to be set here, not in PhysX.Build.cs or APEX.Build.cs, // since we need to make sure we always set it, even to 0 (because these are Private dependencies, the // defines inside their Build.cs files won't leak out) if (Target.bCompilePhysX == true) { PrivateDependencyModuleNames.Add("PhysX"); PublicDefinitions.Add("WITH_PHYSX=1"); } else { PublicDefinitions.Add("WITH_PHYSX=0"); } if(!bUseNonPhysXInterface) { // Disable non-physx interfaces PublicDefinitions.Add("WITH_CHAOS=0"); // // WITH_CHAOS_NEEDS_TO_BE_FIXED // // Anything wrapped in this define needs to be fixed // in one of the build targets. This define was added // to help identify complier failures between the // the three build targets( UseChaos, PhysX, WithChaos ) // This defaults to off , and will be enabled for bUseChaos. // This define should be removed when all the references // have been fixed across the different builds. // PublicDefinitions.Add("WITH_CHAOS_NEEDS_TO_BE_FIXED=0"); PublicDefinitions.Add("PHYSICS_INTERFACE_LLIMMEDIATE=0"); if (Target.bCompilePhysX) { PublicDefinitions.Add("PHYSICS_INTERFACE_PHYSX=1"); } else { PublicDefinitions.Add("PHYSICS_INTERFACE_PHYSX=0"); } if (Target.bCompileAPEX == true) { if (!Target.bCompilePhysX) { throw new BuildException("APEX is enabled, without PhysX. This is not supported!"); } PrivateDependencyModuleNames.Add("APEX"); PublicDefinitions.Add("WITH_APEX=1"); // @MIXEDREALITY_CHANGE : BEGIN - Do not use Apex Cloth for HoloLens. TODO: can we enable this in the future? if (Target.Platform == UnrealTargetPlatform.HoloLens) { PublicDefinitions.Add("WITH_APEX_CLOTHING=0"); PublicDefinitions.Add("WITH_CLOTH_COLLISION_DETECTION=0"); } else { PublicDefinitions.Add("WITH_APEX_CLOTHING=1"); PublicDefinitions.Add("WITH_CLOTH_COLLISION_DETECTION=1"); } // @MIXEDREALITY_CHANGE : END PublicDefinitions.Add("WITH_PHYSX_COOKING=1"); // APEX currently relies on cooking even at runtime } else { PublicDefinitions.Add("WITH_APEX=0"); PublicDefinitions.Add("WITH_APEX_CLOTHING=0"); PublicDefinitions.Add("WITH_CLOTH_COLLISION_DETECTION=0"); PublicDefinitions.Add(string.Format("WITH_PHYSX_COOKING={0}", Target.bBuildEditor && Target.bCompilePhysX ? 1 : 0)); // without APEX, we only need cooking in editor builds } if (Target.bCompileNvCloth == true) { if (!Target.bCompilePhysX) { throw new BuildException("NvCloth is enabled, without PhysX. This is not supported!"); } PrivateDependencyModuleNames.Add("NvCloth"); PublicDefinitions.Add("WITH_NVCLOTH=1"); } else { PublicDefinitions.Add("WITH_NVCLOTH=0"); } } else { // Disable apex/cloth/physx interface PublicDefinitions.Add("PHYSICS_INTERFACE_PHYSX=0"); PublicDefinitions.Add("WITH_APEX=0"); PublicDefinitions.Add("WITH_APEX_CLOTHING=0"); PublicDefinitions.Add("WITH_CLOTH_COLLISION_DETECTION=0"); PublicDefinitions.Add(string.Format("WITH_PHYSX_COOKING={0}", Target.bBuildEditor && Target.bCompilePhysX ? 1 : 0)); // without APEX, we only need cooking in editor builds PublicDefinitions.Add("WITH_NVCLOTH=0"); if(Target.bUseChaos) { PublicDefinitions.Add("WITH_CHAOS=1"); PublicDefinitions.Add("WITH_CHAOS_NEEDS_TO_BE_FIXED=1"); PublicDefinitions.Add("COMPILE_ID_TYPES_AS_INTS=0"); PublicIncludePathModuleNames.AddRange( new string[] { "Chaos", } ); PublicDependencyModuleNames.AddRange( new string[] { "Chaos", } ); } else { PublicDefinitions.Add("WITH_CHAOS=0"); PublicDefinitions.Add("WITH_CHAOS_NEEDS_TO_BE_FIXED=0"); } if(Target.bCompileImmediatePhysics) { PublicDefinitions.Add("PHYSICS_INTERFACE_LLIMMEDIATE=1"); PublicDependencyModuleNames.Add("PhysX"); } else { PublicDefinitions.Add("PHYSICS_INTERFACE_LLIMMEDIATE=0"); } } if(Target.bCustomSceneQueryStructure) { PublicDefinitions.Add("WITH_CUSTOM_SQ_STRUCTURE=1"); } else { PublicDefinitions.Add("WITH_CUSTOM_SQ_STRUCTURE=0"); } // Unused interface PublicDefinitions.Add("WITH_IMMEDIATE_PHYSX=0"); } /// /// Determines if this module can be precompiled for the current target. /// /// Path to the module rules file /// True if the module can be precompiled, false otherwise internal bool IsValidForTarget(FileReference RulesFile) { if(Type == ModuleRules.ModuleType.CPlusPlus) { switch (PrecompileForTargets) { case ModuleRules.PrecompileTargetsType.None: return false; case ModuleRules.PrecompileTargetsType.Default: return (Target.Type == TargetType.Editor || !RulesFile.IsUnderDirectory(UnrealBuildTool.EngineSourceDeveloperDirectory) || Plugin != null); case ModuleRules.PrecompileTargetsType.Game: return (Target.Type == TargetType.Client || Target.Type == TargetType.Server || Target.Type == TargetType.Game); case ModuleRules.PrecompileTargetsType.Editor: return (Target.Type == TargetType.Editor); case ModuleRules.PrecompileTargetsType.Any: return true; } } return false; } /// /// Returns the module directory for a given subclass of the module (platform extensions add subclasses of ModuleRules to add in platform-specific settings) /// /// typeof the subclass /// Directory where the subclass's .Build.cs lives, or null if not found public DirectoryReference GetModuleDirectoryForSubClass(Type Type) { if (DirectoriesForModuleSubClasses == null) { return null; } DirectoryReference Directory; if (DirectoriesForModuleSubClasses.TryGetValue(Type, out Directory)) { return Directory; } return null; } /// /// Returns the directories for all subclasses of this module /// /// List of directories, or null if none were added public DirectoryReference[] GetModuleDirectoriesForAllSubClasses() { return DirectoriesForModuleSubClasses == null ? null : DirectoriesForModuleSubClasses.Values.ToArray(); } } }