c++visual-studio-2017unreal-engine4avxvisual-studio-2017-build-tools

How to enable /arch:AVX for Unreal Engine 4?


I am trying to setup AVX support for Unreal Engine 4. It is using SSE2 by default as far as I know and it's own NMake so there are no Visual Studio properties page to access and add arch to.

Where am I supposed to set this up?

NOTE: Trying to support AVX, AVX2 and AVX512.


Solution

  • Look for the VSToolChain.cs file in the UE4 source code. That file is setting up all the compiler flags for MSVC.

    In there, search for where it's doing /arch:AVX. It's in some if(). To force usage of AVX or AVX2 or AVX512, just put /arch:AVX or /arch:AVX2 or /arch:AVX512 at the top of that function so that the flag always gets added. Then recompile the engine.