From eb0c29d2c7f207e202861e916086cd4bea008428 Mon Sep 17 00:00:00 2001 From: Bryan Elliott Date: Sat, 10 Feb 2018 17:03:53 -0500 Subject: [PATCH] Fixed detection of EMSCRIPTEN_SDK environment variable --- lime/tools/platforms/EmscriptenPlatform.hx | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lime/tools/platforms/EmscriptenPlatform.hx b/lime/tools/platforms/EmscriptenPlatform.hx index ea01597cb..03269f96a 100644 --- a/lime/tools/platforms/EmscriptenPlatform.hx +++ b/lime/tools/platforms/EmscriptenPlatform.hx @@ -36,11 +36,20 @@ class EmscriptenPlatform extends PlatformTarget { public override function build ():Void { + var emSdk = null; + + 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 (!project.defines.exists ("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); @@ -367,4 +368,4 @@ class EmscriptenPlatform extends PlatformTarget { @ignore public override function uninstall ():Void {} -} \ No newline at end of file +}