Merge pull request #53 from arximboldi/enable-wasm

Add option to enable WebAssembly in LLVM
This commit is contained in:
juj
2017-03-27 22:26:14 +03:00
committed by GitHub

12
emsdk
View File

@@ -55,6 +55,9 @@ GIT_CLONE_SHALLOW = False
# If true, LLVM backend is built with tests enabled, and Binaryen is built with Visual Studio static analyzer enabled. # If true, LLVM backend is built with tests enabled, and Binaryen is built with Visual Studio static analyzer enabled.
BUILD_FOR_TESTING = False BUILD_FOR_TESTING = 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'
@@ -742,6 +745,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
@@ -1875,6 +1880,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:
@@ -2118,6 +2126,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.")