Fix WebAssembly builds on Windows
This commit is contained in:
parent
de0045cf1b
commit
6e1828c958
2 changed files with 29 additions and 13 deletions
|
@ -32,7 +32,7 @@ basename = "godot" + env["PROGSUFFIX"] # output file name without file extension
|
||||||
# placeholder while leaving extension; also change `.html.mem` to just `.mem`
|
# placeholder while leaving extension; also change `.html.mem` to just `.mem`
|
||||||
fixup_html = env.Substfile(html_file, SUBST_DICT=[(basename, '$$GODOT_BASE'), ('.html.mem', '.mem')], SUBSTFILESUFFIX='.fixup.html')
|
fixup_html = env.Substfile(html_file, SUBST_DICT=[(basename, '$$GODOT_BASE'), ('.html.mem', '.mem')], SUBSTFILESUFFIX='.fixup.html')
|
||||||
|
|
||||||
zip_dir = env.Dir('#bin/js_zip')
|
zip_dir = env.Dir('#bin/.javascript_zip')
|
||||||
zip_files = []
|
zip_files = []
|
||||||
js_file = env.SideEffect(html_file.File(basename+'.js'), html_file)
|
js_file = env.SideEffect(html_file.File(basename+'.js'), html_file)
|
||||||
zip_files.append(env.InstallAs(
|
zip_files.append(env.InstallAs(
|
||||||
|
|
|
@ -12,8 +12,6 @@ def get_name():
|
||||||
|
|
||||||
|
|
||||||
def can_build():
|
def can_build():
|
||||||
|
|
||||||
import os
|
|
||||||
return os.environ.has_key("EMSCRIPTEN_ROOT")
|
return os.environ.has_key("EMSCRIPTEN_ROOT")
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,23 +33,41 @@ def get_flags():
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def create(env):
|
||||||
|
# remove Windows' .exe suffix
|
||||||
|
return env.Clone(PROGSUFFIX='')
|
||||||
|
|
||||||
|
|
||||||
|
def escape_sources_backslashes(target, source, env, for_signature):
|
||||||
|
return [path.replace('\\','\\\\') for path in env.GetBuildPath(source)]
|
||||||
|
|
||||||
|
def escape_target_backslashes(target, source, env, for_signature):
|
||||||
|
return env.GetBuildPath(target[0]).replace('\\','\\\\')
|
||||||
|
|
||||||
|
|
||||||
def configure(env):
|
def configure(env):
|
||||||
env['ENV'] = os.environ
|
env['ENV'] = os.environ
|
||||||
env.use_windows_spawn_fix('javascript')
|
|
||||||
|
|
||||||
env.Append(CPPPATH=['#platform/javascript'])
|
env.Append(CPPPATH=['#platform/javascript'])
|
||||||
|
|
||||||
em_path = os.environ["EMSCRIPTEN_ROOT"]
|
env.PrependENVPath('PATH', os.environ['EMSCRIPTEN_ROOT'])
|
||||||
|
env['CC'] = 'emcc'
|
||||||
env['ENV']['PATH'] = em_path + ":" + env['ENV']['PATH']
|
env['CXX'] = 'em++'
|
||||||
env['CC'] = em_path + '/emcc'
|
env['LINK'] = 'emcc'
|
||||||
env['CXX'] = em_path + '/em++'
|
env['RANLIB'] = 'emranlib'
|
||||||
env['LINK'] = em_path + '/emcc'
|
# Emscripten's ar has issues with duplicate file names, so use cc
|
||||||
env['AR'] = em_path + '/emar'
|
env['AR'] = 'emcc'
|
||||||
env['RANLIB'] = em_path + '/emranlib'
|
env['ARFLAGS'] = '-o'
|
||||||
|
if (os.name == 'nt'):
|
||||||
|
# use TempFileMunge on Windows since some commands get too long for
|
||||||
|
# cmd.exe even with spawn_fix
|
||||||
|
# need to escape backslashes for this
|
||||||
|
env['ESCAPED_SOURCES'] = escape_sources_backslashes
|
||||||
|
env['ESCAPED_TARGET'] = escape_target_backslashes
|
||||||
|
env['ARCOM'] = '${TEMPFILE("%s")}' % env['ARCOM'].replace('$SOURCES', '$ESCAPED_SOURCES').replace('$TARGET', '$ESCAPED_TARGET')
|
||||||
|
|
||||||
env['OBJSUFFIX'] = '.bc'
|
env['OBJSUFFIX'] = '.bc'
|
||||||
env['LIBSUFFIX'] = '.a'
|
env['LIBSUFFIX'] = '.bc'
|
||||||
|
|
||||||
if (env["target"] == "release"):
|
if (env["target"] == "release"):
|
||||||
env.Append(CCFLAGS=['-O2'])
|
env.Append(CCFLAGS=['-O2'])
|
||||||
|
|
Loading…
Reference in a new issue