Fix precompiled library support + testing (#444)

Support multiple libraries for precompiled things, as we use a
different one for LTO, etc.
This commit is contained in:
Alon Zakai
2020-03-05 10:45:46 -08:00
committed by GitHub
parent 3264996587
commit 8a35734a47
3 changed files with 17 additions and 12 deletions

View File

@@ -268,6 +268,8 @@ def cmake_generator_prefix():
# Removes a directory tree even if it was readonly, and doesn't throw exception on failure.
def remove_tree(d):
debug_print('remove_tree(' + str(d) + ')')
if not os.path.exists(d):
return
try:
def remove_readonly_and_try_again(func, path, exc_info):
if not (os.stat(path).st_mode & stat.S_IWRITE):
@@ -2478,17 +2480,20 @@ def emscripten_cache_directory():
def copy_pregenerated_cache(tools_to_activate):
for tool in tools_to_activate:
pregenerated_cache = getattr(tool, 'pregenerated_cache', None)
if pregenerated_cache:
if not pregenerated_cache:
continue
for cache_dir in pregenerated_cache:
# Finish the install of an emscripten-releases build.
install_path = to_native_path(sdk_path(tool.expand_vars(tool.install_path)))
in_cache = os.path.join(install_path, 'lib', pregenerated_cache)
if os.path.exists(in_cache):
out_cache = os.path.join(emscripten_cache_directory(), pregenerated_cache)
os.makedirs(out_cache)
for filename in os.listdir(in_cache):
debug_print('Copying ' + filename + ' to cache dir')
shutil.copy2(os.path.join(in_cache, filename),
os.path.join(out_cache, filename))
in_cache = os.path.join(install_path, 'lib', cache_dir)
if not os.path.exists(in_cache):
continue
out_cache = os.path.join(emscripten_cache_directory(), cache_dir)
os.makedirs(out_cache)
for filename in os.listdir(in_cache):
debug_print('Copying %s to cache: %s' % (filename, out_cache))
shutil.copy2(os.path.join(in_cache, filename),
os.path.join(out_cache, filename))
# Reconfigure .emscripten to choose the currently activated toolset, set PATH

View File

@@ -114,7 +114,7 @@
"activated_path": "%installation_dir%/emscripten",
"activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten'",
"emscripten_releases_hash": "%releases-tag%",
"pregenerated_cache": "wasm-obj"
"pregenerated_cache": ["wasm", "wasm-obj", "wasm-bc"]
},
{
"id": "releases",
@@ -129,7 +129,7 @@
"activated_path": "%installation_dir%/emscripten",
"activated_cfg": "LLVM_ROOT='%installation_dir%/fastcomp/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten';EMSCRIPTEN_NATIVE_OPTIMIZER='%installation_dir%/bin/optimizer%.exe%'",
"emscripten_releases_hash": "%releases-tag%",
"pregenerated_cache": "asmjs"
"pregenerated_cache": ["asmjs"]
},
{

View File

@@ -56,7 +56,7 @@ open('hello_world.cpp', 'w').write('int main() {}')
TAGS = json.loads(open('emscripten-releases-tags.txt').read())
LIBC = os.path.expanduser('~/.emscripten_cache/wasm-obj/libc.a')
LIBC = os.path.expanduser('~/.emscripten_cache/wasm/libc.a')
# Tests