Files
Brandyn / Techy fcc1b09210 init
2026-04-04 15:40:51 -05:00

117 lines
3.5 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System.IO;
using System.Collections.Generic;
using System.Security.Cryptography;
using UnrealBuildTool;
public class TextureFormatOodle : ModuleRules
{
protected string DynamicLibNamePrefix;
protected string DynamicLibNameSuffix;
protected void SetDynamicLibNameStrings()
{
if (Target.IsInPlatformGroup(UnrealPlatformGroup.Windows))
{
DynamicLibNamePrefix = (Target.Architecture == UnrealArch.Arm64) ? "oo2tex_9_winuwparm64_" : "oo2tex_win64_";
DynamicLibNameSuffix = ".dll";
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
DynamicLibNamePrefix = "liboo2texmac64.";
DynamicLibNameSuffix = ".dylib";
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
DynamicLibNamePrefix = "liboo2texlinux64.";
DynamicLibNameSuffix = ".so";
}
else if (Target.Platform == UnrealTargetPlatform.LinuxArm64)
{
DynamicLibNamePrefix = "liboo2texlinuxarm64.";
DynamicLibNameSuffix = ".so";
}
else
{
throw new BuildException("Platform {0} not supported in TextureFormatOodle.", Target.Platform);
}
PublicDefinitions.Add("TFO_DLL_PREFIX=\"" + DynamicLibNamePrefix + "\"");
PublicDefinitions.Add("TFO_DLL_SUFFIX=\"" + DynamicLibNameSuffix + "\"");
}
protected void AddDynamicLibsForVersion(string Version)
{
string PlatformDir = Target.Platform.ToString();
if (Target.IsInPlatformGroup(UnrealPlatformGroup.Windows))
{
PlatformDir = (Target.Architecture == UnrealArch.Arm64) ? "WinArm64" : "Win64";
}
string DynamicLibName = DynamicLibNamePrefix + Version + DynamicLibNameSuffix;
string SdkBase = Path.Combine(ModuleDirectory, "..", "Sdks", Version);
string FullDynamicLibName = Path.Combine(SdkBase, "redist", PlatformDir, DynamicLibName);
if (!File.Exists(FullDynamicLibName))
{
throw new BuildException("Platform {0} can't find dynamic lib for TextureFormatOodle {1}.", Target.Platform, FullDynamicLibName);
}
FullDynamicLibName = "$(EngineDir)/" + UnrealBuildTool.Utils.MakePathRelativeTo(FullDynamicLibName, EngineDirectory);
RuntimeDependencies.Add(Path.Combine("$(TargetOutputDir)", DynamicLibName), FullDynamicLibName, StagedFileType.NonUFS);
}
public TextureFormatOodle(ReadOnlyTargetRules Target) : base(Target)
{
IWYUSupport = IWYUSupport.None;
ShortName = "TextureFormatOodle";
PrivateIncludePathModuleNames.AddRange(new string[]
{
"CoreUObject",
"Engine",
"TargetPlatform",
"TextureCompressor",
});
PrivateDependencyModuleNames.AddRange(new string[]
{
"Core",
"DerivedDataCache", // for FCacheBucket
"ImageCore",
"TextureBuild",
});
SetDynamicLibNameStrings();
// dynamic libs , for every version, not just current :
bool bIsWinArm64 = Target.IsInPlatformGroup(UnrealPlatformGroup.Windows) && (Target.Architecture == UnrealArch.Arm64); // earlier versions of the DLL are not available on Windows Arm64
if (!bIsWinArm64)
{
AddDynamicLibsForVersion("2.9.5");
AddDynamicLibsForVersion("2.9.6");
AddDynamicLibsForVersion("2.9.7");
AddDynamicLibsForVersion("2.9.8");
AddDynamicLibsForVersion("2.9.9");
AddDynamicLibsForVersion("2.9.10");
AddDynamicLibsForVersion("2.9.11");
AddDynamicLibsForVersion("2.9.12");
AddDynamicLibsForVersion("2.9.13");
}
AddDynamicLibsForVersion("2.9.14");
string LatestOodleVersion = "2.9.14";
string IncludeDirectory = Path.Combine(ModuleDirectory, "..", "Sdks", LatestOodleVersion, "include");
PrivateIncludePaths.Add(IncludeDirectory);
PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private", "Jobify"));
}
}