Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

Emscripten On OSX

Emscripten On OSX

staunsholm
Mikkel Staunsholm · · 1 min read
3,750 0
Did you see that the Epic Citadel demo now runs at full speed under Chrome as well (http://www.unrealengine.com/html5/)?

This got me curious about emscripten once again, and so I set it up on my mac. Actually very straight forward, but not a one-liner:

  1. install brew if you don't have it (if you're using macports, then you are on your own :-)
  2. always good to update brew: brew update && brew outdated


  3. [font=arial][background=transparent]brew install node spidermonkey closure-compiler yuicompressor[/background][/font]


    1. [font=arial][background=transparent]?[/background][background=transparent]Of course, you can leave out any you already have installed (fx. I already had node and closure-compiler)[/background][/font]



  4. [font=arial][background=transparent]brew install llvm --with-clang[/background][/font]
  5. brew tap homebrew/versions
  6. brew install llvm33
  7. create symlinks to llvm33:

    1. cd /usr/bin
    2. sudo ln /usr/local/Cellar/llvm33/3.3/bin/opt-3.3 opt
    3. sudo ln /usr/local/Cellar/llvm33/3.3/bin/llvm-as-3.3 llvm-as
    4. sudo ln /usr/local/Cellar/llvm33/3.3/bin/llvm-dis-3.3 llvm-dis
    5. sudo ln /usr/local/Cellar/llvm33/3.3/bin/llvm-nm-3.3 llvm-nm
    6. sudo ln /usr/local/Cellar/llvm33/3.3/bin/lli-3.3 lli
    7. sudo ln /usr/local/Cellar/llvm33/3.3/bin/llvm-link-3.3 llvm-link
    8. sudo ln /usr/local/Cellar/llvm33/3.3/bin/llvm-ar-3.3 llvm-ar
    9. sudo ln opt /usr/local/Cellar/llvm33/3.3/bin/ocpt-3.3
    10. (you get the idea, basically emscripten will tell you if you forgot one)

  8. setup Python:

    1. cd /usr/bin
    2. sudo ln python python2
    3. sudo ln ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 python22.7

  9. setup emscripten:

    1. cd ~
    2. git clone https://github.com/kripken/emscripten.git
    3. cd emscripten
    4. ./em++ --help

  10. try it out:

    1. ./emcc tests/hello_world_gles.c -o hello_world_gles.html
    2. open hello_world_gles.html


When the browser open the html file, it should display this scene:


And it is only 200k of js! Amazing :-P

Mkkl.

PS! I don't have access to IE11 yet, exciting times if it actually works!

Discussion

Loading comments...