Skip to content

Emscripten platform + WebAssembly 32 / 64-bit option - #664

Merged
danoli3 merged 7 commits into
openframeworks:masterfrom
danoli3:emscripten-wasm64
Oct 15, 2026
Merged

danoli3 merged 7 commits into
openframeworks:masterfrom
danoli3:emscripten-wasm64

Conversation

@danoli3

@danoli3 danoli3 commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

PG side of openframeworks/openFrameworks#8558 (PROJECT_EMSCRIPTEN_WASM = 32 | 64 in config.emscripten.default.mk) and openframeworks/openFrameworks#8586 (CMake, same option name).

Emscripten platform

  • Emscripten is now a platform, "Emscripten (Web) (Make)". It still works as a template for osx / linux / linux64.
  • CLI: -pemscripten builds on the vscode base (Makefile, .vscode) and overlays scripts/templates/emscripten (Makefile, config.make, emmake.sh). No desktop platform is needed.
  • Template list: emscripten isn't added to platformsOptions. That list only drives allplatforms and the template filter, so adding it would block the template.
  • GUI: with the platform or the template selected, the WebGL / WebAssembly fields show, and after generating you get Build & Preview instead of "Open in IDE".

WebAssembly 32 / 64-bit

  • Option: CLI -W32 / -W64 (--emscripten-wasm=64). In the GUI it's the "WebAssembly (Emscripten)" dropdown, under Advanced options:
    • 32-bit (default) (MEMORY32)
    • 64-bit (WASM64) (MEMORY64)
  • 64: writes PROJECT_EMSCRIPTEN_WASM = 64 to config.make.
  • 32: writes nothing, so the makefile default applies and existing projects are unchanged. A legacy EMSCRIPTEN_MEMORY64 line is commented out.
  • No flag: keeps the project's value. It's read before the template copy can replace config.make. A legacy EMSCRIPTEN_MEMORY64 = 1 counts as 64.
  • Invalid values: a warning, and the project is left unchanged.
  • GUI on existing projects: opening one selects its value from config.make / CMakeLists.txt. New projects reset to 32.
  • Missing WASM64 libs: at 64, if no libs/*/lib/emscripten/WASM64 exists, PG warns to run BITS=64 scripts/emscripten/download_libs.sh, which replaces the installed lib/emscripten libs. The GUI shows the same note.
  • Addon libs: PG doesn't resolve emscripten addon libs itself. make / CMake pick WASM or WASM64, so the two are never mixed.

CMake template (openFrameworks#8586)

  • Template: -tcmake (GUI: Templates → "CMake (CMakeLists.txt)") copies scripts/templates/cmake/CMakeLists.txt if the project has none. An existing one is kept.
  • Edits: PG only edits a CMakeLists.txt that includes OF's openFrameworks.cmake:
    • the OF_ROOT default is set relative to the project, or absolute when the project is outside OF;
    • at 64, set(PROJECT_EMSCRIPTEN_WASM 64) goes before the include (a normal variable, so a stale cached 32 can't override it);
    • at 32 the line is removed.
  • Missing template: if OF has no scripts/templates/cmake, PG logs a warning.

Translations

  • All new strings are in the 9 locales.
  • Rebased on master after Add MSYS2 environment selector for msys2 / VSCode targets #648 (MSYS2 environment). The -k / -W options, the GUI fields and the 9 locales were merged by keeping both sides: 161 keys per locale, no duplicates. -pmsys2 -kclangarm64 and -pemscripten -W64 both still work.
  • Versions: commandLine 0.110.0, GUI 0.102.0.

Tested

  • CLI config.make:
    • new project at 64, then regenerated without the flag: kept;
    • switched to 32: removed;
    • legacy EMSCRIPTEN_MEMORY64 = 1: read as 64;
    • invalid value: warning, unchanged;
    • -posx -temscripten still works.
  • CMake files: at 64 / 32 the CMakeLists.txt was correct, the value was kept on reopen and removed when switched to 32, and OF_ROOT was absolute for a project outside OF.
  • Builds (OF #8586 branch, emsdk 6.0.9):
    • 32-bit: emcmake cmake + cmake --build and emmake make both build bin/em/<app>/index.html.
    • 64-bit: configure puts the core in lib/emscripten/WASM64 and compiles everything with -sMEMORY64=1 -mwasm64. The link then fails on third-party symbols, because there are no wasm64 libs yet. That's expected until apothecary ships real wasm64 emscripten_64 packages.
  • GUI:
    • the Emscripten platform shows the fields and Build & Preview;
    • opening 64 / 32 / CMake-only projects selects the right value;
    • new projects go back to 32;
    • generating at 64 writes the line.

@danoli3 danoli3 changed the title Emscripten: WebAssembly 32 / 64-bit option Emscripten platform + WebAssembly 32 / 64-bit option Oct 14, 2026
@danoli3
danoli3 force-pushed the emscripten-wasm64 branch 2 times, most recently from 3fd1e83 to e977fde Compare October 15, 2026 01:21
@danoli3
danoli3 merged commit 535d785 into openframeworks:master Oct 15, 2026
11 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant