docs/README-emscripten.md
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Wed, 17 Aug 2016 21:04:50 +0200
changeset 10275 ba7dc3ebb81e
parent 9782 fcf237e5e834
permissions -rw-r--r--
Emscripten: Fixed opening previously closed joystick.
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
9782
fcf237e5e834 Emscripten: Corrected build instructions in documentation.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9302
diff changeset
     6
    $ mkdir build
fcf237e5e834 Emscripten: Corrected build instructions in documentation.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9302
diff changeset
     7
    $ cd build
fcf237e5e834 Emscripten: Corrected build instructions in documentation.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9302
diff changeset
     8
    $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2"
9302
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
     9
    $ emmake make
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
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
    12
9782
fcf237e5e834 Emscripten: Corrected build instructions in documentation.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9302
diff changeset
    13
    $ mkdir build
fcf237e5e834 Emscripten: Corrected build instructions in documentation.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9302
diff changeset
    14
    $ cd build
fcf237e5e834 Emscripten: Corrected build instructions in documentation.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9302
diff changeset
    15
    $ emcmake cmake ..
fcf237e5e834 Emscripten: Corrected build instructions in documentation.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9302
diff changeset
    16
    $ emmake make
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
9293
d0667f0e808a Fixed typos in a README.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
    18
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
    19
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
    20
    $ cd test/
2ddb65f75084 Linked README-emscripten.md in README.md and added markdown formatting.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9301
diff changeset
    21
    $ 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
    22
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
Uses GLES2 renderer or software
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
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
    26
9293
d0667f0e808a Fixed typos in a README.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9278
diff changeset
    27
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
    28
9782
fcf237e5e834 Emscripten: Corrected build instructions in documentation.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 9302
diff changeset
    29
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
    30
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
    $ EMCONFIGURE_JS=1 emconfigure ../configure
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
    build as usual...
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    33
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    34
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
    35
9278
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
    $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx
8900afb78a19 Initial merge of Emscripten port!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    37
    build as usual...