docs/README-emscripten.md
author Ryan C. Gordon <icculus@icculus.org>
Mon, 20 Apr 2015 12:22:44 -0400
changeset 9566 7454bfce9202
parent 9302 2ddb65f75084
child 9782 fcf237e5e834
permissions -rw-r--r--
Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9302
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
     1
Emscripten
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
     2
================================================================================
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
     3
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
Build:
9302
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
     5
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
     6
    $ emconfigure ./configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2"
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
     7
    $ emmake make
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
Or with cmake:
9302
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
    10
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
    11
    $ emconfigure cmake ..
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
    12
    $ make
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
9293
d0667f0e808a Fixed typos in a README.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
    14
To build one of the tests:
9302
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
    15
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
    16
    $ cd test/
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
    17
    $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
Uses GLES2 renderer or software
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
tests: https://dl.dropboxusercontent.com/u/17360362/SDL2-em/index.html
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
9293
d0667f0e808a Fixed typos in a README.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
    23
Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere):
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/)
9302
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
    26
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
    $ EMCONFIGURE_JS=1 emconfigure ../configure
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
    build as usual...
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx):
9302
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
    31
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
    $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
    build as usual...