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:43:47 +02:00
parent e88533db1d
commit deb7778aed
61 changed files with 187 additions and 313 deletions
@@ -81,66 +81,17 @@ public class SenseGloveConnectImpl : 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 = "sgconnect";
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"));
#elif UE_5_0_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r21e"));
#else
Debug.Assert(false, "Developing for Android on UE versions older than 5.0 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);
}
@@ -209,21 +160,44 @@ public class SenseGloveConnectImpl : 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);
}
private void AddSerialLibrary(ReadOnlyTargetRules Target)
@@ -232,66 +206,17 @@ public class SenseGloveConnectImpl : 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 = "serial";
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"));
#elif UE_4_5_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r21e"));
#else
Debug.Assert(false, "Developing for Android on UE versions older than 5.0 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);
}
@@ -360,20 +285,43 @@ public class SenseGloveConnectImpl : 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);
}
}
@@ -80,66 +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"));
#elif UE_5_0_OR_LATER
LibraryPath = Path.GetFullPath(Path.Combine(LibraryPath, "r21e"));
#else
Debug.Assert(false, "Developing for Android on UE versions older than 5.0 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);
}
@@ -207,20 +158,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);
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.