So i have a simple bool function that reruns true if this build was a server build and flase otherwise here is the code :
bool UMyBlueprintFunctionLibrary::serverbuild(){
#if WITH_SERVER
return true;
#else
return false;
#endif
}
the problem is when i build a dev_server build and run the dedicated server -log , the function always return false !
here is also my buildtarget file :
using UnrealBuildTool;
using System.Collections.Generic;
public class MyProject2ServerTarget : TargetRules
{
public MyProject2ServerTarget(TargetInfo Target)
{
Type = TargetType.Server;
}
//
// TargetRules interface.
//
public override void SetupBinaries(
TargetInfo Target,
ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
ref List<string> OutExtraModuleNames
)
{
base.SetupBinaries(Target, ref OutBuildBinaryConfigurations, ref OutExtraModuleNames);
OutExtraModuleNames.Add("MyProject2");
}
public override void SetupGlobalEnvironment(
TargetInfo Target,
ref LinkEnvironmentConfiguration OutLinkEnvironmentConfiguration,
ref CPPEnvironmentConfiguration OutCPPEnvironmentConfiguration
)
{
if (UnrealBuildTool.UnrealBuildTool.IsEngineInstalled())
{
UEBuildConfiguration.bCompileLeanAndMeanUE = true;
// Don't need editor or editor only data
UEBuildConfiguration.bBuildEditor = false;
UEBuildConfiguration.bBuildWithEditorOnlyData = false;
UEBuildConfiguration.bCompileAgainstEngine = true;
// no exports, so no need to verify that a .lib and .exp file was emitted by the linker.
OutLinkEnvironmentConfiguration.bHasExports = false;
}
else
{
// Tag it as a UE4MyProject2 build
OutCPPEnvironmentConfiguration.Definitions.Add("UE4GAME=1");
}
}
public override bool GetSupportedPlatforms(ref List<UnrealTargetPlatform> OutPlatforms)
{
// It is valid for only server platforms
return UnrealBuildTool.UnrealBuildTool.GetAllServerPlatforms(ref OutPlatforms, false);
}
public override List<UnrealTargetPlatform> GUBP_GetPlatforms_MonolithicOnly(UnrealTargetPlatform HostPlatform)
{
if (HostPlatform == UnrealTargetPlatform.Mac)
{
return new List<UnrealTargetPlatform>();
}
return new List<UnrealTargetPlatform> { HostPlatform, UnrealTargetPlatform.Win32, UnrealTargetPlatform.Linux };
}
public override List<UnrealTargetConfiguration> GUBP_GetConfigs_MonolithicOnly(UnrealTargetPlatform HostPlatform, UnrealTargetPlatform Platform)
{
return new List<UnrealTargetConfiguration> { UnrealTargetConfiguration.Development };
}
}
Any help would be appreciated !