Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 committed Aug 19, 2021
1 parent ff75baa commit 488618c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2921,6 +2921,7 @@ def consume_arg_file():
options.no_entry = True
elif check_arg('--js-library'):
settings.JS_LIBRARIES.append((i + 1, os.path.abspath(consume_arg_file())))
settings.USER_JS_LIBRARIES.append(os.path.abspath(consume_arg_file()))
elif check_flag('--remove-duplicates'):
diagnostics.warning('legacy-settings', '--remove-duplicates is deprecated as it is no longer needed. If you cannot link without it, file a bug with a testcase')
elif check_flag('--jcache'):
Expand Down
3 changes: 3 additions & 0 deletions src/settings_internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ var WASI_MODULE_NAME = "wasi_snapshot_preview1";
// added by the JS compiler.
var JS_LIBRARIES = [];

// Libraries specified via --js-library command line
var USER_JS_LIBRARIES = [];

// This will contain the emscripten version. This can be useful in combination
// with RETAIN_COMPILER_SETTINGS
var EMSCRIPTEN_VERSION = '';
Expand Down
9 changes: 9 additions & 0 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -6153,6 +6153,15 @@ def test_js_lib_to_system_lib(self):
self.run_process([EMXX, 'test.cpp', '--js-library', 'lib.js', '-s', 'EXPORTED_FUNCTIONS=_main,_memset'])
self.assertContained('dddddddddd', self.run_js('a.out.js'))

def test_js_lib_internal_settings(self):
self.assertContained('var EMBIND =', open(path_from_root('src/settings_internal.js')).read())
create_file('lib.js', r'''
#if EMBIND
#endif
''')
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-o', 'out.js', '--js-library', 'lib.js'])
self.assertContained('ReferenceError: EMBIND is not defined', err)

def test_realpath(self):
create_file('src.c', r'''
#include <stdlib.h>
Expand Down

0 comments on commit 488618c

Please sign in to comment.