summaryrefslogtreecommitdiff
path: root/platform/javascript/detect.py
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2016-10-31 14:06:46 +0100
committerGitHub <noreply@github.com>2016-10-31 14:06:46 +0100
commit681575fa7123592897090c6cce44402c4e45baeb (patch)
tree063bf4bebefabc373119f50e7a76471fc6b7140d /platform/javascript/detect.py
parent7384a6519f377ff926906ae37844c6e8044ae083 (diff)
parentd6f2862429399844ebdd16b61da3a3c9d14fba36 (diff)
Merge pull request #6994 from eska014/wasm
Add option 'wasm' to compile to WebAssembly in web export [ci skip]
Diffstat (limited to 'platform/javascript/detect.py')
-rw-r--r--platform/javascript/detect.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index b1277bfc05..b6a6a453b3 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -18,6 +18,7 @@ def can_build():
def get_opts():
return [
+ ['wasm','Compile to WebAssembly','no'],
['javascript_eval','Enable JavaScript eval interface','yes'],
]
@@ -42,7 +43,6 @@ def configure(env):
em_path=os.environ["EMSCRIPTEN_ROOT"]
env['ENV']['PATH'] = em_path+":"+env['ENV']['PATH']
-
env['CC'] = em_path+'/emcc'
env['CXX'] = em_path+'/emcc'
#env['AR'] = em_path+"/emar"
@@ -77,14 +77,20 @@ def configure(env):
env.Append(CPPFLAGS=['-DJAVASCRIPT_ENABLED', '-DUNIX_ENABLED', '-DPTHREAD_NO_RENAME', '-DNO_FCNTL','-DMPC_FIXED_POINT','-DTYPED_METHOD_BIND','-DNO_THREADS'])
env.Append(CPPFLAGS=['-DGLES2_ENABLED'])
env.Append(CPPFLAGS=['-DGLES_NO_CLIENT_ARRAYS'])
- env.Append(CPPFLAGS=['-s','ASM_JS=1'])
env.Append(CPPFLAGS=['-s','FULL_ES2=1'])
# env.Append(CPPFLAGS=['-DANDROID_ENABLED', '-DUNIX_ENABLED','-DMPC_FIXED_POINT'])
+ if env['wasm'] == 'yes':
+ env.Append(LINKFLAGS=['-s','BINARYEN=1'])
+ env.Append(LINKFLAGS=['-s','\'BINARYEN_METHOD="native-wasm"\''])
+ env["PROGSUFFIX"]+=".webassembly"
+ else:
+ env.Append(CPPFLAGS=['-s','ASM_JS=1'])
+ env.Append(LINKFLAGS=['-s','ASM_JS=1'])
+
if env['javascript_eval'] == 'yes':
env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
- env.Append(LINKFLAGS=['-s','ASM_JS=1'])
env.Append(LINKFLAGS=['-O2'])
#env.Append(LINKFLAGS=['-g4'])