From b866632a6f9df0ed238c9d4c062b65ebc6ea69ad Mon Sep 17 00:00:00 2001 From: Josh Tynjala Date: Fri, 19 Jul 2024 14:46:44 -0700 Subject: [PATCH] tools: allow -x86_64 and -x86_32 as command line flags to select those architectures instead of defaults (closes #1819) Still supports -32 and -64, though, for backwards compatibility. We could consider removing those in Lime 9. --- src/lime/tools/IOSHelper.hx | 2 +- tools/CommandLineTools.hx | 10 +++++----- tools/platforms/LinuxPlatform.hx | 6 +++--- tools/platforms/MacPlatform.hx | 4 ++-- tools/platforms/WindowsPlatform.hx | 9 +++++---- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/lime/tools/IOSHelper.hx b/src/lime/tools/IOSHelper.hx index 8ba7bc3c1..253ddc52c 100644 --- a/src/lime/tools/IOSHelper.hx +++ b/src/lime/tools/IOSHelper.hx @@ -128,7 +128,7 @@ class IOSHelper if (project.targetFlags.exists("simulator")) { - if (project.targetFlags.exists("i386") || project.targetFlags.exists("32")) + if (project.targetFlags.exists("i386") || project.targetFlags.exists("32") || project.targetFlags.exists("x86_32")) { commands.push("-arch"); commands.push("i386"); diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index de0993451..f84082891 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -997,12 +997,12 @@ class CommandLineTools if (isBuildCommand) { Log.println(" \x1b[3m(windows|mac|linux|android)\x1b[0m \x1b[1m-static\x1b[0m -- Compile as a static C++ executable"); - Log.println(" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-32\x1b[0m -- Compile for 32-bit instead of the OS default"); - Log.println(" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-64\x1b[0m -- Compile for 64-bit instead of the OS default"); + Log.println(" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-x86_32\x1b[0m -- Compile for x86_32 instead of the OS default"); + Log.println(" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-x86_64\x1b[0m -- Compile for x86_64 instead of the OS default"); Log.println(" \x1b[3m(ios|android)\x1b[0m \x1b[1m-armv6\x1b[0m -- Compile for ARMv6 instead of the OS defaults"); Log.println(" \x1b[3m(ios|android)\x1b[0m \x1b[1m-armv7\x1b[0m -- Compile for ARMv7 instead of the OS defaults"); Log.println(" \x1b[3m(ios|android)\x1b[0m \x1b[1m-armv7s\x1b[0m -- Compile for ARMv7s instead of the OS defaults"); - Log.println(" \x1b[3m(ios)\x1b[0m \x1b[1m-arm64\x1b[0m -- Compile for ARM64 instead of the OS defaults"); + Log.println(" \x1b[3m(mac|ios|android)\x1b[0m \x1b[1m-arm64\x1b[0m -- Compile for ARM64 instead of the OS defaults"); Log.println(" \x1b[3m(ios)\x1b[0m \x1b[1m-nosign\x1b[0m -- Compile executable, but skip codesigning"); } @@ -2245,11 +2245,11 @@ class CommandLineTools } catch (e:Dynamic) {} } - else if (argument == "-64") + else if (argument == "-64" || argument == "-x86_64") { overrides.architectures.push(Architecture.X64); } - else if (argument == "-32") + else if (argument == "-32" || argument == "-x86_32") { overrides.architectures.push(Architecture.X86); } diff --git a/tools/platforms/LinuxPlatform.hx b/tools/platforms/LinuxPlatform.hx index d6af57314..e08ed3874 100644 --- a/tools/platforms/LinuxPlatform.hx +++ b/tools/platforms/LinuxPlatform.hx @@ -120,7 +120,7 @@ class LinuxPlatform extends PlatformTarget for (architecture in project.architectures) { - if (!targetFlags.exists("32") && architecture == Architecture.X64) + if (!targetFlags.exists("32") && !targetFlags.exists("x86_32") && architecture == Architecture.X64) { is64 = true; } @@ -507,12 +507,12 @@ class LinuxPlatform extends PlatformTarget } else { - if (!targetFlags.exists("32") && System.hostArchitecture == X64) + if (!targetFlags.exists("32") && !targetFlags.exists("x86_32") && System.hostArchitecture == X64) { commands.push(["-Dlinux", "-DHXCPP_M64"]); } - if (!targetFlags.exists("64") && (command == "rebuild" || System.hostArchitecture == X86)) + if (!targetFlags.exists("64") && !targetFlags.exists("x86_64") && (command == "rebuild" || System.hostArchitecture == X86)) { commands.push(["-Dlinux", "-DHXCPP_M32"]); } diff --git a/tools/platforms/MacPlatform.hx b/tools/platforms/MacPlatform.hx index 594a104b0..6de0fc689 100644 --- a/tools/platforms/MacPlatform.hx +++ b/tools/platforms/MacPlatform.hx @@ -427,7 +427,7 @@ class MacPlatform extends PlatformTarget { commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_ARM64"]); } - else if (!targetFlags.exists("32")) + else if (!targetFlags.exists("32") && !targetFlags.exists("x86_32")) { commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64"]); } @@ -443,7 +443,7 @@ class MacPlatform extends PlatformTarget // hashlink doesn't support arm64 macs yet commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_ARCH=x86_64", "-Dhashlink"]); } - else if (targetFlags.exists("64")) + else if (targetFlags.exists("64") || targetFlags.exists("x86_64")) { commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_ARCH=x86_64"]); } diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx index c33d2519b..d1babe54f 100644 --- a/tools/platforms/WindowsPlatform.hx +++ b/tools/platforms/WindowsPlatform.hx @@ -145,7 +145,7 @@ class WindowsPlatform extends PlatformTarget else if (project.targetFlags.exists("hl") || targetFlags.exists("hlc")) { targetType = "hl"; - is64 = !project.flags.exists("32"); + is64 = !project.flags.exists("32") && !project.flags.exists("x86_32"); } else if (project.targetFlags.exists("cppia")) { @@ -737,7 +737,8 @@ class WindowsPlatform extends PlatformTarget if (targetType == "hl") { // default to 64 bit, just like upstream Hashlink releases - if (!targetFlags.exists("32") && (System.hostArchitecture == X64 || targetFlags.exists("64"))) + if (!targetFlags.exists("32") && !targetFlags.exists("x86_32") + && (System.hostArchitecture == X64 || targetFlags.exists("64") || targetFlags.exists("x86_64"))) { commands.push(["-Dwindows", "-DHXCPP_M64", "-Dhashlink"]); } @@ -748,7 +749,7 @@ class WindowsPlatform extends PlatformTarget } else { - if (!targetFlags.exists("64") + if (!targetFlags.exists("64") && !targetFlags.exists("x86_64") && (command == "rebuild" || System.hostArchitecture == X86 || (targetType != "cpp" && targetType != "winrt"))) { if (targetType == "winrt") @@ -765,7 +766,7 @@ class WindowsPlatform extends PlatformTarget // as previous Windows builds. For now, force -64 to be done last // so that it can be debugged in a default "rebuild" - if (!targetFlags.exists("32") + if (!targetFlags.exists("32") && !targetFlags.exists("x86_32") && System.hostArchitecture == X64 && (command != "rebuild" || targetType == "cpp" || targetType == "winrt")) {