TCM 1.1.0
A CMake module to reduce boilerplate
Loading...
Searching...
No Matches
Emscripten

TCM provides a function to work with Emscripten.

Remarks

Make sure Emscripten is installed on your system and check their toolchain file.

You need to provide Emscripten's toolchain to CMake. One way is to pass CMAKE_TOOLCHAIN_FILE "$env{EMROOT}/cmake/Modules/Platform/emscripten.cmake" EMROOT is a variable environment (name may differ) set to the root of emscripten's install directory.
tcm_target_setup_for_emscripten (
<target>
[SHELL_FILE <file>]
[EMBED_DIR <dir>]
[PRELOAD_DIR <dir>]
)

If EMSCRIPTEN is ON (it is, if using emscripten toolchain), then this target will produce:

  • a .html file,
  • a .wasm file,
  • and a .js file,

If a SHELL_FILE is not provided, then the one embedded in TCM will be used. If EMBED_DIR is specified, then it will be embedded by emscripten. If PRELOAD_DIR is specified, then it will be preloaded by emscripten.

A companion utility target, called ${target}_open_html is also configured to run/open the produced html with emrun.