From b99be73f2db5d3f81edc96a92ac4839e7f1cc3ab Mon Sep 17 00:00:00 2001 From: Justin Kerk Date: Sat, 29 Oct 2016 06:00:45 +0000 Subject: Experimental support for compiling to WebAssembly using Emscripten (not yet working) (nw) --- makefile | 4 ++++ scripts/genie.lua | 5 +++++ scripts/src/main.lua | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/makefile b/makefile index fbdcf366928..c2fb93ae148 100644 --- a/makefile +++ b/makefile @@ -742,6 +742,10 @@ endif ifdef DEBUG_ARGS PARAMS += --DEBUG_ARGS='$(DEBUG_ARGS)' endif + +ifdef WEBASSEMBLY +PARAMS += --WEBASSEMBLY='$(WEBASSEMBLY)' +endif #------------------------------------------------- # All scripts #------------------------------------------------- diff --git a/scripts/genie.lua b/scripts/genie.lua index 004c0228428..92a59fcd65f 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -377,6 +377,11 @@ newoption { description = "Arguments for running debug build.", } +newoption { + trigger = "WEBASSEMBLY", + description = "Produce WebAssembly output when building with Emscripten.", +} + dofile ("extlib.lua") if _OPTIONS["SHLIB"]=="1" then diff --git a/scripts/src/main.lua b/scripts/src/main.lua index eb7cac4c8d5..abd91200edd 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -137,6 +137,11 @@ end .. " -s DEMANGLE_SUPPORT=1" end + if _OPTIONS["WEBASSEMBLY"] then + emccopts = emccopts + .. " -s BINARYEN=1" + end + if _OPTIONS["ARCHOPTS"] then emccopts = emccopts .. " " .. _OPTIONS["ARCHOPTS"] end -- cgit v1.2.3-70-g09d2