From aebcc04dc759f7864bc34214603b363112128995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Tue, 15 Sep 2015 16:14:08 +0300 Subject: [PATCH] Add --build-tests command line option. --- emsdk | 54 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/emsdk b/emsdk index 05c0d97..d2a4cf4 100755 --- a/emsdk +++ b/emsdk @@ -48,8 +48,12 @@ CPU_CORES = max(multiprocessing.cpu_count()-1, 1) # Don't saturate all cores to CMAKE_BUILD_TYPE_OVERRIDE = None +# If true, perform a --shallow clone of git. GIT_CLONE_SHALLOW = False +# If true, LLVM backend is built with tests enabled. +BUILD_LLVM_TESTS = False + emscripten_config_directory = os.path.expanduser("~/") EMSDK_SET_ENV = 'emsdk_set_env.bat' if WINDOWS else 'emsdk_set_env.sh' @@ -607,8 +611,10 @@ def build_fastcomp_tool(tool): build_type = decide_cmake_build_type(tool) # Configure - success = cmake_configure(cmake_generator, build_root, fastcomp_src_root, build_type, ['-DLLVM_TARGETS_TO_BUILD=X86;JSBackend', - '-DLLVM_INCLUDE_EXAMPLES=OFF', '-DLLVM_INCLUDE_TESTS=OFF', '-DCLANG_INCLUDE_EXAMPLES=OFF', '-DCLANG_INCLUDE_TESTS=OFF']) + global BUILD_LLVM_TESTS + tests_arg = 'ON' if BUILD_LLVM_TESTS 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] + success = cmake_configure(cmake_generator, build_root, fastcomp_src_root, build_type, args) if not success: return False # Make @@ -1452,23 +1458,35 @@ def main(): emsdk update - Fetches a list of updates from the net (but does not install them) - emsdk install [-j] [--build=type] [--shallow] ... + emsdk install [options] ... - Downloads and installs given tools or SDKs. - An optional -j specifier can be used to - specify the number of cores to use when - building the tool. (default: use one less - than the # of detected cores) + Options can contain: - When installing tools from one of the git + -j: Specifies the number of cores to use when + building the tool. Default: use one less + than the # of detected cores. + + --build=: Controls what kind of build of LLVM to + perform. Pass either 'Debug', 'Release', + 'MinSizeRel' or 'RelWithDebInfo'. Default: + 'Release' for LLVM master branch, and + 'RelWithDebInfo' for LLVM incoming branch. + + --shallow: When installing tools from one of the git development branches 'master' or 'incoming', - you can specify the --shallow parameter - to perform a shallow git clone instead of a - full one. This reduces the amount of network - transfer that is needed. This option should - only be used when you are interested in - downloading one of the development branches, - but are not looking to develop Emscripten - yourself. + this parameter can be passed to perform a + shallow git clone instead of a full one. + This reduces the amount of network transfer + that is needed. This option should only be + used when you are interested in downloading + one of the development branches, but are not + looking to develop Emscripten yourself. + Default: disabled, i.e. do a full clone. + + --build-tests: If enabled, LLVM is built with internal tests + included. Pass this to enable running test + other.test_llvm_lit in the Emscripten test + suite. Default: disabled. emsdk uninstall - Removes the given tool or SDK from disk.''') @@ -1683,6 +1701,10 @@ def main(): global GIT_CLONE_SHALLOW GIT_CLONE_SHALLOW = True sys.argv[i] = '' + elif sys.argv[i] == '--build-tests': + global BUILD_LLVM_TESTS + BUILD_LLVM_TESTS = True + sys.argv[i] = '' sys.argv = [x for x in sys.argv if not len(x) == 0] if len(sys.argv) <= 2: print("Missing parameter. Type 'emsdk install ' 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.")