184 lines
6.9 KiB
C#
184 lines
6.9 KiB
C#
/**
|
|
* @file
|
|
*
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @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 SGCoreThirdPartyLibs : ModuleRules
|
|
{
|
|
public SGCoreThirdPartyLibs(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 = "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"));
|
|
|
|
#if UE_5_6_OR_LATER
|
|
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r27c"));
|
|
#elif UE_5_5_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"));
|
|
|
|
#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 (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);
|
|
}
|
|
}
|
|
} |