// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
namespace UnrealBuildTool
{
///
/// The platforms that may be compilation targets for C++ files.
///
enum CppPlatform
{
Win32,
Win64,
Mac,
XboxOne,
PS4,
Android,
IOS,
HTML5,
Linux,
TVOS,
Switch,
}
///
/// Compiler configuration. This controls whether to use define debug macros and other compiler settings. Note that optimization level should be based on the bOptimizeCode variable rather than
/// this setting, so it can be modified on a per-module basis without introducing an incompatibility between object files or PCHs.
///
enum CppConfiguration
{
Debug,
Development,
Shipping
}
///
/// The optimization level that may be compilation targets for C# files.
///
enum CSharpTargetConfiguration
{
Debug,
Development,
}
///
/// The possible interactions between a precompiled header and a C++ file being compiled.
///
enum PrecompiledHeaderAction
{
None,
Include,
Create
}
///
/// Encapsulates the compilation output of compiling a set of C++ files.
///
class CPPOutput
{
public List ObjectFiles = new List();
public List DebugDataFiles = new List();
public FileItem PrecompiledHeaderFile = null;
}
///
/// Encapsulates the environment that a C# file is compiled in.
///
class CSharpEnvironment
{
///
/// The configuration to be compiled for.
///
public CSharpTargetConfiguration TargetConfiguration;
///
/// The target platform used to set the environment. Doesn't affect output.
///
public CppPlatform EnvironmentTargetPlatform;
}
///
/// Encapsulates the environment that a C++ file is compiled in.
///
class CppCompileEnvironment
{
///
/// The platform to be compiled/linked for.
///
public readonly CppPlatform Platform;
///
/// The configuration to be compiled/linked for.
///
public readonly CppConfiguration Configuration;
///
/// The architecture that is being compiled/linked (empty string by default)
///
public readonly string Architecture;
///
/// The directory to put the output object/debug files in.
///
public DirectoryReference OutputDirectory = null;
///
/// The directory to put precompiled header files in. Experimental setting to allow using a path on a faster drive. Defaults to the standard output directory if not set.
///
public DirectoryReference PCHOutputDirectory = null;
///
/// The directory to shadow source files in for syncing to remote compile servers
///
public DirectoryReference LocalShadowDirectory = null;
///
/// The name of the header file which is precompiled.
///
public FileReference PrecompiledHeaderIncludeFilename = null;
///
/// Whether the compilation should create, use, or do nothing with the precompiled header.
///
public PrecompiledHeaderAction PrecompiledHeaderAction = PrecompiledHeaderAction.None;
///
/// 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;
///
/// 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;
///
/// The minimum number of files that must use a pre-compiled header before it will be created and used.
///
public int MinFilesUsingPrecompiledHeaderOverride = 0;
///
/// Module uses a #import so must be built locally when compiling with SN-DBS
///
public bool bBuildLocallyWithSNDBS = false;
///
/// Enable exception handling
///
public bool bEnableExceptions = false;
///
/// Whether to warn about the use of shadow variables
///
public bool bEnableShadowVariableWarnings = false;
///
/// Whether to treat shadow variable warnings as errors.
///
public bool bShadowVariableWarningsAsErrors = false;
///
/// Whether to warn about the use of undefined identifiers in #if expressions
///
public bool bEnableUndefinedIdentifierWarnings = false;
///
/// Whether to treat undefined identifier warnings as errors.
///
public bool bUndefinedIdentifierWarningsAsErrors = false;
///
/// True if compiler optimizations should be enabled. This setting is distinct from the configuration (see CPPTargetConfiguration).
///
public bool bOptimizeCode = false;
///
/// Whether to optimize for minimal code size
///
public bool bOptimizeForSize = false;
///
/// True if debug info should be created.
///
public bool bCreateDebugInfo = true;
///
/// True if we're compiling .cpp files that will go into a library (.lib file)
///
public bool bIsBuildingLibrary = false;
///
/// True if we're compiling a DLL
///
public bool bIsBuildingDLL = false;
///
/// Whether we should compile using the statically-linked CRT. This is not widely supported for the whole engine, but is required for programs that need to run without dependencies.
///
public bool bUseStaticCRT = false;
///
/// Whether to use the debug CRT in debug configurations
///
public bool bUseDebugCRT = false;
///
/// Whether to omit frame pointers or not. Disabling is useful for e.g. memory profiling on the PC
///
public bool bOmitFramePointers = true;
///
/// 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;
///
/// Whether PDB files should be used for Visual C++ builds.
///
public bool bUsePDBFiles = false;
///
/// Whether to support edit and continue. Only works on Microsoft compilers in 32-bit compiles.
///
public bool bSupportEditAndContinue;
///
/// Whether to use incremental linking or not.
///
public bool bUseIncrementalLinking;
///
/// Whether to allow the use of LTCG (link time code generation)
///
public bool bAllowLTCG;
///
/// Enabled code analysis mode
///
public bool bEnableCodeAnalysis;
///
/// Whether to log detailed timing info from the compiler
///
public bool bPrintTimingInfo;
///
/// When enabled, allows XGE to compile pre-compiled header files on remote machines. Otherwise, PCHs are always generated locally.
///
public bool bAllowRemotelyCompiledPCHs = false;
///
/// The include paths to look for included files in.
///
public readonly CppIncludePaths IncludePaths = new CppIncludePaths();
///
/// List of header files to force include
///
public List ForceIncludeFiles = new List();
///
/// The C++ preprocessor definitions to use.
///
public List Definitions = new List();
///
/// Additional arguments to pass to the compiler.
///
public string AdditionalArguments = "";
///
/// A list of additional frameworks whose include paths are needed.
///
public List AdditionalFrameworks = new List();
///
/// The file containing the precompiled header data.
///
public FileItem PrecompiledHeaderFile = null;
///
/// Header file cache for this target
///
public CPPHeaders Headers;
///
/// Whether or not UHT is being built
///
public bool bHackHeaderGenerator;
///
/// Default constructor.
///
public CppCompileEnvironment(CppPlatform Platform, CppConfiguration Configuration, string Architecture, CPPHeaders Headers)
{
this.Platform = Platform;
this.Configuration = Configuration;
this.Architecture = Architecture;
this.Headers = Headers;
}
///
/// Copy constructor.
///
/// Environment to copy settings from
public CppCompileEnvironment(CppCompileEnvironment Other)
{
Platform = Other.Platform;
Configuration = Other.Configuration;
Architecture = Other.Architecture;
OutputDirectory = Other.OutputDirectory;
PCHOutputDirectory = Other.PCHOutputDirectory;
LocalShadowDirectory = Other.LocalShadowDirectory;
PrecompiledHeaderIncludeFilename = Other.PrecompiledHeaderIncludeFilename;
PrecompiledHeaderAction = Other.PrecompiledHeaderAction;
bUseRTTI = Other.bUseRTTI;
bUseAVX = Other.bUseAVX;
bFasterWithoutUnity = Other.bFasterWithoutUnity;
MinSourceFilesForUnityBuildOverride = Other.MinSourceFilesForUnityBuildOverride;
MinFilesUsingPrecompiledHeaderOverride = Other.MinFilesUsingPrecompiledHeaderOverride;
bBuildLocallyWithSNDBS = Other.bBuildLocallyWithSNDBS;
bEnableExceptions = Other.bEnableExceptions;
bShadowVariableWarningsAsErrors = Other.bShadowVariableWarningsAsErrors;
bEnableShadowVariableWarnings = Other.bEnableShadowVariableWarnings;
bUndefinedIdentifierWarningsAsErrors = Other.bUndefinedIdentifierWarningsAsErrors;
bEnableUndefinedIdentifierWarnings = Other.bEnableUndefinedIdentifierWarnings;
bOptimizeCode = Other.bOptimizeCode;
bOptimizeForSize = Other.bOptimizeForSize;
bCreateDebugInfo = Other.bCreateDebugInfo;
bIsBuildingLibrary = Other.bIsBuildingLibrary;
bIsBuildingDLL = Other.bIsBuildingDLL;
bUseStaticCRT = Other.bUseStaticCRT;
bUseDebugCRT = Other.bUseDebugCRT;
bOmitFramePointers = Other.bOmitFramePointers;
bEnableOSX109Support = Other.bEnableOSX109Support;
bUsePDBFiles = Other.bUsePDBFiles;
bSupportEditAndContinue = Other.bSupportEditAndContinue;
bUseIncrementalLinking = Other.bUseIncrementalLinking;
bAllowLTCG = Other.bAllowLTCG;
bEnableCodeAnalysis = Other.bEnableCodeAnalysis;
bPrintTimingInfo = Other.bPrintTimingInfo;
bAllowRemotelyCompiledPCHs = Other.bAllowRemotelyCompiledPCHs;
IncludePaths = new CppIncludePaths(Other.IncludePaths);
ForceIncludeFiles.AddRange(Other.ForceIncludeFiles);
Definitions.AddRange(Other.Definitions);
AdditionalArguments = Other.AdditionalArguments;
AdditionalFrameworks.AddRange(Other.AdditionalFrameworks);
PrecompiledHeaderFile = Other.PrecompiledHeaderFile;
Headers = Other.Headers;
bHackHeaderGenerator = Other.bHackHeaderGenerator;
}
}
}