Set hl-ver for Lime's bundled HashLink

Haxe 5 defaults to 1.15, but we're currently still bundling an older version. So we need to specify hl-ver or it won't work properly because Haxe 5 will produce code that older HashLink isn't compatible with.

If hl-ver is already specified, or if a custom HL_PATH is defined, does not set hl-ver because that may be undesirable.
This commit is contained in:
Josh Tynjala
2025-07-09 10:23:43 -07:00
parent ae5751c230
commit 7b5a5e1d0a
4 changed files with 41 additions and 0 deletions

View File

@@ -11,6 +11,8 @@ import hxp.System;
class HashlinkHelper
{
public static inline var BUNDLED_HL_VER = "1.13.0";
public static function copyHashlink(project:HXProject, targetDirectory:String, applicationDirectory:String, executablePath:String, ?is64 = true)
{
var platform = project.target;

View File

@@ -140,6 +140,19 @@ class LinuxPlatform extends PlatformTarget
{
targetType = "hl";
is64 = true;
var hlVer = project.haxedefs.get("hl-ver");
if (hlVer == null)
{
var hlPath = project.defines.get("HL_PATH");
if (hlPath == null)
{
// Haxe's default target version for HashLink may be
// different (newer even) than the build of HashLink that
// is bundled with Lime. if using Lime's bundled HashLink,
// set hl-ver to the correct version
project.haxedefs.set("hl-ver", HashlinkHelper.BUNDLED_HL_VER);
}
}
}
else if (project.targetFlags.exists("nodejs"))
{

View File

@@ -129,6 +129,19 @@ class MacPlatform extends PlatformTarget
else if (project.targetFlags.exists("hl") || project.targetFlags.exists("hlc"))
{
targetType = "hl";
var hlVer = project.haxedefs.get("hl-ver");
if (hlVer == null)
{
var hlPath = project.defines.get("HL_PATH");
if (hlPath == null)
{
// Haxe's default target version for HashLink may be
// different (newer even) than the build of HashLink that
// is bundled with Lime. if using Lime's bundled HashLink,
// set hl-ver to the correct version
project.haxedefs.set("hl-ver", HashlinkHelper.BUNDLED_HL_VER);
}
}
}
else if (project.targetFlags.exists("java"))
{

View File

@@ -146,6 +146,19 @@ class WindowsPlatform extends PlatformTarget
{
targetType = "hl";
is64 = !project.flags.exists("32") && !project.flags.exists("x86_32");
var hlVer = project.haxedefs.get("hl-ver");
if (hlVer == null)
{
var hlPath = project.defines.get("HL_PATH");
if (hlPath == null)
{
// Haxe's default target version for HashLink may be
// different (newer even) than the build of HashLink that
// is bundled with Lime. if using Lime's bundled HashLink,
// set hl-ver to the correct version
project.haxedefs.set("hl-ver", HashlinkHelper.BUNDLED_HL_VER);
}
}
}
else if (project.targetFlags.exists("cppia"))
{