Rename Emscripten target to WebAssembly
This commit is contained in:
@@ -287,8 +287,8 @@ class CommandLineTools
|
||||
target = Platform.LINUX;
|
||||
targetFlags.set("rpi", "");
|
||||
|
||||
case "webassembly", "wasm":
|
||||
target = Platform.EMSCRIPTEN;
|
||||
case "webassembly", "wasm", "emscripten":
|
||||
target = Platform.WEB_ASSEMBLY;
|
||||
targetFlags.set("webassembly", "");
|
||||
|
||||
default:
|
||||
@@ -622,8 +622,8 @@ class CommandLineTools
|
||||
|
||||
// platform = new FirefoxPlatform (command, project, targetFlags);
|
||||
|
||||
case EMSCRIPTEN:
|
||||
platform = new EmscriptenPlatform(command, project, targetFlags);
|
||||
case WEB_ASSEMBLY:
|
||||
platform = new WebAssemblyPlatform(command, project, targetFlags);
|
||||
|
||||
case TVOS:
|
||||
platform = new TVOSPlatform(command, project, targetFlags);
|
||||
@@ -916,7 +916,6 @@ class CommandLineTools
|
||||
Log.println(" \x1b[1mair\x1b[0m -- Create an AIR application");
|
||||
Log.println(" \x1b[1mandroid\x1b[0m -- Create an Android application");
|
||||
// Log.println (" \x1b[1mblackberry\x1b[0m -- Create a BlackBerry application");
|
||||
Log.println(" \x1b[1memscripten\x1b[0m -- Create an Emscripten application");
|
||||
Log.println(" \x1b[1mflash\x1b[0m -- Create a Flash SWF application");
|
||||
Log.println(" \x1b[1mhtml5\x1b[0m -- Create an HTML5 application");
|
||||
Log.println(" \x1b[1mios\x1b[0m -- Create an iOS application");
|
||||
@@ -925,6 +924,7 @@ class CommandLineTools
|
||||
// Log.println (" \x1b[1mtizen\x1b[0m -- Create a Tizen application");
|
||||
Log.println(" \x1b[1mtvos\x1b[0m -- Create a tvOS application");
|
||||
// Log.println (" \x1b[1mwebos\x1b[0m -- Create a webOS application");
|
||||
Log.println(" \x1b[1mwebassembly\x1b[0m -- Create a WebAssembly application");
|
||||
Log.println(" \x1b[1mwindows\x1b[0m -- Create a Windows application");
|
||||
|
||||
Log.println("");
|
||||
@@ -947,7 +947,7 @@ class CommandLineTools
|
||||
// Log.println (" \x1b[1mappletvsim\x1b[0m -- Alias for \x1b[1mtvos -simulator\x1b[0m");
|
||||
Log.println(" \x1b[1mrpi\x1b[0;3m/\x1b[0m\x1b[1mraspberrypi\x1b[0m -- Alias for \x1b[1mlinux -rpi\x1b[0m");
|
||||
Log.println(" \x1b[1melectron\x1b[0m -- Alias for \x1b[1mhtml5 -electron\x1b[0m");
|
||||
Log.println(" \x1b[1mwebassembly\x1b[0;3m/\x1b[0m\x1b[1mwasm\x1b[0m -- Alias for \x1b[1memscripten -webassembly\x1b[0m");
|
||||
Log.println(" \x1b[1mwasm/emscripten\x1b[0m -- Alias for \x1b[1mwebassembly\x1b[0m");
|
||||
}
|
||||
|
||||
Log.println("");
|
||||
@@ -1030,16 +1030,15 @@ class CommandLineTools
|
||||
|
||||
if (command != "run" && command != "trace")
|
||||
{
|
||||
Log.println(" \x1b[3m(emscripten)\x1b[0m \x1b[1m-webassembly\x1b[0m -- Compile for WebAssembly instead of asm.js");
|
||||
Log.println(" \x1b[3m(emscripten|html5)\x1b[0m \x1b[1m-minify\x1b[0m -- Minify application file");
|
||||
Log.println(" \x1b[3m(html5|webassembly)\x1b[0m \x1b[1m-minify\x1b[0m -- Minify application file");
|
||||
}
|
||||
|
||||
if (command == "run" || command == "test")
|
||||
{
|
||||
Log.println(" \x1b[3m(emscripten|html5|flash)\x1b[0m \x1b[1m-nolaunch\x1b[0m -- Begin test server without launching");
|
||||
Log.println(" \x1b[3m(html5|flash|webassembly)\x1b[0m \x1b[1m-nolaunch\x1b[0m -- Begin test server without launching");
|
||||
// Log.println (" \x1b[3m(html5)\x1b[0m \x1b[1m-minify\x1b[0m -- Minify output using the Google Closure compiler");
|
||||
// Log.println (" \x1b[3m(html5)\x1b[0m \x1b[1m-minify -yui\x1b[0m -- Minify output using the YUI compressor");
|
||||
Log.println(" \x1b[3m(emscripten|html5|flash)\x1b[0m \x1b[1m--port=\x1b[0;3mvalue\x1b[0m -- Set port for test server");
|
||||
Log.println(" \x1b[3m(html5|flash|webassembly)\x1b[0m \x1b[1m--port=\x1b[0;3mvalue\x1b[0m -- Set port for test server");
|
||||
}
|
||||
|
||||
Log.println("");
|
||||
@@ -1562,8 +1561,8 @@ class CommandLineTools
|
||||
target = Platform.LINUX;
|
||||
targetFlags.set("rpi", "");
|
||||
|
||||
case "webassembly", "wasm":
|
||||
target = Platform.EMSCRIPTEN;
|
||||
case "webassembly", "wasm", "emscripten":
|
||||
target = Platform.WEB_ASSEMBLY;
|
||||
targetFlags.set("webassembly", "");
|
||||
|
||||
case "winjs", "uwp":
|
||||
|
||||
@@ -21,7 +21,7 @@ import lime.tools.ProjectHelper;
|
||||
import sys.io.File;
|
||||
import sys.FileSystem;
|
||||
|
||||
class EmscriptenPlatform extends PlatformTarget
|
||||
class WebAssemblyPlatform extends PlatformTarget
|
||||
{
|
||||
private var dependencyPath:String;
|
||||
private var outputFile:String;
|
||||
@@ -94,8 +94,8 @@ class EmscriptenPlatform extends PlatformTarget
|
||||
defaults.merge(project);
|
||||
project = defaults;
|
||||
|
||||
targetDirectory = Path.combine(project.app.path, project.config.getString("emscripten.output-directory", "emscripten"));
|
||||
dependencyPath = project.config.getString("emscripten.dependency-path", "lib");
|
||||
targetDirectory = Path.combine(project.app.path, project.config.getString("webassembly.output-directory", "webassembly"));
|
||||
dependencyPath = project.config.getString("webassembly.dependency-path", "lib");
|
||||
outputFile = targetDirectory + "/bin/" + project.app.file + ".js";
|
||||
}
|
||||
|
||||
@@ -114,11 +114,11 @@ class EmscriptenPlatform extends PlatformTarget
|
||||
|
||||
if (sdkPath == null)
|
||||
{
|
||||
Log.error("You must define EMSCRIPTEN_SDK with the path to your Emscripten SDK");
|
||||
Log.error("You must define EMSCRIPTEN_SDK with the path to your Emscripten SDK.");
|
||||
}
|
||||
|
||||
var hxml = targetDirectory + "/haxe/" + buildType + ".hxml";
|
||||
var args = [hxml, "-D", "emscripten", "-D", "webgl", "-D", "static_link"];
|
||||
var args = [hxml, "-D", "webassembly", "-D", "wasm", "-D", "emscripten", "-D", "webgl", "-D", "static_link"];
|
||||
|
||||
if (Log.verbose)
|
||||
{
|
||||
@@ -130,7 +130,7 @@ class EmscriptenPlatform extends PlatformTarget
|
||||
|
||||
if (noOutput) return;
|
||||
|
||||
CPPHelper.compile(project, targetDirectory + "/obj", ["-Demscripten", "-Dwebgl", "-Dstatic_link"]);
|
||||
CPPHelper.compile(project, targetDirectory + "/obj", ["-Dwebassembly", "-Dwasm", "-Demscripten", "-Dwebgl", "-Dstatic_link"]);
|
||||
// CPPHelper.compile(project, targetDirectory + "/obj", ["-Demscripten", "-Dwebgl", "-Dstatic_link"], "BuildMain.xml");
|
||||
|
||||
project.path(sdkPath);
|
||||
@@ -165,7 +165,7 @@ class EmscriptenPlatform extends PlatformTarget
|
||||
"ApplicationMain.o"
|
||||
]);
|
||||
|
||||
if (project.targetFlags.exists("webassembly") || project.targetFlags.exists("wasm") || !project.targetFlags.exists("asmjs"))
|
||||
if (!project.targetFlags.exists("asmjs"))
|
||||
{
|
||||
args.push("-s");
|
||||
args.push("WASM=1");
|
||||
@@ -190,19 +190,10 @@ class EmscriptenPlatform extends PlatformTarget
|
||||
}
|
||||
}
|
||||
|
||||
if (project.targetFlags.exists("final"))
|
||||
if (project.targetFlags.exists("final") || project.defines.exists("disable-exception-catching") || project.targetFlags.exists("disable-exception-catching"))
|
||||
{
|
||||
args.push("-s");
|
||||
args.push("DISABLE_EXCEPTION_CATCHING=1");
|
||||
args.push("-O3");
|
||||
}
|
||||
else if (!project.debug)
|
||||
{
|
||||
args.push("-s");
|
||||
args.push("DISABLE_EXCEPTION_CATCHING=1");
|
||||
// args.push ("-s");
|
||||
// args.push ("OUTLINING_LIMIT=70000");
|
||||
args.push("-O2");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -213,6 +204,20 @@ class EmscriptenPlatform extends PlatformTarget
|
||||
args.push("NO_DISABLE_EXCEPTION_CATCHING=1");
|
||||
args.push("-s");
|
||||
args.push("ASSERTIONS=1");
|
||||
}
|
||||
|
||||
if (project.targetFlags.exists("final"))
|
||||
{
|
||||
args.push("-O3");
|
||||
}
|
||||
else if (!project.debug)
|
||||
{
|
||||
// args.push ("-s");
|
||||
// args.push ("OUTLINING_LIMIT=70000");
|
||||
args.push("-O2");
|
||||
}
|
||||
else
|
||||
{
|
||||
args.push("-O1");
|
||||
}
|
||||
|
||||
@@ -279,7 +284,7 @@ class EmscriptenPlatform extends PlatformTarget
|
||||
}
|
||||
}
|
||||
|
||||
System.copyFileTemplate(project.templatePaths, "emscripten/output.js", outputFile, context);
|
||||
System.copyFileTemplate(project.templatePaths, "webassembly/output.js", outputFile, context);
|
||||
}
|
||||
|
||||
if (project.targetFlags.exists("minify"))
|
||||
@@ -316,7 +321,7 @@ class EmscriptenPlatform extends PlatformTarget
|
||||
|
||||
public override function deploy():Void
|
||||
{
|
||||
DeploymentHelper.deploy(project, targetFlags, targetDirectory, "Emscripten");
|
||||
DeploymentHelper.deploy(project, targetFlags, targetDirectory, "WebAssembly");
|
||||
}
|
||||
|
||||
public override function display():Void
|
||||
@@ -353,7 +358,7 @@ class EmscriptenPlatform extends PlatformTarget
|
||||
|
||||
public override function rebuild():Void
|
||||
{
|
||||
CPPHelper.rebuild(project, [["-Demscripten", "-Dstatic_link"]]);
|
||||
CPPHelper.rebuild(project, [["-Dwebassembly", "-Dwasm", "-Demscripten", "-Dstatic_link"]]);
|
||||
}
|
||||
|
||||
public override function run():Void
|
||||
@@ -378,10 +383,10 @@ class EmscriptenPlatform extends PlatformTarget
|
||||
}
|
||||
}
|
||||
|
||||
for (asset in project.assets)
|
||||
{
|
||||
asset.resourceName = "assets/" + asset.resourceName;
|
||||
}
|
||||
// for (asset in project.assets)
|
||||
// {
|
||||
// asset.resourceName = "assets/" + asset.resourceName;
|
||||
// }
|
||||
|
||||
var destination = targetDirectory + "/bin/";
|
||||
System.mkdir(destination);
|
||||
@@ -462,10 +467,10 @@ class EmscriptenPlatform extends PlatformTarget
|
||||
}
|
||||
}
|
||||
|
||||
ProjectHelper.recursiveSmartCopyTemplate(project, "emscripten/template", destination, context);
|
||||
ProjectHelper.recursiveSmartCopyTemplate(project, "webassembly/template", destination, context);
|
||||
ProjectHelper.recursiveSmartCopyTemplate(project, "haxe", targetDirectory + "/haxe", context);
|
||||
ProjectHelper.recursiveSmartCopyTemplate(project, "emscripten/hxml", targetDirectory + "/haxe", context);
|
||||
// ProjectHelper.recursiveSmartCopyTemplate(project, "emscripten/cpp", targetDirectory + "/obj", context);
|
||||
ProjectHelper.recursiveSmartCopyTemplate(project, "webassembly/hxml", targetDirectory + "/haxe", context);
|
||||
// ProjectHelper.recursiveSmartCopyTemplate(project, "webassembly/cpp", targetDirectory + "/obj", context);
|
||||
ProjectHelper.recursiveSmartCopyTemplate(project, "cpp/static", targetDirectory + "/obj", context);
|
||||
|
||||
for (asset in project.assets)
|
||||
@@ -369,9 +369,6 @@ class PlatformSetup
|
||||
|
||||
// setupBlackBerry ();
|
||||
|
||||
case "emscripten", "webassembly", "wasm":
|
||||
setupEmscripten();
|
||||
|
||||
case "html5":
|
||||
Log.println("\x1b[0;3mNo additional configuration is required.\x1b[0m");
|
||||
// setupHTML5 ();
|
||||
@@ -398,6 +395,9 @@ class PlatformSetup
|
||||
|
||||
// setupTizen ();
|
||||
|
||||
case "webassembly", "wasm", "emscripten":
|
||||
setupWebAssembly();
|
||||
|
||||
case "webos":
|
||||
|
||||
// setupWebOS ();
|
||||
@@ -625,18 +625,6 @@ class PlatformSetup
|
||||
Log.println("Setup complete.");
|
||||
}
|
||||
|
||||
public static function setupEmscripten():Void
|
||||
{
|
||||
Log.println("\x1b[1mIn order to build for WebAssembly or asm.js, you must download");
|
||||
Log.println("and install the Emscripten SDK.");
|
||||
Log.println("");
|
||||
|
||||
getDefineValue("EMSCRIPTEN_SDK", "Path to Emscripten SDK");
|
||||
|
||||
Log.println("");
|
||||
Log.println("Setup complete.");
|
||||
}
|
||||
|
||||
public static function setupHaxelib(haxelib:Haxelib, dependency:Bool = false):Void
|
||||
{
|
||||
setupHaxelibs.set(haxelib.name, true);
|
||||
@@ -1165,6 +1153,20 @@ class PlatformSetup
|
||||
}
|
||||
}
|
||||
|
||||
public static function setupWebAssembly():Void
|
||||
{
|
||||
Log.println("\x1b[1mIn order to build for WebAssembly or asm.js, you must download");
|
||||
Log.println("and install the Emscripten SDK.");
|
||||
Log.println("");
|
||||
Log.println("After install, the SDK path may be at \"emsdk/upstream/emscripten\"");
|
||||
Log.println("");
|
||||
|
||||
getDefineValue("EMSCRIPTEN_SDK", "Path to Emscripten SDK");
|
||||
|
||||
Log.println("");
|
||||
Log.println("Setup complete.");
|
||||
}
|
||||
|
||||
public static function setupWindows():Void
|
||||
{
|
||||
Log.println("\x1b[1mIn order to build native executables for Windows, you must have a");
|
||||
|
||||
Reference in New Issue
Block a user