Skip to content

Virtual DOM for C++ Web Assembly projects using asm-dom and gccx, wrapped in CMake

Notifications You must be signed in to change notification settings

jimmyorourke/cmake-asm-dom-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmake-asm-dom-wrapper

This project wraps asm-dom and gccx in CMake for easy integration into C++ projects.

This makes it simple to build dynamic single page web apps entirely in C++ (or CPX, JSX-like syntax for C++), using standard CMake and the Emscripten toolchain for WebAssembly, without writing any JavaScript!

This project is similar to and was inspired by asm-dom-cmake, but makes some different design decisions and is ready to be dropped into any new C++ WASM project as a submodule. See cppmart-asmdom as a project integration example.

The button-counter CPX example is taken from asm-dom-cmake with modifications to the build. Live demo.

The todo-mvc CPX example is based on an original example from asm-dom. Live demo.

Installing and Building

  • Install CMake, Emscripten, and Ninja (or alternatively use Make)
  • Install gccx through npm (npm typically gets installed with Emscripten)
  • Git clone recursively (to get the asm-dom submodule) right into your project
  • Run gccx at build time through CMake and link against asm-dom as per the examples

To build the examples

cd cmake-asm-dom-wrapper
mkdir build && cd build
emcmake cmake -G Ninja .. -DBUILD_ASM_DOM_EXAMPLE=1
ninja

Then to run, emrun example/todomvc-cpp/index.html --no_browser and open http://localhost:6931 in your browser. Alternatively use Python's http.server.

About

Virtual DOM for C++ Web Assembly projects using asm-dom and gccx, wrapped in CMake

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published