-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Emscripten is an LLVM to JavaScript compiler. It takes LLVM bitcode (which can be generated from C/C++ using Clang, or any other language that can be converted into LLVM bitcode) 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
Ready to get started? Check out the Tutorial!
- Unreal Engine 3 ported to JavaScript+WebGL in just 4 days. [Video] (http://www.youtube.com/watch?v=XsyogXtyU9o) (live link to demo will hopefully be available soon).
- Unreal 3 Engine - link to actual demo coming soon.
- Nebula3 - The Nebula3 engine
- Bullet - The Bullet physics engine compiled to JavaScript with convenient automatically-generated bindings (through ammo.js)
- UNIGINE - Port of the UNIGINE game engine by ACTISKU
- BananaBread - Port of Sauerbraten/Cube 2. Project page here.
- 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
- JS-VBA-M - Port of VBA-M. by ILOVEPIE
- 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. (Text-based - a rich web UI version is being worked on).
- Qt - Ports of various Qt demos. new!
- OpenSCAD - Solid 3D CAD Modeller new!
- 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.
- OpenJPEG - JPEG 2000 decoding in JavaScript, using OpenJPEG (see also j2k.js)
- FreeType - TrueType font rendering in JavaScript, using FreeType
- Dao - Port of the Dao language new!
- 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.
- Lua - The Lua interpreter
- 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
- 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
- Tutorial - How to get started with Emscripten: Installing and setting up, basic commands, and so forth. Start with this!
- VM for easy emscripten setup (thanks rhelmer!)
- EC2 AMI for emscripten
- Using Emscripten from Visual Studio 2010
- Getting Started on Mac OS X
- Getting Started on Ubuntu 12.10
- 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
- Technical Paper - A detailed writeup about how Emscripten works (the memory model, Relooper algorithm, etc.).
- Talks - Talks 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.
- Compressing Downloads: How to compress your compiled code and data to minimize download time.
- Debugging: Check here if things go wrong.
- EGL support in Emscripten
- 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 bitcode, ll, and JS in several stages.
Anyone is welcome to join us in developing Emscripten. Feel free to contact us on IRC or on the mailing list (links above), or through issues here on GitHub.
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
Cinder (libcinder.org) - Forum Post
- 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.