Add option to enable WebAssembly in LLVM

This commit is contained in:
Juan Pedro Bolívar Puente
2016-08-17 10:47:14 +02:00
parent 35160c869d
commit 95e7e02d46

12
emsdk
View File

@@ -54,6 +54,9 @@ GIT_CLONE_SHALLOW = False
# If true, LLVM backend is built with tests enabled. # If true, LLVM backend is built with tests enabled.
BUILD_LLVM_TESTS = False BUILD_LLVM_TESTS = False
# If true, we will try to build WebAssembly support
ENABLE_WASM = False
# If 'auto', assertions are decided by the build type (Release&MinSizeRel=disabled, Debug&RelWithDebInfo=enabled) # If 'auto', assertions are decided by the build type (Release&MinSizeRel=disabled, Debug&RelWithDebInfo=enabled)
# Other valid values are 'ON' and 'OFF' # Other valid values are 'ON' and 'OFF'
ENABLE_LLVM_ASSERTIONS = 'auto' ENABLE_LLVM_ASSERTIONS = 'auto'
@@ -712,6 +715,8 @@ def build_fastcomp_tool(tool):
enable_assertions = ENABLE_LLVM_ASSERTIONS.lower() == 'on' or (ENABLE_LLVM_ASSERTIONS == 'auto' and build_type.lower() != 'release' and build_type.lower() != 'minsizerel') enable_assertions = ENABLE_LLVM_ASSERTIONS.lower() == 'on' or (ENABLE_LLVM_ASSERTIONS == 'auto' and build_type.lower() != 'release' and build_type.lower() != 'minsizerel')
args = ['-DLLVM_TARGETS_TO_BUILD=X86;JSBackend', '-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')] args = ['-DLLVM_TARGETS_TO_BUILD=X86;JSBackend', '-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:
args += ['-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly']
success = cmake_configure(cmake_generator, build_root, fastcomp_src_root, build_type, args) success = cmake_configure(cmake_generator, build_root, fastcomp_src_root, build_type, args)
if not success: return False if not success: return False
@@ -1644,6 +1649,9 @@ def main():
passed to the emsdk activate command to passed to the emsdk activate command to
activate the desired version. activate the desired version.
--enable-wasm: Enable WebAssembly support in the
installed components.
emsdk uninstall <tool/sdk> - Removes the given tool or SDK from disk.''') emsdk uninstall <tool/sdk> - Removes the given tool or SDK from disk.''')
if WINDOWS: if WINDOWS:
@@ -1869,6 +1877,10 @@ def main():
elif sys.argv[i] == '--disable-assertions': elif sys.argv[i] == '--disable-assertions':
ENABLE_LLVM_ASSERTIONS = 'OFF' ENABLE_LLVM_ASSERTIONS = 'OFF'
sys.argv[i] = '' sys.argv[i] = ''
elif sys.argv[i] == '--enable-wasm':
global ENABLE_WASM
ENABLE_WASM = True
sys.argv[i] = ''
sys.argv = [x for x in sys.argv if not len(x) == 0] sys.argv = [x for x in sys.argv if not len(x) == 0]
if len(sys.argv) <= 2: if len(sys.argv) <= 2:
print("Missing parameter. Type 'emsdk install <tool name>' to install a tool or an SDK. Type 'emsdk list' to obtain a list of available tools. Type 'emsdk install latest' to automatically install the newest version of the SDK.") print("Missing parameter. Type 'emsdk install <tool name>' to install a tool or an SDK. Type 'emsdk list' to obtain a list of available tools. Type 'emsdk install latest' to automatically install the newest version of the SDK.")