mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 14:11:15 +00:00
Add option 'wasm' to compile to WebAssembly in web export
WebAssembly is still experimental, so disabled by default. The HTML shell file now uses $GODOT_BASE, a placeholder for the base filename, instead of $GODOT_JS, $GODOT_MEM and $GODOT_FS.
This commit is contained in:
parent
7384a6519f
commit
d6f2862429
4 changed files with 30 additions and 32 deletions
|
|
@ -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'])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue