Download

How can i define my own BUILD mode?

Hi there,

I would like to know how can i create custom build configurations. For example, we can include specific codes in Shipping build if we wrap them like this:


 #if UE_BUILD_SHIPPING
     //do stuff
 #endif

Just like that, i want some features in my game to only appear on demo build. So i would like to do something like this:


 #if GAME_BUILD_DEMO
     //do stuff
 #endif

After digging through source i think i have to modify the Build.h file and UEBuildPlatform.cs (under switch (CheckConfig) block ). Is this the right way?

Quick Bump

One more bump…

Hi Ryanjon,

You can create additional Target.cs files, and in them, override SetupGlobalEnvironment and add something like:


OutCPPEnvironmentConfiguration.Definitions.Add("SOME_DEFINE=SOME_VALUE");

As long as you are careful to not use the define in a header that is consumed by other modules (these defines are only set internally when compiling this module, and won’t be defined when compiling other modules that consume headers from it), you can also add stuff in a particular module Build.cs:



Definitions.Add("SOME_DEFINE=SOME_VALUE");

Cheers,
Michael Noland