Improve target selection logic in MacPlatform.rebuild().

The old logic could produce inappropriate results, such as attempting to compile an x86 binary on ARM64, or compiling no binary when "64" is specified on a 32-bit machine. I'd argue that it makes sense to only check the flags when they're supported, and not to bother otherwise.
This commit is contained in:
player-03
2024-01-27 22:29:04 -05:00
committed by GitHub
parent f06c78e82a
commit f0bae5692e

View File

@@ -385,27 +385,27 @@ class MacPlatform extends PlatformTarget
{
var commands = [];
if (targetFlags.exists("hl") && System.hostArchitecture == X64)
switch (System.hostArchitecture)
{
// TODO: Support single binary
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64", "-Dhashlink"]);
}
else
{
if (!targetFlags.exists("32") && System.hostArchitecture == X64)
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64"]);
}
if (!targetFlags.exists("32") && System.hostArchitecture == ARM64)
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_ARM64"]);
}
if (!targetFlags.exists("64") && (targetFlags.exists("32") || System.hostArchitecture == X86))
{
case X64:
if (targetFlags.exists("hl"))
{
// TODO: Support single binary
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64", "-Dhashlink"]);
}
else if (!targetFlags.exists("32"))
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64"]);
}
else
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M32"]);
}
case X86:
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M32"]);
}
case ARM64:
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_ARM64"]);
default:
}
if (targetFlags.exists("hl"))