Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ def main(args):
print_file_name = [a for a in args if a.startswith(('-print-file-name=', '--print-file-name='))]
if print_file_name:
libname = print_file_name[-1].split('=')[1]
system_libpath = cache.get_lib_dir(absolute=True)
resource_dir = [a for a in args if a.startswith(('-resource-dir=', '--resource-dir='))]
if resource_dir:
system_libpath = resource_dir[-1].split('=')[1]
else:
system_libpath = cache.get_lib_dir(absolute=True)
fullpath = os.path.join(system_libpath, libname)
if os.path.isfile(fullpath):
print(fullpath)
Expand Down
8 changes: 8 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,14 @@ def test_print_file_name(self, args):
settings.MEMORY64 = int('-m64' in args)
self.assertContained(cache.get_lib_name('libc.a'), str(filename))

@crossplatform
def test_print_file_name_with_resource_dir(self):
file = Path(EMCC).name
output = self.run_process([EMCC, f'-print-file-name={file}'], stdout=PIPE).stdout
output_relative = self.run_process([EMCC, '-resource-dir=' + path_from_root(), f'-print-file-name={file}'], stdout=PIPE).stdout
self.assertNotExists(output.rstrip())
self.assertExists(output_relative.rstrip())

def test_emar_em_config_flag(self):
# Test that the --em-config flag is accepted but not passed down do llvm-ar.
# We expand this in case the EM_CONFIG is ~/.emscripten (default)
Expand Down