You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UE-169401 #preflight 636ac031f56cab38c73d4d04 #review @michael.atchison @rob.cannaday @chris.varnsverry @sam.zamani [CL 23042874 by eric day in ue5-main branch]
207 lines
5.7 KiB
C#
207 lines
5.7 KiB
C#
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using UnrealBuildTool;
|
|
using EpicGames.Core;
|
|
|
|
public class EOSSDK : ModuleRules
|
|
{
|
|
public virtual string SDKBaseDir
|
|
{
|
|
get
|
|
{
|
|
// Overridden by platform extensions to point at the PE module directory
|
|
return Path.Combine(ModuleDirectory, "SDK");
|
|
}
|
|
}
|
|
|
|
public virtual string SDKIncludesDir
|
|
{
|
|
get
|
|
{
|
|
if (Target.Platform == UnrealTargetPlatform.Android)
|
|
{
|
|
return Path.Combine(SDKBinariesDir, "include");
|
|
}
|
|
else if(Target.Platform == UnrealTargetPlatform.IOS)
|
|
{
|
|
return Path.Combine(SDKBinariesDir, "EOSSDK.framework", "Headers");
|
|
}
|
|
return Path.Combine(SDKBaseDir, "Include");
|
|
}
|
|
}
|
|
|
|
public virtual string SDKLibsDir
|
|
{
|
|
get
|
|
{
|
|
return Path.Combine(SDKBaseDir, "Lib");
|
|
}
|
|
}
|
|
|
|
public virtual string SDKBinariesDir
|
|
{
|
|
get
|
|
{
|
|
if (Target.Platform == UnrealTargetPlatform.IOS)
|
|
{
|
|
return Path.Combine(SDKBaseDir, "Bin", "IOS");
|
|
}
|
|
else if (Target.Platform == UnrealTargetPlatform.Android)
|
|
{
|
|
return Path.Combine(SDKBaseDir, "Bin", "Android");
|
|
}
|
|
return Path.Combine(SDKBaseDir, "Bin");
|
|
}
|
|
}
|
|
|
|
public virtual string EngineBinariesDir
|
|
{
|
|
get
|
|
{
|
|
return Path.Combine(EngineDirectory, "Binaries", Target.Platform.ToString());
|
|
}
|
|
}
|
|
|
|
public virtual string LibraryLinkNameBase
|
|
{
|
|
get
|
|
{
|
|
if(Target.Platform == UnrealTargetPlatform.Android)
|
|
{
|
|
return "EOSSDK";
|
|
}
|
|
|
|
return String.Format("EOSSDK-{0}-Shipping", Target.Platform.ToString());
|
|
}
|
|
}
|
|
|
|
public virtual string LibraryLinkName
|
|
{
|
|
get
|
|
{
|
|
if (Target.Platform == UnrealTargetPlatform.Mac)
|
|
{
|
|
return Path.Combine(SDKBinariesDir, "lib" + LibraryLinkNameBase + ".dylib");
|
|
}
|
|
else if(Target.Platform == UnrealTargetPlatform.Linux ||
|
|
Target.Platform == UnrealTargetPlatform.LinuxArm64)
|
|
{
|
|
return Path.Combine(SDKBinariesDir, "lib" + LibraryLinkNameBase + ".so");
|
|
}
|
|
else if (Target.Platform.IsInGroup(UnrealPlatformGroup.Microsoft))
|
|
{
|
|
return Path.Combine(SDKLibsDir, LibraryLinkNameBase + ".lib");
|
|
}
|
|
// Android has one .so per architecture, so just deal with that below.
|
|
// Other platforms will override this property.
|
|
|
|
throw new BuildException("Unsupported platform");
|
|
}
|
|
}
|
|
|
|
public virtual string RuntimeLibraryFileName
|
|
{
|
|
get
|
|
{
|
|
if (Target.Platform == UnrealTargetPlatform.Mac)
|
|
{
|
|
return "lib" + LibraryLinkNameBase + ".dylib";
|
|
}
|
|
else if (Target.Platform == UnrealTargetPlatform.IOS)
|
|
{
|
|
return LibraryLinkNameBase + ".framework";
|
|
}
|
|
else if (Target.Platform == UnrealTargetPlatform.Android ||
|
|
Target.Platform == UnrealTargetPlatform.Linux ||
|
|
Target.Platform == UnrealTargetPlatform.LinuxArm64)
|
|
{
|
|
return "lib" + LibraryLinkNameBase + ".so";
|
|
}
|
|
else if (Target.Platform.IsInGroup(UnrealPlatformGroup.Microsoft))
|
|
{
|
|
return LibraryLinkNameBase + ".dll";
|
|
}
|
|
// Other platforms will override this property.
|
|
|
|
throw new BuildException("Unsupported platform");
|
|
}
|
|
}
|
|
|
|
public virtual bool bRequiresRuntimeLoad
|
|
{
|
|
get
|
|
{
|
|
return Target.Platform.IsInGroup(UnrealPlatformGroup.Windows) || Target.Platform == UnrealTargetPlatform.Mac;
|
|
// Other platforms may override this property.
|
|
}
|
|
}
|
|
|
|
public EOSSDK(ReadOnlyTargetRules Target) : base(Target)
|
|
{
|
|
Type = ModuleType.External;
|
|
|
|
bool bUseProjectBinary = Target.LinkType == TargetLinkType.Monolithic && Target.GlobalDefinitions.Contains("EOSSDK_USE_PROJECT_BINARY=1");
|
|
|
|
if (!bUseProjectBinary && Target.Platform == UnrealTargetPlatform.LinuxArm64)
|
|
{
|
|
// Not supported yet for non-project binaries.
|
|
PublicDefinitions.Add("WITH_EOS_SDK=0");
|
|
return;
|
|
}
|
|
|
|
PublicDefinitions.Add("WITH_EOS_SDK=1");
|
|
PublicSystemIncludePaths.Add(SDKIncludesDir);
|
|
|
|
PublicDefinitions.Add(String.Format("EOSSDK_RUNTIME_LOAD_REQUIRED={0}", bRequiresRuntimeLoad ? 1 : 0));
|
|
PublicDefinitions.Add(String.Format("EOSSDK_RUNTIME_LIBRARY_NAME=\"{0}\"", RuntimeLibraryFileName));
|
|
|
|
if (Target.Platform == UnrealTargetPlatform.Android)
|
|
{
|
|
PublicSystemIncludePaths.Add(Path.Combine(SDKIncludesDir, "Android"));
|
|
|
|
if (!bUseProjectBinary)
|
|
{
|
|
PublicAdditionalLibraries.Add(Path.Combine(SDKBinariesDir, "static-stdc++", "libs", "armeabi-v7a", RuntimeLibraryFileName));
|
|
PublicAdditionalLibraries.Add(Path.Combine(SDKBinariesDir, "static-stdc++", "libs", "arm64-v8a", RuntimeLibraryFileName));
|
|
|
|
string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath);
|
|
AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(PluginPath, "EOSSDK_UPL.xml"));
|
|
}
|
|
}
|
|
else if (Target.Platform == UnrealTargetPlatform.IOS)
|
|
{
|
|
if (!bUseProjectBinary)
|
|
{
|
|
PublicAdditionalFrameworks.Add(new Framework("EOSSDK", SDKBinariesDir, "", true));
|
|
}
|
|
}
|
|
else if (Target.Platform == UnrealTargetPlatform.Mac)
|
|
{
|
|
string DylibPath = Path.Combine(Target.UEThirdPartyBinariesDirectory, "EOSSDK", "Mac", RuntimeLibraryFileName);
|
|
PublicDelayLoadDLLs.Add(DylibPath);
|
|
RuntimeDependencies.Add(DylibPath);
|
|
}
|
|
else
|
|
{
|
|
// Allow projects to provide their own EOSSDK binaries. We will still compile against our own headers, because EOSSDK makes guarantees about forward compat. Note this global definition is only valid for monolithic targets.
|
|
if(!bUseProjectBinary)
|
|
{
|
|
PublicAdditionalLibraries.Add(Path.Combine(SDKBinariesDir, LibraryLinkName));
|
|
RuntimeDependencies.Add(Path.Combine(EngineBinariesDir, RuntimeLibraryFileName), Path.Combine(SDKBinariesDir, RuntimeLibraryFileName));
|
|
|
|
// needed for linux to find the .so
|
|
PublicRuntimeLibraryPaths.Add(EngineBinariesDir);
|
|
|
|
if (bRequiresRuntimeLoad)
|
|
{
|
|
PublicDelayLoadDLLs.Add(RuntimeLibraryFileName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|