HL update

This commit is contained in:
Joshua Granick
2019-03-13 11:13:19 -07:00
parent 84694f104c
commit 8d72e71357
6 changed files with 60 additions and 32 deletions

View File

@@ -17,7 +17,7 @@
<set name="LIME_FREETYPE" value="1" />
<set name="LIME_HARFBUZZ" value="1" unless="winrt" />
<!-- <set name="LIME_HASHLINK" value="1" if="windows || mac || linux" /> -->
<set name="LIME_HASHLINK" value="1" if="hashlink" unless="HXCPP_M64" />
<set name="LIME_HASHLINK" value="1" if="hashlink" />
<set name="LIME_LZMA" value="1" />
<set name="LIME_MBEDTLS" value="1" unless="emscripten || winrt" />
<!-- <set name="LIME_NEKO" value="1" if="linux" /> -->
@@ -436,7 +436,7 @@
<lib name="-lgc" if="LIME_NEKO" />
<lib name="-lm" if="LIME_NEKO" />
<lib name="-L${HLPATH}" if="LIME_HASHLINK" />
<lib name="-L../templates/bin/hl/linux" if="LIME_HASHLINK" />
<lib name="-lhl" if="LIME_HASHLINK" />
</section>
@@ -460,7 +460,7 @@
<lib name="/opt/local/lib/libgc.a" if="LIME_NEKO" />
<lib name="-lm" if="LIME_NEKO" />
<lib name="-L${HLPATH}" if="LIME_HASHLINK" />
<lib name="-L../templates/bin/hl/mac" if="LIME_HASHLINK" />
<lib name="-lhl" if="LIME_HASHLINK" />
</section>

View File

@@ -1060,7 +1060,7 @@ class Bytes
setInt32(pos, v.low);
}
public function getString(pos:Int, len:Int, ?encoding:#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end):String
public function getString(pos:Int, len:Int #if (!hl || haxe_ver >= 4), ?encoding:#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end #end):String
{
if (outRange(pos, len)) throw Error.OutsideBounds;
@@ -1110,7 +1110,7 @@ class Bytes
return new Bytes(b, length);
}
public static function ofString(s:String, ?encoding:#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end):Bytes@:privateAccess {
public static function ofString(s:String #if (!hl || haxe_ver >= 4) , ?encoding:#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end #end):Bytes@:privateAccess {
var size = 0;
var b = s.bytes.utf16ToUtf8(0, size);
return new Bytes(b, size);
@@ -1121,6 +1121,7 @@ class Bytes
return new Bytes(b.bytes, b.length);
}
#if (!hl || haxe_ver >= 4)
public static function ofHex(s:String):Bytes
{
var len = s.length;
@@ -1138,6 +1139,7 @@ class Bytes
return new Bytes(b, l);
}
#end
public inline static function fastGet(b:BytesData, pos:Int):Int
{

BIN
templates/bin/hl/linux/hl Executable file

Binary file not shown.

BIN
templates/bin/hl/linux/libhl.so Executable file

Binary file not shown.

View File

@@ -59,7 +59,7 @@ class LinuxPlatform extends PlatformTarget
else if (project.targetFlags.exists("hl"))
{
targetType = "hl";
is64 = false;
is64 = true;
}
else if (project.targetFlags.exists("nodejs"))
{
@@ -92,7 +92,13 @@ class LinuxPlatform extends PlatformTarget
for (ndll in project.ndlls)
{
if (isRaspberryPi)
// TODO: Support single binary for HashLink
if (targetType == "hl")
{
ProjectHelper.copyLibrary(project, ndll, "Linux" + (is64 ? "64" : ""), "", ".hdll", applicationDirectory, project
.debug, targetSuffix);
}
else if (isRaspberryPi)
{
ProjectHelper.copyLibrary(project, ndll, "RPi", "",
(ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory,
@@ -101,8 +107,8 @@ class LinuxPlatform extends PlatformTarget
else
{
ProjectHelper.copyLibrary(project, ndll, "Linux" + (is64 ? "64" : ""), "",
(ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory,
project.debug, targetSuffix);
(ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll",
applicationDirectory, project.debug, targetSuffix);
}
}
}
@@ -130,8 +136,11 @@ class LinuxPlatform extends PlatformTarget
if (noOutput) return;
System.copyFile(targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl",
Path.combine(applicationDirectory, project.app.file + ".hl"));
// System.copyFile(targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl",
// Path.combine(applicationDirectory, project.app.file + ".hl"));
System.recursiveCopyTemplate(project.templatePaths, "bin/hl/linux", applicationDirectory);
System.copyFile(targetDirectory + "/obj/ApplicationMain.hl", Path.combine(applicationDirectory, "hlboot.dat"));
System.renameFile(Path.combine(applicationDirectory, "hl"), executablePath);
}
else if (targetType == "nodejs")
{
@@ -293,6 +302,11 @@ class LinuxPlatform extends PlatformTarget
"-DHXCPP_RANLIB=arm-linux-gnueabihf-ranlib"
]);
}
else if (targetFlags.exists("hl") && System.hostArchitecture == X64)
{
// TODO: Support single binary
commands.push(["-Dlinux", "-DHXCPP_M64", "-Dhashlink"]);
}
else
{
if (!targetFlags.exists("32") && System.hostArchitecture == X64)
@@ -318,11 +332,7 @@ class LinuxPlatform extends PlatformTarget
arguments.push("-verbose");
}
if (targetType == "hl")
{
System.runCommand(applicationDirectory, "hl", [project.app.file + ".hl"].concat(arguments));
}
else if (targetType == "nodejs")
if (targetType == "nodejs")
{
NodeJSHelper.run(project, targetDirectory + "/bin/ApplicationMain.js", arguments);
}

View File

@@ -53,7 +53,7 @@ class MacPlatform extends PlatformTarget
else if (project.targetFlags.exists("hl"))
{
targetType = "hl";
is64 = false;
is64 = true;
}
else if (project.targetFlags.exists("java"))
{
@@ -92,9 +92,18 @@ class MacPlatform extends PlatformTarget
for (ndll in project.ndlls)
{
ProjectHelper.copyLibrary(project, ndll, "Mac" + (is64 ? "64" : ""), "",
(ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dylib" : ".ndll", executableDirectory,
project.debug, targetSuffix);
// TODO: Support single binary for HashLink
if (targetType == "hl")
{
ProjectHelper.copyLibrary(project, ndll, "Mac" + (is64 ? "64" : ""), "", ".hdll", applicationDirectory, project
.debug, targetSuffix);
}
else
{
ProjectHelper.copyLibrary(project, ndll, "Mac" + (is64 ? "64" : ""), "",
(ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll",
applicationDirectory, project.debug, targetSuffix);
}
}
}
@@ -113,8 +122,11 @@ class MacPlatform extends PlatformTarget
if (noOutput) return;
System.copyFile(targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl",
Path.combine(executableDirectory, project.app.file + ".hl"));
// System.copyFile(targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl",
// Path.combine(executableDirectory, project.app.file + ".hl"));
System.recursiveCopyTemplate(project.templatePaths, "bin/hl/mac", applicationDirectory);
System.copyFile(targetDirectory + "/obj/ApplicationMain.hl", Path.combine(applicationDirectory, "hlboot.dat"));
System.renameFile(Path.combine(applicationDirectory, "hl"), executablePath);
}
else if (targetType == "java")
{
@@ -254,14 +266,22 @@ class MacPlatform extends PlatformTarget
{
var commands = [];
if (!targetFlags.exists("32") && (command == "rebuild" || System.hostArchitecture == X64))
if (targetFlags.exists("hl") && System.hostArchitecture == X64)
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64"]);
// TODO: Support single binary
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64", "-Dhashlink"]);
}
if (!targetFlags.exists("64") && (targetFlags.exists("32") || System.hostArchitecture == X86))
else
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M32"]);
if (!targetFlags.exists("32") && (command == "rebuild" || System.hostArchitecture == X64))
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64"]);
}
if (!targetFlags.exists("64") && (targetFlags.exists("32") || System.hostArchitecture == X86))
{
commands.push(["-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M32"]);
}
}
CPPHelper.rebuild(project, commands);
@@ -276,11 +296,7 @@ class MacPlatform extends PlatformTarget
arguments.push("-verbose");
}
if (targetType == "hl")
{
System.runCommand(applicationDirectory, "hl", [project.app.file + ".hl"].concat(arguments));
}
else if (targetType == "nodejs")
if (targetType == "nodejs")
{
NodeJSHelper.run(project, executableDirectory + "/ApplicationMain.js", arguments);
}