revamp the ubt third-party dependency system
This commit is contained in:
@@ -34,9 +34,6 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class SenseGloveConnectImpl : ModuleRules
|
||||
@@ -57,6 +54,15 @@ public class SenseGloveConnectImpl : ModuleRules
|
||||
}
|
||||
);
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
"SGBleThirdPartyLibs",
|
||||
"SGConnectThirdPartyLibs",
|
||||
"SGSerialThirdPartyLibs",
|
||||
}
|
||||
);
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(
|
||||
new string[]
|
||||
{
|
||||
@@ -74,373 +80,7 @@ public class SenseGloveConnectImpl : ModuleRules
|
||||
}
|
||||
);
|
||||
|
||||
AddBleLibrary(Target);
|
||||
AddConnectLibrary(Target);
|
||||
AddSerialLibrary(Target);
|
||||
|
||||
PublicDefinitions.Add("SENSEGLOVE_BUILDING_CONNECT_IMPL_MODULE");
|
||||
PublicDefinitions.Add("SENSEGLOVE_UNREAL_ENGINE_PLUGIN");
|
||||
}
|
||||
|
||||
private void AddBleLibrary(ReadOnlyTargetRules Target)
|
||||
{
|
||||
string PluginRootDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", ".."));
|
||||
string SourceDirectory = Path.GetFullPath(Path.Combine(PluginRootDirectory, "Source"));
|
||||
string ThirdPartyDirectory = Path.GetFullPath(Path.Combine(SourceDirectory, "ThirdParty"));
|
||||
string LibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "lib"));
|
||||
string LibraryPathAnroidArm64 = "";
|
||||
string LibraryPathAnroidx64 = "";
|
||||
string LibraryName = "sgble";
|
||||
|
||||
bool bIsAndroid = Target.IsInPlatformGroup(UnrealPlatformGroup.Android);
|
||||
bool bIsLinux = Target.Platform == UnrealTargetPlatform.Linux;
|
||||
bool bIsLinuxArm64 = Target.Platform == UnrealTargetPlatform.LinuxArm64;
|
||||
bool bIsWin64 = Target.IsInPlatformGroup(UnrealPlatformGroup.Windows) &&
|
||||
Target.WindowsPlatform.Architecture == UnrealArch.X64;
|
||||
bool bIsDebugBuild = (Target.Configuration == UnrealTargetConfiguration.Debug);
|
||||
|
||||
if (bIsAndroid)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "android"));
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b"));
|
||||
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPath, "arm64"));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPath, "x64"));
|
||||
|
||||
LibraryName = string.Format("lib{0}.a", LibraryName);
|
||||
}
|
||||
else if (bIsLinux)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "rustc"));
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64"));
|
||||
|
||||
LibraryName = string.Format("lib{0}.a", LibraryName);
|
||||
}
|
||||
else if (bIsLinuxArm64)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "rustc"));
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64"));
|
||||
|
||||
LibraryName = string.Format("lib{0}.a", LibraryName);
|
||||
}
|
||||
else if (bIsWin64)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "win64"));
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "rustc"));
|
||||
|
||||
LibraryName = string.Format("{0}.lib", LibraryName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(false, "Unsupported platform!");
|
||||
}
|
||||
|
||||
string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include"));
|
||||
PrivateIncludePaths.Add(IncludePath);
|
||||
|
||||
if (bIsAndroid)
|
||||
{
|
||||
if (bIsDebugBuild)
|
||||
{
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "debug"));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "debug"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "release"));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "release"));
|
||||
}
|
||||
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, LibraryName));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, LibraryName));
|
||||
|
||||
PublicAdditionalLibraries.Add(LibraryPathAnroidArm64);
|
||||
PublicAdditionalLibraries.Add(LibraryPathAnroidx64);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bIsDebugBuild)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "debug"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "release"));
|
||||
}
|
||||
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, LibraryName));
|
||||
PublicAdditionalLibraries.Add(LibraryPath);
|
||||
}
|
||||
|
||||
if (bIsWin64)
|
||||
{
|
||||
PublicAdditionalLibraries.AddRange(new string[]
|
||||
{
|
||||
"bcrypt.lib",
|
||||
"ntdll.lib",
|
||||
"propsys.lib",
|
||||
"runtimeobject.lib",
|
||||
"userenv.lib",
|
||||
"ws2_32.lib"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void AddConnectLibrary(ReadOnlyTargetRules Target)
|
||||
{
|
||||
string PluginRootDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", ".."));
|
||||
string SourceDirectory = Path.GetFullPath(Path.Combine(PluginRootDirectory, "Source"));
|
||||
string ThirdPartyDirectory = Path.GetFullPath(Path.Combine(SourceDirectory, "ThirdParty"));
|
||||
string LibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "lib"));
|
||||
string LibraryPathAnroidArm64 = "";
|
||||
string LibraryPathAnroidx64 = "";
|
||||
string LibraryName = "sgconnect";
|
||||
|
||||
bool bIsAndroid = Target.IsInPlatformGroup(UnrealPlatformGroup.Android);
|
||||
bool bIsLinux = Target.Platform == UnrealTargetPlatform.Linux;
|
||||
bool bIsLinuxArm64 = Target.Platform == UnrealTargetPlatform.LinuxArm64;
|
||||
bool bIsWin64 = Target.IsInPlatformGroup(UnrealPlatformGroup.Windows) &&
|
||||
Target.WindowsPlatform.Architecture == UnrealArch.X64;
|
||||
bool bIsDebugBuild = (Target.Configuration == UnrealTargetConfiguration.Debug);
|
||||
|
||||
if (bIsAndroid)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "android"));
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b"));
|
||||
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPath, "arm64"));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPath, "x64"));
|
||||
|
||||
LibraryName = string.Format("lib{0}.a", LibraryName);
|
||||
}
|
||||
else if (bIsLinux)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
|
||||
LibraryName = string.Format("lib{0}.a", LibraryName);
|
||||
|
||||
#if UE_5_6_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v25"));
|
||||
#elif UE_5_5_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v23"));
|
||||
#elif UE_5_3_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22"));
|
||||
#elif UE_5_2_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21"));
|
||||
#else
|
||||
Debug.Assert(false, "Unsupported engine version or compiler!");
|
||||
#endif
|
||||
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64"));
|
||||
}
|
||||
else if (bIsLinuxArm64)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
|
||||
LibraryName = string.Format("lib{0}.a", LibraryName);
|
||||
|
||||
#if UE_5_6_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v25"));
|
||||
#elif UE_5_5_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v23"));
|
||||
#elif UE_5_3_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22"));
|
||||
#elif UE_5_2_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21"));
|
||||
#else
|
||||
Debug.Assert(false, "Unsupported engine version or compiler!");
|
||||
#endif
|
||||
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64"));
|
||||
}
|
||||
else if (bIsWin64)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "win64"));
|
||||
switch (Target.WindowsPlatform.Compiler)
|
||||
{
|
||||
case WindowsCompiler.VisualStudio2022:
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "msvc143"));
|
||||
break;
|
||||
#if ! UE_5_4_OR_LATER
|
||||
case WindowsCompiler.VisualStudio2019:
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "msvc142"));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
Debug.Assert(false, "Unsupported engine version or compiler!");
|
||||
break;
|
||||
}
|
||||
|
||||
LibraryName = string.Format("{0}.lib", LibraryName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(false, "Unsupported platform!");
|
||||
}
|
||||
|
||||
string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include"));
|
||||
PrivateIncludePaths.Add(IncludePath);
|
||||
|
||||
if (bIsAndroid)
|
||||
{
|
||||
if (bIsDebugBuild)
|
||||
{
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "debug"));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "debug"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "release"));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "release"));
|
||||
}
|
||||
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, LibraryName));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, LibraryName));
|
||||
|
||||
PublicAdditionalLibraries.Add(LibraryPathAnroidArm64);
|
||||
PublicAdditionalLibraries.Add(LibraryPathAnroidx64);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bIsDebugBuild)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "debug"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "release"));
|
||||
}
|
||||
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, LibraryName));
|
||||
PublicAdditionalLibraries.Add(LibraryPath);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddSerialLibrary(ReadOnlyTargetRules Target)
|
||||
{
|
||||
string PluginRootDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", ".."));
|
||||
string SourceDirectory = Path.GetFullPath(Path.Combine(PluginRootDirectory, "Source"));
|
||||
string ThirdPartyDirectory = Path.GetFullPath(Path.Combine(SourceDirectory, "ThirdParty"));
|
||||
string LibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "lib"));
|
||||
string LibraryPathAnroidArm64 = "";
|
||||
string LibraryPathAnroidx64 = "";
|
||||
string LibraryName = "serial";
|
||||
|
||||
bool bIsAndroid = Target.IsInPlatformGroup(UnrealPlatformGroup.Android);
|
||||
bool bIsLinux = Target.Platform == UnrealTargetPlatform.Linux;
|
||||
bool bIsLinuxArm64 = Target.Platform == UnrealTargetPlatform.LinuxArm64;
|
||||
bool bIsWin64 = Target.IsInPlatformGroup(UnrealPlatformGroup.Windows) &&
|
||||
Target.WindowsPlatform.Architecture == UnrealArch.X64;
|
||||
bool bIsDebugBuild = (Target.Configuration == UnrealTargetConfiguration.Debug);
|
||||
|
||||
if (bIsAndroid)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "android"));
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b"));
|
||||
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPath, "arm64"));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPath, "x64"));
|
||||
|
||||
LibraryName = string.Format("lib{0}.a", LibraryName);
|
||||
}
|
||||
else if (bIsLinux)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
|
||||
LibraryName = string.Format("lib{0}.a", LibraryName);
|
||||
|
||||
#if UE_5_6_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v25"));
|
||||
#elif UE_5_5_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v23"));
|
||||
#elif UE_5_3_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22"));
|
||||
#elif UE_5_2_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21"));
|
||||
#else
|
||||
Debug.Assert(false, "Unsupported engine version or compiler!");
|
||||
#endif
|
||||
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64"));
|
||||
}
|
||||
else if (bIsLinuxArm64)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux"));
|
||||
LibraryName = string.Format("lib{0}.a", LibraryName);
|
||||
|
||||
#if UE_5_6_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v25"));
|
||||
#elif UE_5_5_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v23"));
|
||||
#elif UE_5_3_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v22"));
|
||||
#elif UE_5_2_OR_LATER
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v21"));
|
||||
#else
|
||||
Debug.Assert(false, "Unsupported engine version or compiler!");
|
||||
#endif
|
||||
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64"));
|
||||
}
|
||||
else if (bIsWin64)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "win64"));
|
||||
switch (Target.WindowsPlatform.Compiler)
|
||||
{
|
||||
case WindowsCompiler.VisualStudio2022:
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "msvc143"));
|
||||
break;
|
||||
#if ! UE_5_4_OR_LATER
|
||||
case WindowsCompiler.VisualStudio2019:
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "msvc142"));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
Debug.Assert(false, "Unsupported engine version or compiler!");
|
||||
break;
|
||||
}
|
||||
|
||||
LibraryName = string.Format("{0}.lib", LibraryName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(false, "Unsupported platform!");
|
||||
}
|
||||
|
||||
string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include"));
|
||||
PrivateIncludePaths.Add(IncludePath);
|
||||
|
||||
if (bIsAndroid)
|
||||
{
|
||||
if (bIsDebugBuild)
|
||||
{
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "debug"));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "debug"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, "release"));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, "release"));
|
||||
}
|
||||
|
||||
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidArm64, LibraryName));
|
||||
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidx64, LibraryName));
|
||||
|
||||
PublicAdditionalLibraries.Add(LibraryPathAnroidArm64);
|
||||
PublicAdditionalLibraries.Add(LibraryPathAnroidx64);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bIsDebugBuild)
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "debug"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "release"));
|
||||
}
|
||||
|
||||
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, LibraryName));
|
||||
PublicAdditionalLibraries.Add(LibraryPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user