Use only_supports_wasm flag instead of separate install script

This commit is contained in:
Jacob Gravelle
2018-06-20 09:07:48 -07:00
parent e54a0dc5ae
commit 3310027d35
2 changed files with 12 additions and 19 deletions

25
emsdk
View File

@@ -790,16 +790,7 @@ def xcode_sdk_version():
except:
return subprocess.checkplatform.mac_ver()[0].split('.')
def build_fastcomp_tool(tool):
return build_llvm_tool(tool, build_js=True)
def build_upstream_llvm_tool(tool):
global ENABLE_WASM
# Upstream LLVM has no JSBackend, relies on wasm backend
ENABLE_WASM = True
return build_llvm_tool(tool, build_js=False)
def build_llvm_tool(tool, build_js):
def build_llvm_tool(tool):
if VERBOSE: print('build_llvm_tool(' + str(tool) + ')')
fastcomp_root = tool.installation_path()
fastcomp_src_root = os.path.join(fastcomp_root, 'src')
@@ -834,9 +825,12 @@ def build_llvm_tool(tool, build_js):
enable_assertions = ENABLE_LLVM_ASSERTIONS.lower() == 'on' or (ENABLE_LLVM_ASSERTIONS == 'auto' and build_type.lower() != 'release' and build_type.lower() != 'minsizerel')
js_target = ';JSBackend' if build_js else ''
args = ['-DLLVM_TARGETS_TO_BUILD=X86' + js_target, '-DLLVM_INCLUDE_EXAMPLES=OFF', '-DCLANG_INCLUDE_EXAMPLES=OFF', '-DLLVM_INCLUDE_TESTS=' + tests_arg, '-DCLANG_INCLUDE_TESTS=' + tests_arg, '-DLLVM_ENABLE_ASSERTIONS=' + ('ON' if enable_assertions else 'OFF')]
if ENABLE_WASM:
only_supports_wasm = hasattr(tool, 'only_supports_wasm')
targets_to_build = 'X86'
if not only_supports_wasm:
targets_to_build += ';JSBackend'
args = ['-DLLVM_TARGETS_TO_BUILD=' + targets_to_build, '-DLLVM_INCLUDE_EXAMPLES=OFF', '-DCLANG_INCLUDE_EXAMPLES=OFF', '-DLLVM_INCLUDE_TESTS=' + tests_arg, '-DCLANG_INCLUDE_TESTS=' + tests_arg, '-DLLVM_ENABLE_ASSERTIONS=' + ('ON' if enable_assertions else 'OFF')]
if ENABLE_WASM or only_supports_wasm:
args += ['-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly']
if os.environ.get('LLVM_CMAKE_ARGS'):
extra_args = os.environ['LLVM_CMAKE_ARGS'].split(',')
@@ -1350,9 +1344,7 @@ class Tool:
url = self.download_url()
if hasattr(self, 'custom_install_script') and self.custom_install_script == 'build_fastcomp':
success = build_fastcomp_tool(self)
elif hasattr(self, 'custom_install_script') and self.custom_install_script == 'build_llvm':
success = build_upstream_llvm_tool(self)
success = build_llvm_tool(self)
elif hasattr(self, 'git_branch'):
success = git_clone_checkout_and_pull(url, self.installation_path(), self.git_branch)
elif url.endswith('zip') or url.endswith('.tar') or url.endswith('.gz') or url.endswith('.xz'):
@@ -1366,7 +1358,6 @@ class Tool:
if success and hasattr(self, 'custom_install_script'):
if self.custom_install_script == 'build_optimizer': success = build_optimizer_tool(self)
elif self.custom_install_script == 'build_fastcomp': pass # 'build_fastcomp' is a special one that does the download on its own, others do the download manually.
elif self.custom_install_script == 'build_llvm': pass # 'build_llvm' is like 'build_fastcomp'
elif self.custom_install_script == 'build_binaryen': success = build_binaryen_tool(self)
else: raise Exception('Unknown custom_install_script command "' + self.custom_install_script + '"!')