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:
23
emsdk.py
23
emsdk.py
@@ -268,6 +268,8 @@ def cmake_generator_prefix():
|
|||||||
# Removes a directory tree even if it was readonly, and doesn't throw exception on failure.
|
# Removes a directory tree even if it was readonly, and doesn't throw exception on failure.
|
||||||
def remove_tree(d):
|
def remove_tree(d):
|
||||||
debug_print('remove_tree(' + str(d) + ')')
|
debug_print('remove_tree(' + str(d) + ')')
|
||||||
|
if not os.path.exists(d):
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
def remove_readonly_and_try_again(func, path, exc_info):
|
def remove_readonly_and_try_again(func, path, exc_info):
|
||||||
if not (os.stat(path).st_mode & stat.S_IWRITE):
|
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):
|
def copy_pregenerated_cache(tools_to_activate):
|
||||||
for tool in tools_to_activate:
|
for tool in tools_to_activate:
|
||||||
pregenerated_cache = getattr(tool, 'pregenerated_cache', None)
|
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.
|
# Finish the install of an emscripten-releases build.
|
||||||
install_path = to_native_path(sdk_path(tool.expand_vars(tool.install_path)))
|
install_path = to_native_path(sdk_path(tool.expand_vars(tool.install_path)))
|
||||||
in_cache = os.path.join(install_path, 'lib', pregenerated_cache)
|
in_cache = os.path.join(install_path, 'lib', cache_dir)
|
||||||
if os.path.exists(in_cache):
|
if not os.path.exists(in_cache):
|
||||||
out_cache = os.path.join(emscripten_cache_directory(), pregenerated_cache)
|
continue
|
||||||
os.makedirs(out_cache)
|
out_cache = os.path.join(emscripten_cache_directory(), cache_dir)
|
||||||
for filename in os.listdir(in_cache):
|
os.makedirs(out_cache)
|
||||||
debug_print('Copying ' + filename + ' to cache dir')
|
for filename in os.listdir(in_cache):
|
||||||
shutil.copy2(os.path.join(in_cache, filename),
|
debug_print('Copying %s to cache: %s' % (filename, out_cache))
|
||||||
os.path.join(out_cache, filename))
|
shutil.copy2(os.path.join(in_cache, filename),
|
||||||
|
os.path.join(out_cache, filename))
|
||||||
|
|
||||||
|
|
||||||
# Reconfigure .emscripten to choose the currently activated toolset, set PATH
|
# Reconfigure .emscripten to choose the currently activated toolset, set PATH
|
||||||
|
|||||||
@@ -114,7 +114,7 @@
|
|||||||
"activated_path": "%installation_dir%/emscripten",
|
"activated_path": "%installation_dir%/emscripten",
|
||||||
"activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten'",
|
"activated_cfg": "LLVM_ROOT='%installation_dir%/bin';BINARYEN_ROOT='%installation_dir%';EMSCRIPTEN_ROOT='%installation_dir%/emscripten'",
|
||||||
"emscripten_releases_hash": "%releases-tag%",
|
"emscripten_releases_hash": "%releases-tag%",
|
||||||
"pregenerated_cache": "wasm-obj"
|
"pregenerated_cache": ["wasm", "wasm-obj", "wasm-bc"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "releases",
|
"id": "releases",
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
"activated_path": "%installation_dir%/emscripten",
|
"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%'",
|
"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%",
|
"emscripten_releases_hash": "%releases-tag%",
|
||||||
"pregenerated_cache": "asmjs"
|
"pregenerated_cache": ["asmjs"]
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
2
test.py
2
test.py
@@ -56,7 +56,7 @@ open('hello_world.cpp', 'w').write('int main() {}')
|
|||||||
|
|
||||||
TAGS = json.loads(open('emscripten-releases-tags.txt').read())
|
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
|
# Tests
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user