Skip to content

compiling_Emscripten

Bruno Levy edited this page Dec 19, 2022 · 12 revisions

Compiling Geogram for Emscripten

Emscripten is a transpiler that transforms C++ code into webasm or javascript. It lets you convert C++ programs into webpages !

Prerequisites

  • Linux: apt-get install emscripten
  • Windows: see instructions here

Compiling under Linux

$ git clone --recurse-submodules https://github.com/BrunoLevy/geogram.git
$ cd geogram
$ configure.sh Emscripten-clang
$ cd build/Emscripten-clang-Release
$ make -j 4

Generating a webpage for an application

Now you need to create the webpage that encapsulates the application. There is in geogram a script for that:

$ cd build/Emscripten-clang-Release/bin
$ ../../tools/gen_emscripten_html.sh geobox

Testing an application locally

Unfortunately, you cannot just do $firefox geobox.html, because most webbrowser do not support directly loading local files, they want a webserver for that ! But python has a builtin one that is easy to start:

$ python -m http.server &
$ firefox http://localhost:8000/geobox.html

Issues

  • The scroll wheel for zooming is broken
  • The fullscreen button is broken
Clone this wiki locally