Files
josh adams 1610c3bee3 UnrealArch/UnrealArchitectures changes
- Creates the UnrealArchitectures class, which wraps a list of UnrealArch objects
 - UnrealArch is a single architecture, expandable enum-like struct
 - There is no more concept of "no/default architecture", there is always a valid active architecture when building
 - Most uses of "string Architecture" are replaced with one of the two above, depending if multiple architectures are supported or not
 - UnrealArch has some platform-extensions for platform-specific naming (like Linux adds in LinuxName that turns, for instance, Arm64 -> aarch64-unknown-linux-gnueabi, which is used in folder names, etc)
 - UnrealArch has bIsX64 which can be used determine intel instruction set (as opposed to arm)
 - TargetRules class has an "Architecture" accessor that will return a single architecture if the active architectures is a single architecture, or throw an exception if multiple. This is useful in a majority of the cases where a paltform can only have a single architecture active in TargetRules (microsoft platforms, for instance, will create separate targets when compiling multiple architectures at once)
 - Added UnrealArchitectureConfig class, which contains all the architecture information for a platform (what architectures are supported, what ones are currently active for given project, etc)

#preflight 63c81fb5b065224750a1759e
#rb mike.fricker,roman.dzieciol,joe.kirchoff,dmytro.vovk,brandon.schaefer [various parts]
#p4v-preflight-copy 23562471

[CL 23829977 by josh adams in ue5-main branch]
2023-01-24 09:30:28 -05:00

103 lines
3.5 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.IO;
public class libWebSockets : ModuleRules
{
protected virtual bool Supported
{
get
{
return
Target.Platform == UnrealTargetPlatform.Android ||
Target.Platform == UnrealTargetPlatform.IOS ||
Target.Platform == UnrealTargetPlatform.Mac ||
Target.IsInPlatformGroup(UnrealPlatformGroup.Unix) ||
Target.Platform == UnrealTargetPlatform.Win64;
}
}
protected virtual string LibRootDirectory { get { return ModuleDirectory; } }
protected virtual string WebSocketsVersion { get { return "libwebsockets"; } }
protected virtual string WebSocketsPackagePath { get { return Path.Combine(LibRootDirectory, WebSocketsVersion); } }
protected virtual string ConfigName { get { return (Target.Configuration == UnrealTargetConfiguration.Debug && Target.bDebugBuildsActuallyUseDebugCRT) ? "Debug" : "Release"; } }
protected virtual bool bRequireOpenSSL { get { return true; } }
protected virtual string DefaultLibraryName { get { return "libwebsockets.a"; } }
protected virtual string IncludeDirectory
{
get
{
if (Target.Platform == UnrealTargetPlatform.Win64)
{
return Path.Combine(WebSocketsPackagePath, "include", Target.Platform.ToString(), "VS" + Target.WindowsPlatform.GetVisualStudioCompilerVersionName());
}
else if (Target.IsInPlatformGroup(UnrealPlatformGroup.Unix))
{
return Path.Combine(WebSocketsPackagePath, "include", "Unix", Target.Architecture.LinuxName);
}
else
{
return Path.Combine(WebSocketsPackagePath, "include", Target.Platform.ToString());
}
}
}
protected virtual string LibraryDirectory
{
get
{
if (Target.Platform == UnrealTargetPlatform.Win64)
{
return Path.Combine(WebSocketsPackagePath, "lib", Target.Platform.ToString(), "VS" + Target.WindowsPlatform.GetVisualStudioCompilerVersionName(), ConfigName);
}
else if (Target.IsInPlatformGroup(UnrealPlatformGroup.Unix))
{
return Path.Combine(WebSocketsPackagePath, "lib", "Unix", Target.Architecture.LinuxName, ConfigName);
}
else
{
return Path.Combine(WebSocketsPackagePath, "lib", Target.Platform.ToString(), ConfigName);
}
}
}
public libWebSockets(ReadOnlyTargetRules Target) : base(Target)
{
Type = ModuleType.External;
if (!Supported)
{
return;
}
if (Target.Platform == UnrealTargetPlatform.Win64)
{
PublicSystemIncludePaths.Add(IncludeDirectory);
PublicAdditionalLibraries.Add(Path.Combine(WebSocketsPackagePath, "lib", Target.Platform.ToString(), "VS" + Target.WindowsPlatform.GetVisualStudioCompilerVersionName(), ConfigName, "websockets_static.lib"));
}
else if (Target.Platform == UnrealTargetPlatform.Android)
{
PublicSystemIncludePaths.Add(Path.Combine(WebSocketsPackagePath, "include", Target.Platform.ToString(), "ARM64"));
PublicSystemIncludePaths.Add(Path.Combine(WebSocketsPackagePath, "include", Target.Platform.ToString(), "x64"));
PublicSystemIncludePaths.Add(Path.Combine(WebSocketsPackagePath, "include", Target.Platform.ToString()));
PublicAdditionalLibraries.Add(Path.Combine(WebSocketsPackagePath, "lib", Target.Platform.ToString(), "ARM64", ConfigName, "libwebsockets.a"));
PublicAdditionalLibraries.Add(Path.Combine(WebSocketsPackagePath, "lib", Target.Platform.ToString(), "x64", ConfigName, "libwebsockets.a"));
}
else
{
PublicSystemIncludePaths.Add(IncludeDirectory);
PublicAdditionalLibraries.Add(Path.Combine(LibraryDirectory, DefaultLibraryName));
}
if (bRequireOpenSSL)
{
PublicDependencyModuleNames.Add("OpenSSL");
}
}
}