/** * @file * * @author Mamadou Babaei * * @section LICENSE * * (The MIT License) * * Copyright (c) 2020 - 2025 SenseGlove * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * @section DESCRIPTION * * */ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using UnrealBuildTool; public class SGBleThirdPartyLibs : ModuleRules { public SGBleThirdPartyLibs(ReadOnlyTargetRules Target) : base(Target) { Type = ModuleType.External; string ThirdPartyDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..")); string LibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "lib")); string LibraryPathAnroidAArch64 = ""; 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")); #if UE_5_6_OR_LATER LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r27c")); #elif UE_5_4_OR_LATER LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b")); #else Debug.Assert(false, "Unsupported engine version or compiler!"); #endif LibraryPathAnroidAArch64 = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64")); LibraryPathAnroidX64 = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64")); 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, "windows")); LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "rustc")); LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86-64")); 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) { LibraryPathAnroidAArch64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidAArch64, "debug")); LibraryPathAnroidX64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidX64, "debug")); } else { LibraryPathAnroidAArch64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidAArch64, "release")); LibraryPathAnroidX64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidX64, "release")); } LibraryPathAnroidAArch64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidAArch64, LibraryName)); LibraryPathAnroidX64 = Path.GetFullPath(Path.Combine(LibraryPathAnroidX64, LibraryName)); PublicAdditionalLibraries.Add(LibraryPathAnroidAArch64); 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" }); } } }