-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Home
Emscripten is an LLVM to JavaScript compiler. It takes LLVM bytecode (which can be generated from C/C++ using Clang, or any other language that can be converted into LLVM bytecode) and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run).
Using Emscripten, you can
- Compile C and C++ code into JavaScript and run that on the web
- Run code in languages like Python as well, by compiling CPython from C to JavaScript and interpreting code in that on the web
- See the FAQ for more details
Ready to get started? Download the SDK (or build from source) and then proceed to the Tutorial!
- Unity blogs about WebGL support and launches two public demos. More background info
- LLVM Backend - The new fastcomp backend has been merged to master and is present in the latest SDK release. See notes in that link.
- Unreal Engine 4 ported to the web using Emscripten. More info
Name | Description | Author | Submitted | Link | Source |
---|---|---|---|---|---|
Unity Demos | Angry Bots, Dead Trigger 2 (blogpost) new! | ||||
Epic Citadel | The full Unreal Engine 3, which was ported in 4 days
|
||||
Nebula3 | The Nebula3 engine | ||||
Bullet | The Bullet physics engine compiled to JavaScript with convenient automatically-generated bindings (through ammo.js) updated! | ||||
Esenthel Engine | Live Demo | ||||
Quake 3 | QuakeJS, a port of ioquake3 | ||||
Doom | The open source Freedoom game assets running on PrBoom, which is based on the open source Doom code | ||||
UNIGINE | Port of the UNIGINE game engine by ACTISKU | ||||
BananaBread | Port of Sauerbraten/Cube 2. Project page here. | ||||
[Torque 2D Demo] (http://stuff.cuppadev.co.uk/torque2d-web/) | An experimental port of the [Torque 2D] (https://github.com/GarageGames/Torque2D/wiki) game engine. [Blogpost] (http://www.cuppadev.co.uk/2013/12/torque2d-in-a-web-browser/) | ||||
[Nextris] (http://cheez.lt3.us/) | [Blogpost] (http://forums.tigsource.com/index.php?PHPSESSID=ac8b82fe4fe042851a596440998648c5&topic=33268.msg885283) | ||||
Voxel Invaders | Blogpost | ||||
Dune II | Port of OpenDune, an open source implementation of the classic real-time strategy game Dune II | ||||
Me & My Shadow | A 2D SDL platform/puzzle game (original here) | ||||
Heriswap | Port of a match-3 puzzle game | ||||
Ceferino | Port of a 2D action game (also available here) | ||||
SuperTux | Port of SuperTux by @forandom | ||||
Transport Tycoon Deluxe | port of OpenTTD by caiiiycuk | ||||
Box2D | The Box2D physics engine compiled to JavaScript with convenient automatically-generated bindings (through box2d.js) | ||||
Online Freecell solver (Text-based) | Port of libfreecell-solver (part of Freecell Solver) to JavaScript, with some jQuery glue | ||||
ScummVM ported to HTML5 | Demos of Monkey Island 1, Sam & Max, Day of the Tentacle, Indiana Jones and other LucasArts classics in your web browser! | ||||
drahtkern tech demo | A cross-platform 3D engine techdemo developed by MADE | ||||
Open Syobon Action | A parody of Super Mario. Original here. | ||||
Randomedia Game | An endless game with aliens and sheeps. Source code on Github. | ||||
Minko Engine | A free and open source 3D engine for HTML5, iOS, Android, Windows, Mac and Linux. | ||||
Minko - Sponza | The famous Sponza 3D model rendered with the Minko Engine. | ||||
Minko - Venus de Milo | A 3D scan of the Venus de Milo rendered with the Minko Engine. | ||||
Recast.js | - Port of Recast navigation mesh library | ||||
Name | Description | Author | Submitted | Link | Source |
---|---|---|---|---|---|
JSMESS | JavaScript port of the MESS emulator | ||||
Classic Mac OS | Mac Plus emulator using PCE | ||||
[Moonjs] (http://svtsim.com/moonjs/agc.html) | Simulator for the [Apollo Guidance Computer] (http://www.ibiblio.org/apollo/) (AGC) used in the Apollo Program's lunar missions | ||||
JS-VBA-M | Port of VBA-M by ILOVEPIE | ||||
VICE.js | Versatile Commodore Emulator for JavaScript |
Name | Description | Author | Submitted | Link | Source |
---|---|---|---|---|---|
pepper.js | Ports of miscellaneous PNaCl apps (earth, voronoi, bullet, etc.) | ||||
Qt | Ports of various Qt demos |
Name | Description | Author | Submitted | Link | Source |
---|---|---|---|---|---|
C/C++ | Clang and LLVM | ||||
Lua | The Lua VM, ported in lua.vm.js updated! | ||||
Dao | Port of the Dao language | ||||
mruby | Port of mruby, a lightweight implementation of the Ruby language | ||||
Python, Ruby, Lua | The popular dynamic languages Python, Ruby and Lua, compiled to JavaScript (Older Python demo ) | ||||
Perl | Port of (micro)perl-5.16.3 |
Name | Description | Author | Submitted | Link | Source |
---|---|---|---|---|---|
Developing a Simple Game of Air Hockey Using C and OpenGL ES 2 for Android, iOS, and the Web | This is a set of tutorials that takes a look at a very simple game developed for Android and ports it to the web by using emscripten. | ||||
Name | Description | Author | Submitted | Link | Source |
---|---|---|---|---|---|
Cocos2D-X | |||||
Name | Description | Author | Submitted | Link | Source |
---|---|---|---|---|---|
openFrameworks | openFrameworks ported via Emscripten new! | ||||
Vim.js | Vi IMproved | ||||
GnuPG | The GNU Privacy Guard suite | ||||
OpenSCAD | Solid 3D CAD Modeller | ||||
bardecode | ExactImage's barcode scanner | ||||
LaTeX and BibTeX | Ports of TeX Live's pdflatex and bibtex tools (using [texlive.js] (https://github.com/manuels/texlive.js/)) | ||||
ctags | Port of ctags | ||||
gnuplot | Port of gnuplot | ||||
LLVM IR | Compile and run LLVM IR in JS, using compiled parts of LLVM + emscripten | ||||
Graphviz | Graph visualization software (port is here) | ||||
PNG Crush | PNG optimizer in a web page | ||||
XML schema validation | XML validation in pure JS using compiled libxml | ||||
hpdf.js | Create PDF files in pure JS using compiled libharu | ||||
SQLite | SQLite compiled to JavaScript with an easy-to-use API (through sql.js) | ||||
Text-to-Speech | eSpeak, a speech synthesizer, compiled to JavaScript. |
- Poppler - PDF rendering in JavaScript, using Poppler and FreeType. Warning: Very large (>12MB) download. | | | | | | FreeType | TrueType font rendering in JavaScript, using FreeType | | | | | | Pocketsphinx.js | Speech recognition in JavaScript, using PocketSphinx and the Web Audio API | | | | | | ogg.js | libogg, libvorbis, and libopus compiled to JavaScript for Aurora.js | | | | | | MiniSat | Port of the MiniSat SAT solver | | | | | | Boolector | Port of the Boolector SMT solver | | | | | | videoconverter.js | A port of the FFmpeg video utilities | | | | | | audioconverter.js | The FFmpeg port with lame, vorbis and fdk-aac libraries for audio transcoding | | | | | | PDCurses | Port of PDCurses | | | | | | astyle.js | Port of Artistic Style | sass.js | Port of libsass | | | | epanet.js | Hydraulic analysis of water supply networks | | | | | | TinyGL.js | Implementation of a subset of OpenGL 1.1 compatible API in JavaScript | | | | | | | | | | | |
Name | Description | Author | Submitted | Link | Source |
---|---|---|---|---|---|
OpenGL ES 2.0 Gears | OpenGL ES 2.0 rendering compiled to WebGL | ||||
Ray tracing | A simple C++ ray tracer, rendering to a canvas element | ||||
Rawson.js | An experimental Camera RAW viewer in Javascript, based on an emscripten port of dcraw.c | ||||
[Crunch DXT1 Texture Compression] (http://www-cs-students.stanford.edu/~eparker/files/crunch/more_info.html) | Using [Crunch] (https://code.google.com/p/crunch/) to compress DXT1 textures for use in browsers supporting [compressed textures] (http://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/). Online [demo page] (http://www-cs-students.stanford.edu/~eparker/files/crunch/decode_test.html) using library. | ||||
Topologic | Simple viewer for higher-dimensional geometric primitives and fractals. | ||||
Verovio | A library for engraving MEI music notation into SVG |
Name | Description | Author | Submitted | Link | Source |
---|---|---|---|---|---|
zopfli.js | Zopfli, slow but smaller zlib/gzip compression | ||||
zpipe | zlib compiled to JS | ||||
zee.js | Another port of zlib to JS (focused on compressing/decompressing of gzip files) | ||||
lzma.js | LZMA ported to JS | ||||
sql.js | SQLite ported to JS | ||||
libtess2.js | libtess2 compiled to JavaScript | ||||
Projects using asm.js |
- FAQ - Goals of this project, what it can be used for, architecture overview, etc.
- Developer tweets: @kripken
- Developer blog: kripken/azakai (also this)
- Blogpost on compiling libraries from C/C++ to JavaScript, specifically how xml.js was ported
- Blogpost on asynchronous startup in compiled code
- Blogs around the web:
- Blogpost on compiling a platform game, Nook, using Emscripten
- Roadmap
- Talks-and-Publications - Talks and publications about Emscripten
- Interacting with Code: How to communicate with the compiled code from normal handwritten JavaScript
- Building Projects: How to use Emscripten to build projects using their existing makefiles, etc.
- Filesystem Guide: How to preload and embed resources with Emscripten
- Filesystem API: Overview of the Filesystem API methods
- embind: Docs for embind, a convenient way to use compiled C++ code from normal JavaScript
- Debugging: Check here if things go wrong
- EGL support in Emscripten
- Browser limitations: Describes hard limits and unsupported features on different browsers that Emscripten cannot workaround
-
Running html files with emrun: How to use the
emrun
command line tool - DRAFT: Library Support - A discussion about how to provide common prebuilt libraries
- IRC: #emscripten on irc.mozilla.org
- Mailing list: emscripten-discuss
- Unofficial Google+ page
You can file issues here on GitHub. If relevant, please supply the original source, the generated .ll, and the generated .js files (in a gist, pastebin, or any other method). It's very helpful to compile with EMCC_DEBUG=1
in the environment, and grab the /tmp/emscripten_temp/emcc-*
files (note - you should empty that directory manually before, so it only contains new content), that will include the bytecode, ll, and JS in several stages.
With the new fastcomp LLVM-Backend, emscripten now has three repos: this one for emscripten, one for emscripten's LLVM fork and one for emscripten's clang fork. In general, please file bugs here unless you are sure the bug is specific to one of those. Pull requests of course go to the proper repo.
Anyone is welcome to help with Emscripten development. Feel free to get in touch with other community members on IRC or on the mailing list (links above), or through issues here on GitHub.
If you find Emscripten useful and want to help out, a good starting point is to look through the issue tracker here: many issues can be resolved without an in-depth knowledge of compiler internals. And when you help out with those, it leaves more time for the developers that do work on compiler internals to do compiler internal-ey stuff :) so everyone benefits. Also, helping out with issues is a good way to learn more about the project.
If you work on Emscripten itself, check out the Developer's Guide.
Patches should be submitted as pull requests. When submitting patches, please:
- Add yourself to the AUTHORS file (if you aren't already there). By adding yourself, you agree to license your code under the project's open source licenses (MIT/LLVM).
- You should run all the automatic tests and make sure they pass (python tests/runner.py). Patches that are simple enough (for example, just add library functions that were not used before) might not need this, but most will. Please mention in the pull request or issue which tests you ran.
- Please make your pull request to incoming, not master. Code in incoming will have tests run on it, and will later merge to master when they all pass.
- If you add any new functionality or fix an existing bug, add an automatic test to tests/runner.py.
- Please do not include merge commits in pull requests; include only commits with the new relevant code.
Current status: In general, kripken should review pull requests before merging. Exceptions are subprojects that are 'owned' by other people (so they should just push to incoming directly):
- OpenAL and audio in general: @ehsan
- embind: @imvu
- Windows stuff: @juj
- master - Always safe to pull from, the test suite always passes on it
- incoming - Where new code lands before tests have been done
- llvmsvn - Where work to support a new version of LLVM lands. Activity typically begins near the end of an LLVM 6-month dev cycle. When LLVM launches the new version, we merge this branch to master and incoming, at which point our support officially moves to that new LLVM version (we only support one at a time)
Emscripten contains a built-in unit testing facility. A server farm performs continuous testing on the codebase on Windows 8, Ubuntu 12.10 and Mac OSX 10.7.4 systems. See the latest build results in real-time at Emscripten buildbot page. The following targets exist:
- incoming branch: win-emcc-incoming-tests, ubuntu-emcc-incoming-tests, osx-emcc-incoming-tests.
- master branch: win-emcc-master-tests, ubuntu-emcc-master-tests, osx-emcc-master-tests.
- The target win-emcc-incoming-code-test tests the compilation and deployment of a few simple WebGL applications.
The unit tests are run immediately after a commit occurs on incoming or master branches. Reports are logged live to IRC at #emscripten on the Mozilla network.
The OSX and Ubuntu buildbots also run the Emscripten benchmarks after the unit tests (The benchmarks are not supported on Windows at the moment, #729).
Not all tests necessarily pass on all platforms even if the buildbots report "green" status. Some long-standing failing tests have been disabled to be able to focus on new regressions better. To track the current state of recognized failing tests, see the Emscripten bug tracker with label tests.
README.md ``