Fix Emscripten asset support, fix Log.verbose on Emscripten builds

This commit is contained in:
Joshua Granick
2017-06-23 16:30:15 -07:00
parent 44020adfc3
commit 3cd245682e
4 changed files with 21 additions and 3 deletions

View File

@@ -50,6 +50,10 @@ class ThreadPool {
__workCompleted = 0;
#end
#if emscripten
__synchronous = true;
#end
}

View File

@@ -111,6 +111,12 @@ class AssetHelper {
} else {
if (project.target == EMSCRIPTEN && (asset.embed != false || (asset.library != null && libraries.exists (asset.library) && libraries[asset.library].preload))) {
assetData.preload = true;
}
if (asset.embed == true || asset.type == FONT) {
assetData.className = "__ASSET__" + asset.flatName;

View File

@@ -38,8 +38,16 @@ class EmscriptenPlatform extends PlatformTarget {
public override function build ():Void {
var hxml = targetDirectory + "/haxe/" + buildType + ".hxml";
var args = [ hxml, "-D", "emscripten", "-D", "webgl", "-D", "static_link"];
ProcessHelper.runCommand ("", "haxe", [ hxml, "-D", "emscripten", "-D", "webgl", "-D", "static_link" ] );
if (LogHelper.verbose) {
args.push ("-D");
args.push ("verbose");
}
ProcessHelper.runCommand ("", "haxe", args);
if (noOutput) return;
@@ -53,7 +61,7 @@ class EmscriptenPlatform extends PlatformTarget {
ProcessHelper.runCommand ("", "emcc", [ targetDirectory + "/obj/Main.cpp", "-o", targetDirectory + "/obj/Main.o" ], true, false, true);
var args = [ "Main.o" ];
args = [ "Main.o" ];
for (ndll in project.ndlls) {

View File

@@ -35,7 +35,7 @@ import sys.FileSystem;
if (rootPath == null) {
#if (ios || tvos)
#if (ios || tvos || emscripten)
rootPath = "assets/";
#elseif (windows && !cs)
rootPath = FileSystem.absolutePath (haxe.io.Path.directory (#if (haxe_ver >= 3.3) Sys.programPath () #else Sys.executablePath () #end)) + "/";