Initial support for HL target in tools (for testing)

This commit is contained in:
Joshua Granick
2018-04-26 11:27:50 -07:00
parent c180653b30
commit 19bbf4edd6
9 changed files with 77 additions and 1 deletions

View File

@@ -95,6 +95,12 @@ class ProjectXMLParser extends HXProject {
defines.set ("native", "1");
defines.set ("neko", "1");
} else if (targetFlags.exists ("hl")) {
defines.set ("targetType", "hl");
defines.set ("native", "1");
defines.set ("hl", "1");
} else if (targetFlags.exists ("java")) {
defines.set ("targetType", "java");

View File

@@ -64,6 +64,10 @@ class LinuxPlatform extends PlatformTarget {
targetType = "neko";
} else if (project.targetFlags.exists ("hl")) {
targetType = "hl";
} else if (project.targetFlags.exists ("nodejs")) {
targetType = "nodejs";
@@ -128,6 +132,14 @@ class LinuxPlatform extends PlatformTarget {
}
} else if (targetType == "hl") {
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
if (noOutput) return;
NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory);
} else if (targetType == "nodejs") {
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
@@ -249,6 +261,7 @@ class LinuxPlatform extends PlatformTarget {
context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n";
context.NODE_FILE = targetDirectory + "/bin/ApplicationMain.js";
context.HL_FILE = targetDirectory + "/obj/ApplicationMain.hl";
context.CPP_DIR = targetDirectory + "/obj/";
context.BUILD_DIR = project.app.path + "/linux" + (is64 ? "64" : "") + (isRaspberryPi ? "-rpi" : "");
context.WIN_ALLOW_SHADERS = false;

View File

@@ -58,6 +58,10 @@ class MacPlatform extends PlatformTarget {
targetType = "neko";
} else if (project.targetFlags.exists ("hl")) {
targetType = "hl";
} else if (project.targetFlags.exists ("java")) {
targetType = "java";
@@ -111,6 +115,14 @@ class MacPlatform extends PlatformTarget {
NekoHelper.createExecutable (project.templatePaths, "mac" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath);
NekoHelper.copyLibraries (project.templatePaths, "mac" + (is64 ? "64" : ""), executableDirectory);
} else if (targetType == "hl") {
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
if (noOutput) return;
NekoHelper.copyLibraries (project.templatePaths, "mac" + (is64 ? "64" : ""), executableDirectory);
} else if (targetType == "java") {
var libPath = PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates/java/lib/");
@@ -224,6 +236,7 @@ class MacPlatform extends PlatformTarget {
var context = project.templateContext;
context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n";
context.NODE_FILE = executableDirectory + "/ApplicationMain.js";
context.HL_FILE = targetDirectory + "/obj/ApplicationMain.hl";
context.CPP_DIR = targetDirectory + "/obj/";
context.BUILD_DIR = project.app.path + "/mac" + (is64 ? "64" : "");

View File

@@ -63,6 +63,10 @@ class WindowsPlatform extends PlatformTarget {
targetType = "neko";
} else if (project.targetFlags.exists ("hl")) {
targetType = "hl";
} else if (project.targetFlags.exists ("nodejs")) {
targetType = "nodejs";
@@ -188,6 +192,14 @@ class WindowsPlatform extends PlatformTarget {
NekoHelper.createWindowsExecutable (project.templatePaths, targetDirectory + "/obj/ApplicationMain.n", executablePath, iconPath);
NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory);
} else if (targetType == "hl") {
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
if (noOutput) return;
NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory);
} else if (targetType == "nodejs") {
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
@@ -352,6 +364,7 @@ class WindowsPlatform extends PlatformTarget {
context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n";
context.NODE_FILE = targetDirectory + "/bin/ApplicationMain.js";
context.HL_FILE = targetDirectory + "/obj/ApplicationMain.hl";
context.CPP_DIR = targetDirectory + "/obj";
context.BUILD_DIR = project.app.path + "/windows" + (is64 ? "64" : "");

View File

@@ -0,0 +1,5 @@
-main ApplicationMain ::HAXE_FLAGS::
-cp ::OUTPUT_DIR::/haxe
-hl ::HL_FILE::
--macro keep("::APP_MAIN::")
-debug

View File

@@ -0,0 +1,5 @@
-main ApplicationMain ::HAXE_FLAGS::
-cp ::OUTPUT_DIR::/haxe
-hl ::HL_FILE::
--macro keep("::APP_MAIN::")
-D final

View File

@@ -0,0 +1,4 @@
-main ApplicationMain ::HAXE_FLAGS::
-cp ::OUTPUT_DIR::/haxe
-hl ::HL_FILE::
--macro keep("::APP_MAIN::")

View File

@@ -278,6 +278,16 @@ class CommandLineTools {
target = PlatformHelper.hostPlatform;
targetFlags.set ("neko", "");
case "hl":
target = PlatformHelper.hostPlatform;
targetFlags.set ("hl", "");
case "java":
target = PlatformHelper.hostPlatform;
targetFlags.set ("java", "");
case "nodejs":
target = PlatformHelper.hostPlatform;
@@ -1044,6 +1054,7 @@ class CommandLineTools {
LogHelper.println (" \x1b[1mnodejs\x1b[0m -- Alias for host platform (using \x1b[1m-nodejs\x1b[0m)");
LogHelper.println (" \x1b[1mjava\x1b[0m -- Alias for host platform (using \x1b[1m-java\x1b[0m)");
LogHelper.println (" \x1b[1mcs\x1b[0m -- Alias for host platform (using \x1b[1m-cs\x1b[0m)");
LogHelper.println (" \x1b[1mhl\x1b[0m -- Alias for host platform (using \x1b[1m-hl\x1b[0m)");
LogHelper.println (" \x1b[1muwp\x1b[0;3m/\x1b[0m\x1b[1mwinjs\x1b[0m -- Alias for \x1b[1mwindows -uwp\x1b[0m");
// LogHelper.println (" \x1b[1miphone\x1b[0;3m/\x1b[0m\x1b[1miphoneos\x1b[0m -- \x1b[1mios\x1b[0m");
// LogHelper.println (" \x1b[1miphonesim\x1b[0m -- Alias for \x1b[1mios -simulator\x1b[0m");
@@ -1163,6 +1174,7 @@ class CommandLineTools {
LogHelper.println (" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-java\x1b[0m -- Build for Java instead of C++");
LogHelper.println (" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-nodejs\x1b[0m -- Build for Node.js instead of C++");
LogHelper.println (" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-cs\x1b[0m -- Build for C# instead of C++");
LogHelper.println (" \x1b[3m(windows|mac|linux)\x1b[0m \x1b[1m-hl\x1b[0m -- Build for HashLink instead of C++");
LogHelper.println (" \x1b[3m(windows)\x1b[0m \x1b[1m-winjs\x1b[0m -- Build for WinJS instead of C++ (implies UWP)");
LogHelper.println (" \x1b[3m(windows)\x1b[0m \x1b[1m-uwp\x1b[0m -- Build for Universal Windows Platform");
LogHelper.println (" \x1b[3m(html5)\x1b[0m \x1b[1m-electron\x1b[0m -- Target Electron instead of the browser");
@@ -1676,6 +1688,11 @@ class CommandLineTools {
target = PlatformHelper.hostPlatform;
targetFlags.set ("neko", "");
case "hl":
target = PlatformHelper.hostPlatform;
targetFlags.set ("hl", "");
case "java":
target = PlatformHelper.hostPlatform;

View File

@@ -527,7 +527,7 @@ class PlatformSetup {
}
case "neko", "cs", "uwp", "winjs", "nodejs", "java":
case "neko", "hl", "cs", "uwp", "winjs", "nodejs", "java":
LogHelper.println ("\x1b[0;3mNo additional configuration is required.\x1b[0m");