Skip to content
Open
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ jobs:
steps:
- checkout
- pip-install
- run: tools/maint/update_settings_docs.py --check
- run: tools/maint/gen_settings.py --check
- run: make -C site text
- run: tools/maint/check_emcc_help_text.py
- run: make -C site html
Expand Down
12 changes: 6 additions & 6 deletions docs/emcc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Options that are modified or new in *emcc* are listed below:
the "Module" object. The compiler is aware of code in --pre-js
and --post-js, so you can safely use the runtime from there.
Alternatively, you can use "EXPORTED_RUNTIME_METHODS", see
src/settings.js.
src/settings.toml.

"-O3"
[compile+link] Like "-O2", but with additional optimizations that
Expand Down Expand Up @@ -95,7 +95,7 @@ Options that are modified or new in *emcc* are listed below:
"-sOPTION[=VALUE]"
[different OPTIONs affect at different stages, most at link time]
Emscripten build options. For the available options, see
src/settings.js.
src/settings.toml.

Note:

Expand Down Expand Up @@ -282,7 +282,7 @@ Options that are modified or new in *emcc* are listed below:
* Consider using "-sMODULARIZE" when using closure, as it
minifies globals to names that might conflict with others in
the global scope. "MODULARIZE" puts all the output into a
function (see "src/settings.js").
function (see "src/settings.toml").

* Closure will minify the name of *Module* itself, by default!
Using "MODULARIZE" will solve that as well. Another solution is
Expand All @@ -304,9 +304,9 @@ Options that are modified or new in *emcc* are listed below:
[link] Specify a file whose contents are added before the emitted
code and optimized together with it. Note that this might not
literally be the very first thing in the JS output, for example if
"MODULARIZE" is used (see "src/settings.js"). If you want that, you
can just prepend to the output from emscripten; the benefit of "--
pre-js" is that it optimizes the code with the rest of the
"MODULARIZE" is used (see "src/settings.toml"). If you want that,
you can just prepend to the output from emscripten; the benefit of
"--pre-js" is that it optimizes the code with the rest of the
emscripten output, which allows better dead code elimination and
minification, and it should only be used for that purpose. In
particular, "--pre-js" code should not alter the main output from
Expand Down
3 changes: 3 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ websockify==0.13.0

# Needed by tests in test_other.py
meson==1.12.1

# Needed for TOML settings parsing on Python < 3.11
tomli==2.3.0; python_version < '3.11'
19 changes: 10 additions & 9 deletions site/source/docs/api_reference/advanced-apis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,34 @@ working on the Emscripten core.
:depth: 1


.. _settings-toml:
.. _settings-js:

settings.js
===========
settings.toml
=============

`settings.js`_ contains default values and options used in various places by the
`settings.toml`_ contains default values and options used in various places by the
compiler.

.. Warning:: Many **settings.js** options are highly brittle - certain
.. Warning:: Many **settings.toml** options are highly brittle - certain
combinations of options, and combinations of certain options used with some
source code, can cause Emscripten to fail badly. This is intended for use by
"advanced users", and possibly even only people developing Emscripten itself.

The options in **settings.js** are normally set as command line parameters to
The options in **settings.toml** are normally set as command line parameters to
*emcc*::

emcc -sOPT=VALUE

While it is possible to edit **settings.js** manually, this is *highly
discouraged*. In general **settings.js** defines low-level options that should
While it is possible to edit **settings.toml** manually, this is *highly
discouraged*. In general **settings.toml** defines low-level options that should
not be modified. Note also that the compiler changes some options depending on
other settings. For example, ``ASSERTIONS`` is enabled by default, but disabled
in optimized builds (``-O1+``).

.. note::
For more information on what options can be used to configure Emscripten, read
``src/settings.js`` or visit
``src/settings.toml`` or visit
`the emsettings page <https://emsettings.surma.technology>`_.


Expand Down Expand Up @@ -119,5 +120,5 @@ There are also a small number of additional :ref:`flag modes <fs-read-and-write-
- ``xa``
- ``xa+``

.. _settings.js: https://github.com/emscripten-core/emscripten/blob/main/src/settings.js
.. _settings.toml: https://github.com/emscripten-core/emscripten/blob/main/src/settings.toml
.. _preamble.js: https://github.com/emscripten-core/emscripten/blob/main/src/preamble.js
4 changes: 2 additions & 2 deletions site/source/docs/getting_started/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ can't work.

But by putting each module in a function scope, that problem is avoided.
Emscripten even has a compile flag for this, ``MODULARIZE``, useful in
conjunction with ``EXPORT_NAME`` (details in settings.js).
conjunction with ``EXPORT_NAME`` (details in settings.toml).

However, there are still some issues if the same Module object (that defines the
canvas, text output area, etc.) is used among separate modules. By default
Expand All @@ -694,7 +694,7 @@ programs, which can run modularly as described above.
Can I build JavaScript that only runs on the Web?
=================================================

Yes, you can use the `ENVIRONMENT` option in ``settings.js``. For example,
Yes, you can use the `ENVIRONMENT` option in ``settings.toml``. For example,
building with ``emcc -sENVIRONMENT=web`` will emit code that only runs on the
Web, and does not include support code for Node.js and other environments.

Expand Down
4 changes: 2 additions & 2 deletions site/source/docs/getting_started/Tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ other general tips for using Emscripten:
Emscripten. For example, if you want to better understand how the *emcc*
``--pre-js`` option works, search for ``--pre-js`` in the test suite: the test
suite is extensive and there are likely to be at least some examples.
- To learn how to use Emscripten in advanced ways, read :ref:`src/settings.js
<settings-js>` and :ref:`emcc <emccdoc>` which describe the compiler options,
- To learn how to use Emscripten in advanced ways, read :ref:`src/settings.toml
<settings-toml>` and :ref:`emcc <emccdoc>` which describe the compiler options,
and :ref:`emscripten-h` for details on JavaScript-specific C APIs that your
C/C++ programs can use when compiled with Emscripten.
- Read the :ref:`FAQ`.
Expand Down
6 changes: 3 additions & 3 deletions site/source/docs/optimizing/Optimizing-Code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ would normally be run.
Advanced compiler settings
==========================

There are several flags you can :ref:`pass to the compiler <emcc-s-option-value>` to affect code generation, which will also affect performance — for example :ref:`DISABLE_EXCEPTION_CATCHING <optimizing-code-exception-catching>`. These are documented in `src/settings.js <https://github.com/emscripten-core/emscripten/blob/main/src/settings.js>`_.
There are several flags you can :ref:`pass to the compiler <emcc-s-option-value>` to affect code generation, which will also affect performance — for example :ref:`DISABLE_EXCEPTION_CATCHING <optimizing-code-exception-catching>`. These are documented in `src/settings.toml <https://github.com/emscripten-core/emscripten/blob/main/src/settings.toml>`_.

WebAssembly
===========
Expand Down Expand Up @@ -110,7 +110,7 @@ In addition to the above, the following tips can help to reduce code size:
- `Floh's blogpost on this topic <http://floooh.github.io/2016/08/27/asmjs-diet.html>`_ is very helpful.
- Make sure to use gzip compression on your webserver, which all browsers now support.

The following compiler settings can help (see ``src/settings.js`` for more details):
The following compiler settings can help (see ``src/settings.toml`` for more details):

- Disable inlining when possible, using ``-sINLINING_LIMIT``. Compiling with -Os or -Oz generally avoids inlining too. (Inlining can make code faster, though, so use this carefully.)
- You can use the ``-sFILESYSTEM=0`` option to disable bundling of filesystem support code (the compiler should optimize it out if not used, but may not always succeed). This can be useful if you are building a pure computational library, for example.
Expand Down Expand Up @@ -208,7 +208,7 @@ C++ exceptions

Catching C++ exceptions (specifically, emitting catch blocks) is turned off by default in ``-O1`` (and above). Due to how WebAssembly currently implement exceptions, this makes the code much smaller and faster (eventually, Wasm should gain native support for exceptions, and not have this issue).

To re-enable exceptions in optimized code, run *emcc* with ``-sDISABLE_EXCEPTION_CATCHING=0`` (see `src/settings.js <https://github.com/emscripten-core/emscripten/blob/main/src/settings.js>`_).
To re-enable exceptions in optimized code, run *emcc* with ``-sDISABLE_EXCEPTION_CATCHING=0`` (see `src/settings.toml <https://github.com/emscripten-core/emscripten/blob/main/src/settings.toml>`_).

.. note:: When exception catching is disabled, a thrown exception terminates the application. In other words, an exception is still thrown, but it isn't caught.

Expand Down
4 changes: 2 additions & 2 deletions site/source/docs/porting/Debugging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ Some important settings are:



A number of other useful debug settings are defined in `src/settings.js
<https://github.com/emscripten-core/emscripten/blob/main/src/settings.js>`_. For
A number of other useful debug settings are defined in `src/settings.toml
<https://github.com/emscripten-core/emscripten/blob/main/src/settings.toml>`_. For
more information, search that file for the keywords "check" and "debug".


Expand Down
8 changes: 4 additions & 4 deletions site/source/docs/tools_reference/emcc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Options that are modified or new in *emcc* are listed below:
[compile+link]
Like ``-O1``, but enables more optimizations. During link this will also enable various JavaScript optimizations.

.. note:: These JavaScript optimizations can reduce code size by removing things that the compiler does not see being used, in particular, parts of the runtime may be stripped if they are not exported on the ``Module`` object. The compiler is aware of code in :ref:`--pre-js <emcc-pre-js>` and :ref:`--post-js <emcc-post-js>`, so you can safely use the runtime from there. Alternatively, you can use ``EXPORTED_RUNTIME_METHODS``, see `src/settings.js <https://github.com/emscripten-core/emscripten/blob/main/src/settings.js>`_.
.. note:: These JavaScript optimizations can reduce code size by removing things that the compiler does not see being used, in particular, parts of the runtime may be stripped if they are not exported on the ``Module`` object. The compiler is aware of code in :ref:`--pre-js <emcc-pre-js>` and :ref:`--post-js <emcc-post-js>`, so you can safely use the runtime from there. Alternatively, you can use ``EXPORTED_RUNTIME_METHODS``, see `src/settings.toml <https://github.com/emscripten-core/emscripten/blob/main/src/settings.toml>`_.

.. _emcc-O3:

Expand Down Expand Up @@ -97,7 +97,7 @@ Options that are modified or new in *emcc* are listed below:

``-sOPTION[=VALUE]``
[different OPTIONs affect at different stages, most at link time]
Emscripten build options. For the available options, see `src/settings.js <https://github.com/emscripten-core/emscripten/blob/main/src/settings.js>`_.
Emscripten build options. For the available options, see `src/settings.toml <https://github.com/emscripten-core/emscripten/blob/main/src/settings.toml>`_.

.. note:: If no value is specified it will default to ``1``.

Expand Down Expand Up @@ -282,7 +282,7 @@ Options that are modified or new in *emcc* are listed below:

.. note::

- Consider using ``-sMODULARIZE`` when using closure, as it minifies globals to names that might conflict with others in the global scope. ``MODULARIZE`` puts all the output into a function (see ``src/settings.js``).
- Consider using ``-sMODULARIZE`` when using closure, as it minifies globals to names that might conflict with others in the global scope. ``MODULARIZE`` puts all the output into a function (see ``src/settings.toml``).
- Closure will minify the name of `Module` itself, by default! Using ``MODULARIZE`` will solve that as well. Another solution is to make sure a global variable called `Module` already exists before the closure-compiled code runs, because then it will reuse that variable.

``--closure-args=<args>``
Expand All @@ -297,7 +297,7 @@ Options that are modified or new in *emcc* are listed below:

``--pre-js <file>``
[link]
Specify a file whose contents are added before the emitted code and optimized together with it. Note that this might not literally be the very first thing in the JS output, for example if ``MODULARIZE`` is used (see ``src/settings.js``). If you want that, you can just prepend to the output from emscripten; the benefit of ``--pre-js`` is that it optimizes the code with the rest of the emscripten output, which allows better dead code elimination and minification, and it should only be used for that purpose. In particular, ``--pre-js`` code should not alter the main output from emscripten in ways that could confuse the optimizer, such as using ``--pre-js`` + ``--post-js`` to put all the output in an inner function scope (see ``MODULARIZE`` for that).
Specify a file whose contents are added before the emitted code and optimized together with it. Note that this might not literally be the very first thing in the JS output, for example if ``MODULARIZE`` is used (see ``src/settings.toml``). If you want that, you can just prepend to the output from emscripten; the benefit of ``--pre-js`` is that it optimizes the code with the rest of the emscripten output, which allows better dead code elimination and minification, and it should only be used for that purpose. In particular, ``--pre-js`` code should not alter the main output from emscripten in ways that could confuse the optimizer, such as using ``--pre-js`` + ``--post-js`` to put all the output in an inner function scope (see ``MODULARIZE`` for that).

`--pre-js` (but not `--post-js`) is also useful for specifying things on the ``Module`` object, as it appears before the JS looks at ``Module`` (for example, you can define ``Module['print']`` there).

Expand Down
24 changes: 12 additions & 12 deletions site/source/docs/tools_reference/settings_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ documentation.
Unless otherwise noted these settings only apply when linking and have no effect
during compilation.

.. Auto-generated by update_settings_docs.py. **DO NOT EDIT**
.. Auto-generated by tools/maint/gen_settings.py. **DO NOT EDIT**

.. _assertions:

Expand Down Expand Up @@ -117,7 +117,7 @@ value must be large enough for the program's requirements. If
assertions are on, we will assert on not exceeding this, otherwise,
it will fail silently.

Default value: 64*1024
Default value: 65536

.. _malloc:

Expand Down Expand Up @@ -278,7 +278,7 @@ to reduce performance hiccups coming from memory resize, and the smaller
this value is, the more memory is conserved, at the performance of more
stuttering when the heap grows. (profiled to be on the order of ~20 msecs)

Default value: 0.20
Default value: 0.2

.. _memory_growth_geometric_cap:

Expand All @@ -290,7 +290,7 @@ this value to constrain the geometric grow to not exceed a specific rate.
Pass MEMORY_GROWTH_GEOMETRIC_CAP=0 to disable the cap and allow unbounded
size increases.

Default value: 96*1024*1024
Default value: 100663296

.. _memory_growth_linear_step:

Expand Down Expand Up @@ -397,7 +397,7 @@ errors, similar to -Werror compiler flag.

.. note:: This setting is deprecated

Default value: 'quiet'
Default value: "quiet"

.. _ignore_closure_compiler_errors:

Expand Down Expand Up @@ -567,7 +567,7 @@ In the (default) case of only a prefix being specified the URL will be
constructed from prefix + addr + ':' + port
where addr and port are derived from the socket connect/bind/accept calls.

Default value: 'ws://'
Default value: "ws://"

.. _proxy_posix_sockets:

Expand Down Expand Up @@ -617,7 +617,7 @@ A string containing a comma separated list of WebSocket subprotocols
as would be present in the Sec-WebSocket-Protocol header.
You can set 'null', if you don't want to specify it.

Default value: 'binary'
Default value: "binary"

.. _openal_debug:

Expand Down Expand Up @@ -1031,7 +1031,7 @@ ones we identify at runtime using ``ENVIRONMENT_IS_*``. Specifically:
Note that by default we do not include the 'shell' environment since direct
usage of d8, spidermonkey and jsc is extremely rare.

Default value: ['web', 'webview', 'worker', 'node']
Default value: ["web", "webview", "worker", "node"]

.. _lz4:

Expand Down Expand Up @@ -1467,7 +1467,7 @@ In addition to the default symbols, the following are also available:
- wasmMemory
- wasmBinary

Default value: (multi-line value, see settings.js)
Default value: (multi-line value, see src/settings.toml)

.. _case_insensitive_fs:

Expand Down Expand Up @@ -1937,7 +1937,7 @@ EXPORT_NAME
Global variable to export the module as for environments without a
standardized module loading system (e.g. the browser and SM shell).

Default value: 'Module'
Default value: "Module"

.. _dynamic_execution:

Expand Down Expand Up @@ -3138,7 +3138,7 @@ Setting this affects the path emitted in the wasm that refers to the DWARF
file, in -gseparate-dwarf mode. This allows the debugging file to be hosted
in a custom location.

Default value: ''
Default value: ""

.. _error_on_wasm_changes_after_link:

Expand Down Expand Up @@ -3467,7 +3467,7 @@ Explicit HTTPS origin list — restricted to those origins only::

Mixing ``'*'`` with explicit origins is a link-time error.

Default value: ['*']
Default value: ["*"]

.. _fake_dylibs:

Expand Down
4 changes: 2 additions & 2 deletions src/lib/libsdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2151,7 +2151,7 @@ var LibrarySDL = {
raw = callStbImage('stbi_load_from_memory', [rwops.bytes, rwops.count]);
if (!raw) return 0;
#else
warnOnce('Only file names that have been preloaded are supported for IMG_Load_RW. Consider using STB_IMAGE=1 if you want synchronous image decoding (see settings.js), or package files with --use-preload-plugins');
warnOnce('Only file names that have been preloaded are supported for IMG_Load_RW. Consider using STB_IMAGE=1 if you want synchronous image decoding (see src/settings.toml), or package files with --use-preload-plugins');
return 0;
#endif
}
Expand All @@ -2169,7 +2169,7 @@ var LibrarySDL = {
if (!raw) return 0;
#else
warnOnce(`Cannot find preloaded image ${filename}`);
warnOnce(`Cannot find preloaded image ${filename}. Consider using STB_IMAGE=1 if you want synchronous image decoding (see settings.js), or package files with --use-preload-plugins`);
warnOnce(`Cannot find preloaded image ${filename}. Consider using STB_IMAGE=1 if you want synchronous image decoding (see src/settings.toml), or package files with --use-preload-plugins`);
return 0;
#endif
}
Expand Down
Loading
Loading