fix: asking CppCompileEnvironment for a single Architecture, but it has multiple Architectures (arm64, x64)

This commit is contained in:
Mamadou Babaei
2024-05-15 04:31:14 +02:00
parent e49989543a
commit b04a61c1b6
61 changed files with 188 additions and 308 deletions
@@ -80,64 +80,17 @@ public class SenseGloveCoreImpl : ModuleRules
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";
if (Target.Platform == UnrealTargetPlatform.Android)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "android"));
#if UE_5_1_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r25b"));
#else
Debug.Assert(false, "Developing for Android on UE versions older than 5.1 is not supported!");
#endif
#if UE_5_2_OR_LATER
if (Target.Architecture == UnrealArch.Arm64)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "arm64"));
}
else if (Target.Architecture == UnrealArch.X64)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x64"));
}
else
{
Debug.Assert(false, "Unsupported Android architecture!");
}
#else
IAndroidToolChain ToolChain = AndroidExports.CreateToolChain(Target.ProjectFile);
List<string> Architectures = ToolChain.GetAllArchitectures();
foreach (string Arch in Architectures)
{
if (Arch == "-arm64")
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "arm64"));
break;
}
else if (Arch == "-armv7")
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "armv7"));
break;
}
else if (Arch == "-x64")
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x64"));
break;
}
else if (Arch == "-86")
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "x86"));
break;
}
else
{
Debug.Assert(false, "Unsupported Android architecture!");
break;
}
}
#endif
LibraryPathAnroidArm64 = Path.GetFullPath(Path.Combine(LibraryPath, "arm64"));
LibraryPathAnroidx64 = Path.GetFullPath(Path.Combine(LibraryPath, "x64"));
LibraryName = string.Format("lib{0}.a", LibraryName);
}
@@ -195,20 +148,43 @@ public class SenseGloveCoreImpl : ModuleRules
Debug.Assert(false, "Unsupported platform!");
}
string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include"));
PrivateIncludePaths.Add(IncludePath);
bool bDebug = (Target.Configuration == UnrealTargetConfiguration.Debug);
if (bDebug)
if (Target.Platform == UnrealTargetPlatform.Android)
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "debug"));
if (bDebug)
{
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
{
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "release"));
if (bDebug)
{
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);
}
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, LibraryName));
string IncludePath = Path.GetFullPath(Path.Combine(ThirdPartyDirectory, "include"));
PrivateIncludePaths.Add(IncludePath);
PublicAdditionalLibraries.Add(LibraryPath);
}
}