diff --git a/ChangeLog.md b/ChangeLog.md index 44873df201309..557d48302137c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -24,6 +24,9 @@ See docs/process.md for more on how version tagging works. `emcc` now uses this mode when the `--embed-file` option is used. If you use `file_packager` directly it is recommended that you switch to the new mode by adding `--obj-output` to the command line. (#16050) +- The `--bind` flag used to enable embind has been deprecated in favor of + `-lembind`. The semantics have not changed and the old flag continues to + work. (#16087) 3.1.2 - 20/01/2022 ------------------ diff --git a/docs/emcc.txt b/docs/emcc.txt index d2116700b5679..4a89c888122c3 100644 --- a/docs/emcc.txt +++ b/docs/emcc.txt @@ -388,8 +388,8 @@ Options that are modified or new in *emcc* are listed below: script to be run. "--bind" - [link] Compiles the source code using the Embind bindings to - connect C/C++ and JavaScript. + [link] Links against embind library. Deprecated: Use "-lembind" + instead. "--ignore-dynamic-linking" [link] Tells the compiler to ignore dynamic linking (the user will diff --git a/emcc.py b/emcc.py index 494d1ac1706f1..65a3297485e40 100755 --- a/emcc.py +++ b/emcc.py @@ -1935,9 +1935,6 @@ def default_setting(name, new_default): settings.FULL_ES2 = 1 settings.MAX_WEBGL_VERSION = max(2, settings.MAX_WEBGL_VERSION) - if settings.EMBIND: - state.forced_stdlibs.append('libembind') - settings.REQUIRED_EXPORTS += ['stackSave', 'stackRestore', 'stackAlloc'] if not settings.STANDALONE_WASM: # in standalone mode, crt1 will call the constructors from inside the wasm @@ -2153,6 +2150,9 @@ def check_memory_setting(setting): if not settings.DECLARE_ASM_MODULE_EXPORTS or '-lexports.js' in [x for _, x in state.link_flags]: settings.MINIFY_ASMJS_EXPORT_NAMES = 0 + if '-lembind' in [x for _, x in state.link_flags]: + settings.EMBIND = 1 + # Enable minification of wasm imports and exports when appropriate, if we # are emitting an optimized JS+wasm combo (then the JS knows how to load the minified names). # Things that process the JS after this operation would be done must disable this. @@ -2918,6 +2918,11 @@ def parse_args(newargs): skip = False continue + # Support legacy '--bind' flag, by mapping to `-lembind` which now + # has the same effect + if newargs[i] == '--bind': + newargs[i] = '-lembind' + arg = newargs[i] arg_value = None @@ -3064,10 +3069,6 @@ def consume_arg_file(): elif check_flag('--emit-symbol-map'): options.emit_symbol_map = True settings.EMIT_SYMBOL_MAP = 1 - elif check_flag('--bind'): - settings.EMBIND = 1 - settings.JS_LIBRARIES.append((0, os.path.join('embind', 'emval.js'))) - settings.JS_LIBRARIES.append((0, os.path.join('embind', 'embind.js'))) elif check_arg('--embed-file'): options.embed_files.append(consume_arg()) elif check_arg('--preload-file'): diff --git a/site/source/docs/porting/connecting_cpp_and_javascript/embind.rst b/site/source/docs/porting/connecting_cpp_and_javascript/embind.rst index da78546d3d36a..a6d9fd18e7abd 100644 --- a/site/source/docs/porting/connecting_cpp_and_javascript/embind.rst +++ b/site/source/docs/porting/connecting_cpp_and_javascript/embind.rst @@ -56,7 +56,7 @@ the simple C++ ``lerp()`` :cpp:func:`function` to JavaScript. To compile the above example using *embind*, we invoke *emcc* with the :ref:`bind ` option:: - emcc --bind -o quick_example.js quick_example.cpp + emcc -lembind -o quick_example.js quick_example.cpp The resulting **quick_example.js** file can be loaded as a node module or via a ``