docs/README-emscripten.md
author Ryan C. Gordon <icculus@icculus.org>
Mon, 05 Jan 2015 01:41:42 -0500
changeset 9306 817656bd36ec
parent 9302 2ddb65f75084
child 9782 fcf237e5e834
permissions -rw-r--r--
Clang static analysis builds should use C runtime directly.

This is a little macro magic to use malloc() directly instead of SDL_malloc(),
etc, so static analysis tests that know about the C runtime can function
properly, and understand that we are dealing with heap allocations, etc.

This changed our static analysis report from 5 outstanding bugs to 30.

5x as many bugs were hidden by SDL_malloc() not being recognized as malloc()
by the static analyzer!
     1 Emscripten
     2 ================================================================================
     3 
     4 Build:
     5 
     6     $ emconfigure ./configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2"
     7     $ emmake make
     8 
     9 Or with cmake:
    10 
    11     $ emconfigure cmake ..
    12     $ make
    13 
    14 To build one of the tests:
    15 
    16     $ cd test/
    17     $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
    18 
    19 Uses GLES2 renderer or software
    20 
    21 tests: https://dl.dropboxusercontent.com/u/17360362/SDL2-em/index.html
    22 
    23 Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere):
    24 
    25 SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/)
    26 
    27     $ EMCONFIGURE_JS=1 emconfigure ../configure
    28     build as usual...
    29 
    30 SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx):
    31 
    32     $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx
    33     build as usual...