revamp the ubt third-party dependency system

This commit is contained in:
Mamadou Babaei
2025-06-04 01:38:13 +02:00
parent eb610208b9
commit c6cb20dac1
10 changed files with 144 additions and 610 deletions
+1
View File
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Replaced Epic Native Toolchain `v24` support with Epic Native Toolchain `v25` due to the fact that now `v25` is the default Linux toolchain for UE `5.6`.
- Revamped `FSGHMDTracker` to resolve a critical deadlock between the rendering and game threads in Unreal Engine `5.6` that occurrs when `IHeadMountedDisplay::GetHMDMonitorInfo()` is invoked from `FSGXRTracker::GetControllerTransform()`. This is similar to another [critical deadlock issue (UE-212224), occurring during PipelinedFrameState acquisition, addressed in the `v2.5.0` release](#250---2025-05-09).
- Revamped the UBT logic for importing third-party headers and libraries by introducing third-party dependency modules, `SGBleThirdPartyLibs`, `SGConnectThirdPartyHeaders`, `SGConnectThirdPartyLibs`, `SGCoreThirdPartyLibs`, and `SGSerialThirdPartyLibs`, which significantly reduces UBT boilerplate code and increases maintainability.
- Bumped the SenseGlove libraries to `v2.203.0-f3d3e676`.
- SenseGlove libraries have migrated to `C++20` from `C++17`.
- Revamped the `SGLog` logging utility class to use `TUniquePtr` instead of `std::unique_ptr`.
+105 -95
View File
@@ -81,99 +81,109 @@
│ │
│ └── serial
── lib (platform-specific pre-built binary dependencies)
├── android
│ │
│ └── r25b (Android NDK r25b dependencies for UE 5.1+)
│ │
│ ├── arm64 (64-bit ARM variant of Android)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ └── x64 (64-bit x86-64 variant of Android)
│ │
│ ├── debug
│ │
│ └── release
├── linux
│ │
│ ├── rustc (GNU/Linux binary dependencies built with Rust)
│ │ │
│ │ ├── aarch64 (dependencies targeting GNU/Linux AArch64 architecture)
│ │ │ │
│ │ │ ├── debug
│ │ │ │
│ │ │ └── release
│ │ │
│ │ └── x86-64 (dependencies targeting GNU/Linux x86-64 architecture)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ ├── v22 (UE 5.3 and 5.4 GNU/Linux dependencies)
│ │ │
│ │ ├── aarch64 (dependencies targeting GNU/Linux AArch64 architecture)
│ │ │ │
│ │ │ ├── debug
│ │ │ │
│ │ │ └── release
│ │ │
│ │ └── x86-64 (dependencies targeting GNU/Linux x86-64 architecture)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ ├── v23 (UE 5.5 GNU/Linux dependencies)
│ │ │
│ │ ├── aarch64 (dependencies targeting GNU/Linux AArch64 architecture)
│ │ │ │
│ │ │ ├── debug
│ │ │ │
│ │ │ └── release
│ │ │
│ │ └── x86-64 (dependencies targeting GNU/Linux x86-64 architecture)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ └── v25 (UE 5.6 GNU/Linux dependencies)
│ │
│ ├── aarch64 (dependencies targeting GNU/Linux AArch64 architecture)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ └── x86-64 (dependencies targeting GNU/Linux x86-64 architecture)
│ │
│ ├── debug
│ │
│ └── release
└── win64
├── msvc142 (Microsoft Visual Studio 2019 dependencies)
│ │
│ ├── debug
│ │
│ └── release
├── msvc143 (Microsoft Visual Studio 2022 dependencies)
│ │
│ ├── debug
│ │
│ └── release
└── rustc (Microsoft Windows binary dependencies built with Rust)
├── debug
└── release
── lib (platform-specific pre-built binary dependencies)
├── android
│ │
│ └── r25b (Android NDK r25b dependencies for UE 5.1+)
│ │
│ ├── arm64 (64-bit ARM variant of Android)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ └── x64 (64-bit x86-64 variant of Android)
│ │
│ ├── debug
│ │
│ └── release
├── linux
│ │
│ ├── rustc (GNU/Linux binary dependencies built with Rust)
│ │ │
│ │ ├── aarch64 (dependencies targeting GNU/Linux AArch64 architecture)
│ │ │ │
│ │ │ ├── debug
│ │ │ │
│ │ │ └── release
│ │ │
│ │ └── x86-64 (dependencies targeting GNU/Linux x86-64 architecture)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ ├── v22 (UE 5.3 and 5.4 GNU/Linux dependencies)
│ │ │
│ │ ├── aarch64 (dependencies targeting GNU/Linux AArch64 architecture)
│ │ │ │
│ │ │ ├── debug
│ │ │ │
│ │ │ └── release
│ │ │
│ │ └── x86-64 (dependencies targeting GNU/Linux x86-64 architecture)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ ├── v23 (UE 5.5 GNU/Linux dependencies)
│ │ │
│ │ ├── aarch64 (dependencies targeting GNU/Linux AArch64 architecture)
│ │ │ │
│ │ │ ├── debug
│ │ │ │
│ │ │ └── release
│ │ │
│ │ └── x86-64 (dependencies targeting GNU/Linux x86-64 architecture)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ └── v25 (UE 5.6 GNU/Linux dependencies)
│ │
│ ├── aarch64 (dependencies targeting GNU/Linux AArch64 architecture)
│ │ │
│ │ ├── debug
│ │ │
│ │ └── release
│ │
│ └── x86-64 (dependencies targeting GNU/Linux x86-64 architecture)
│ │
│ ├── debug
│ │
│ └── release
└── win64
├── msvc142 (Microsoft Visual Studio 2019 dependencies)
│ │
│ ├── debug
│ │
│ └── release
├── msvc143 (Microsoft Visual Studio 2022 dependencies)
│ │
│ ├── debug
│ │
│ └── release
└── rustc (Microsoft Windows binary dependencies built with Rust)
├── debug
└── release
├── SGBleThirdPartyLibs (Third-party module providing SGBLE headers and libraries)
├── SGConnectThirdPartyHeaders (Third-party module providing SGConnect headers)
├── SGConnectThirdPartyLibs (Third-party module providing SGConnect headers and libraries)
├── SGCoreThirdPartyLibs (Third-party module providing SGCore headers and libraries)
└── SGSerialThirdPartyLibs (Third-party module providing github.com/wjwwood/serial headers and libraries)
```
@@ -34,7 +34,6 @@
using System;
using System.IO;
using UnrealBuildTool;
public class SenseGloveBuildHacks : ModuleRules
@@ -55,23 +54,18 @@ public class SenseGloveBuildHacks : ModuleRules
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"SGConnectThirdPartyHeaders",
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"SenseGloveLog",
}
);
AddConnectHeaders();
}
private void AddConnectHeaders()
{
string PluginRootDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", ".."));
string SourceDirectory = Path.GetFullPath(Path.Combine(PluginRootDirectory, "Source"));
string ThirdPartyDirectory = Path.GetFullPath(Path.Combine(SourceDirectory, "ThirdParty"));
string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include"));
PrivateIncludePaths.Add(IncludePath);
}
}
@@ -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);
}
}
}
@@ -34,9 +34,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using UnrealBuildTool;
public class SenseGloveCoreImpl : ModuleRules
@@ -57,6 +54,13 @@ public class SenseGloveCoreImpl : ModuleRules
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"SGCoreThirdPartyLibs",
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
@@ -74,137 +78,7 @@ public class SenseGloveCoreImpl : ModuleRules
}
);
AddCoreLibrary(Target);
PublicDefinitions.Add("SENSEGLOVE_BUILDING_CORE_IMPL_MODULE");
PublicDefinitions.Add("SENSEGLOVE_UNREAL_ENGINE_PLUGIN");
}
private void AddCoreLibrary(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 = "sgcore";
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);
}
}
}
Binary file not shown.
Binary file not shown.