From 08d634013593ca0711426950302adee4812e99b5 Mon Sep 17 00:00:00 2001 From: Apprentice-Alchemist <53486764+Apprentice-Alchemist@users.noreply.github.com> Date: Tue, 13 Dec 2022 11:09:05 +0100 Subject: [PATCH 1/2] For cross-compiling to Windows/macOS/Linux, default to HL unless user has explicitely set another target. --- tools/CommandLineTools.hx | 6 ++++++ tools/platforms/LinuxPlatform.hx | 6 +++++- tools/platforms/MacPlatform.hx | 6 +++++- tools/platforms/WindowsPlatform.hx | 6 +++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index 25fe2c3197..d9a0cf7e3b 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -1557,6 +1557,12 @@ class CommandLineTools case "mac", "macos": target = Platform.MAC; overrides.haxedefs.set("macos", ""); + case "windows": + target = Platform.WINDOWS; + overrides.haxedefs.set("windows", ""); + case "linux": + target = Platform.LINUX; + overrides.haxedefs.set("linux", ""); case "rpi", "raspberrypi": target = Platform.LINUX; diff --git a/tools/platforms/LinuxPlatform.hx b/tools/platforms/LinuxPlatform.hx index f1b98633f5..138a334d3c 100644 --- a/tools/platforms/LinuxPlatform.hx +++ b/tools/platforms/LinuxPlatform.hx @@ -136,7 +136,7 @@ class LinuxPlatform extends PlatformTarget is64 = false; } - if (project.targetFlags.exists("neko") || project.target != cast System.hostPlatform) + if (project.targetFlags.exists("neko")) { targetType = "neko"; } @@ -153,6 +153,10 @@ class LinuxPlatform extends PlatformTarget { targetType = "java"; } + else if (project.target != (cast System.hostPlatform)) + { + targetType = "hl"; + } else { targetType = "cpp"; diff --git a/tools/platforms/MacPlatform.hx b/tools/platforms/MacPlatform.hx index 4f80be65a0..bd26a0658f 100644 --- a/tools/platforms/MacPlatform.hx +++ b/tools/platforms/MacPlatform.hx @@ -130,7 +130,7 @@ class MacPlatform extends PlatformTarget } } - if (project.targetFlags.exists("neko") || project.target != cast System.hostPlatform) + if (project.targetFlags.exists("neko")) { targetType = "neko"; } @@ -151,6 +151,10 @@ class MacPlatform extends PlatformTarget { targetType = "cs"; } + else if (project.target != (cast System.hostPlatform)) + { + targetType = "hl"; + } else { targetType = "cpp"; diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx index 46433c6e9b..6b433376ee 100644 --- a/tools/platforms/WindowsPlatform.hx +++ b/tools/platforms/WindowsPlatform.hx @@ -138,7 +138,7 @@ class WindowsPlatform extends PlatformTarget { targetType = "winjs"; } - else if (project.targetFlags.exists("neko") || project.target != cast System.hostPlatform) + else if (project.targetFlags.exists("neko")) { targetType = "neko"; } @@ -168,6 +168,10 @@ class WindowsPlatform extends PlatformTarget { targetType = "winrt"; } + else if (project.target != (cast System.hostPlatform)) + { + targetType = "hl"; + } else { targetType = "cpp"; From eee22205790a166780de2e5ed33f20ff556b1d35 Mon Sep 17 00:00:00 2001 From: Apprentice-Alchemist <53486764+Apprentice-Alchemist@users.noreply.github.com> Date: Tue, 13 Dec 2022 18:15:29 +0100 Subject: [PATCH 2/2] Make sure is64 is true when cross compiling for HL. --- tools/platforms/LinuxPlatform.hx | 8 ++------ tools/platforms/MacPlatform.hx | 8 ++------ tools/platforms/WindowsPlatform.hx | 8 ++------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/tools/platforms/LinuxPlatform.hx b/tools/platforms/LinuxPlatform.hx index 138a334d3c..689d296d25 100644 --- a/tools/platforms/LinuxPlatform.hx +++ b/tools/platforms/LinuxPlatform.hx @@ -140,11 +140,6 @@ class LinuxPlatform extends PlatformTarget { targetType = "neko"; } - else if (project.targetFlags.exists("hl")) - { - targetType = "hl"; - is64 = true; - } else if (project.targetFlags.exists("nodejs")) { targetType = "nodejs"; @@ -153,9 +148,10 @@ class LinuxPlatform extends PlatformTarget { targetType = "java"; } - else if (project.target != (cast System.hostPlatform)) + else if (project.targetFlags.exists("hl") || project.target != (cast System.hostPlatform)) { targetType = "hl"; + is64 = true; } else { diff --git a/tools/platforms/MacPlatform.hx b/tools/platforms/MacPlatform.hx index bd26a0658f..9263245b03 100644 --- a/tools/platforms/MacPlatform.hx +++ b/tools/platforms/MacPlatform.hx @@ -134,11 +134,6 @@ class MacPlatform extends PlatformTarget { targetType = "neko"; } - else if (project.targetFlags.exists("hl")) - { - targetType = "hl"; - is64 = true; - } else if (project.targetFlags.exists("java")) { targetType = "java"; @@ -151,9 +146,10 @@ class MacPlatform extends PlatformTarget { targetType = "cs"; } - else if (project.target != (cast System.hostPlatform)) + else if (project.targetFlags.exists("hl") || project.target != (cast System.hostPlatform)) { targetType = "hl"; + is64 = true; } else { diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx index 6b433376ee..c9cbf7868e 100644 --- a/tools/platforms/WindowsPlatform.hx +++ b/tools/platforms/WindowsPlatform.hx @@ -142,11 +142,6 @@ class WindowsPlatform extends PlatformTarget { targetType = "neko"; } - else if (project.targetFlags.exists("hl")) - { - targetType = "hl"; - is64 = !project.flags.exists("32"); - } else if (project.targetFlags.exists("cppia")) { targetType = "cppia"; @@ -168,9 +163,10 @@ class WindowsPlatform extends PlatformTarget { targetType = "winrt"; } - else if (project.target != (cast System.hostPlatform)) + else if (project.targetFlags.exists("hl") || project.target != (cast System.hostPlatform)) { targetType = "hl"; + is64 = !project.flags.exists("32"); } else {