Fixed detection of EMSCRIPTEN_SDK environment variable

This commit is contained in:
Bryan Elliott
2018-02-10 17:03:53 -05:00
committed by Joshua Granick
parent f22423b0f1
commit eb0c29d2c7

View File

@@ -36,11 +36,20 @@ class EmscriptenPlatform extends PlatformTarget {
public override function build ():Void {
var emSdk = null;
if (!project.defines.exists ("EMSCRIPTEN_SDK")) {
if (project.environment.exists ("EMSCRIPTEN_SDK")) {
emSdk = project.environment.get ("EMSCRIPTEN_SDK");
} else if (project.defines.exists ("EMSCRIPTEN_SDK")) {
emSdk = project.defines.get ("EMSCRIPTEN_SDK");
}
if (emSdk == null) {
LogHelper.error ("You must define EMSCRIPTEN_SDK with the path to your Emscripten SDK");
}
var hxml = targetDirectory + "/haxe/" + buildType + ".hxml";
@@ -59,15 +68,7 @@ class EmscriptenPlatform extends PlatformTarget {
CPPHelper.compile (project, targetDirectory + "/obj", [ "-Demscripten", "-Dwebgl", "-Dstatic_link" ]);
if (project.environment.exists ("EMSCRIPTEN_SDK")) {
project.path (project.environment.get ("EMSCRIPTEN_SDK"));
} else if (project.defines.exists ("EMSCRIPTEN_SDK")) {
project.path (project.defines.get ("EMSCRIPTEN_SDK"));
}
project.path(emSdk);
ProcessHelper.runCommand ("", "emcc", [ targetDirectory + "/obj/Main.cpp", "-o", targetDirectory + "/obj/Main.o" ], true, false, true);