/** * @file * * @author Mamadou Babaei * * @section LICENSE * * (The MIT License) * * Copyright (c) 2020 - 2026 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 SGFakeShmThirdPartyLibs : ModuleRules { public SGFakeShmThirdPartyLibs(ReadOnlyTargetRules Target) : base(Target) { Type = ModuleType.External; string ThirdPartyDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..")); string LibraryPath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "lib")); string LibraryName = "sgfakeshm"; 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 (bIsLinux) { LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "linux")); #if UE_5_7_OR_LATER LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v26")); #elif 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")); #else Debug.Assert(false, "Unsupported engine version or compiler!"); #endif 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")); #if UE_5_7_OR_LATER LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v26")); #elif 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")); #else Debug.Assert(false, "Unsupported engine version or compiler!"); #endif LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "aarch64")); LibraryName = string.Format("lib{0}.a", LibraryName); } else if (bIsWin64) { LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "windows")); Version compilerVersion = Version.Parse(Target.WindowsPlatform.CompilerVersion.ToString()); string toolsetVersion = $"{compilerVersion.Major}.{compilerVersion.Minor:D2}"; if (toolsetVersion == "14.50") { LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v145-1450")); } else if (toolsetVersion == "14.44") { LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v143-1444")); } else if (toolsetVersion == "14.38") { LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "v143-1438")); } else { Debug.Assert(false, "Unsupported MSVC toolset!"); } 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 (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); } }