Hi,
I am compiling our project via RunUAT:
call %UE_5.3%/RunUAT.bat BuildCookRun -noP4 -utf8output -cook -project="%cd%/ProjectName.uproject" -platform=Win64 -stage -archive -package -build -pak -iostore -compressed -prereqs -archivedirectory="%cd%/PackagedBuilds/EGSWindows" -clientconfig=Shipping -nodebuginfo -target=ProjectNameEGS
I am specifying a custom target that points to a custom Target.cs file for Epic Game Store that looks like this:
public class MyGameEGSTarget : TargetRules
{
public MyGameEGSTarget( TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.AddRange(new string[] { "MyGame" });
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
CustomConfig = "EGS";
ProjectDefinitions.Add("PLATFORM_EGS=1");
}
}
I am using the precompiler check like this in C++:
#if PLATFORM_EGS
LoginEGS(Identity, UserIndex);
#elif PLATFORM_STEAM
LoginSteam(Identity, UserIndex);
#endif
Still, when compiling the target, RunUAT shows the following error:
[171/932] Compile [x64] CreateSessionRequest.cpp
...\Private\Services\CreateSessionRequest.cpp(27): error C4668: 'PLATFORM_EGS' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
...\Private\Services\CreateSessionRequest.cpp(29): error C4668: 'PLATFORM_STEAM' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
Why is this happening?
I noticed that the output log shows that among other targets, the following is being built: -Target="MyGameEditor Win64 Development
Does this mean that effectively the precompiler settings from the MyGameEditor.target.cs are being used? Adding the PLATFORM_EOS=1 flag in MyGameEditor.target.cs fixes the error, but that is not what I want, since I need different targets defined per the CLI in order to build for all platforms.
Or am I building two targets (Editor and EGS)? If yes, is there a way to remove the Editor target from the build?
Thanks in advance