在Engine\Source\Programs\UnrealBuildTool\Windows\VCToolChain.cs下:
//
// PC
//
if ((CompileEnvironment.Config.Target.Platform == CPPTargetPlatform.Win32) ||
(CompileEnvironment.Config.Target.Platform == CPPTargetPlatform.Win64))
{
// SSE options are not allowed when using CLR compilation
if (CompileEnvironment.Config.CLRMode == CPPCLRMode.CLRDisabled && WindowsPlatform.bUseVCCompilerArgs)
{
if (CompileEnvironment.Config.bUseAVX)
{
// Allow the compiler to generate AVX instructions.
Arguments.Append(" /arch:AVX");
}
// SSE options are not allowed when using the 64 bit toolchain
// (enables SSE2 automatically)
else if (CompileEnvironment.Config.Target.Platform != CPPTargetPlatform.Win64)
{
// Allow the compiler to generate SSE2 instructions.
Arguments.Append(" /arch:SSE2");
}
}
在Engine\Source\UE4Game.Target.cs下:
public override void SetupGlobalEnvironment(
TargetInfo Target,
ref LinkEnvironmentConfiguration OutLinkEnvironmentConfiguration,
ref CPPEnvironmentConfiguration OutCPPEnvironmentConfiguration
)
{
OutCPPEnvironmentConfiguration.bUseAVX = true;
}