README-nacl.txt
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Sun, 08 Jun 2014 12:51:02 +0200
changeset 8844 d35c1b1798c8
parent 8833 ae720d61d14d
child 8851 a7cfe554d337
permissions -rw-r--r--
Fixed typo in source comment.
gabomdq@8833
     1
================================================================================
gabomdq@8833
     2
Simple DirectMedia Layer for Native Client
gabomdq@8833
     3
================================================================================
gabomdq@8833
     4
gabomdq@8833
     5
Requirements: 
gabomdq@8833
     6
    
gabomdq@8833
     7
    * Native Client SDK (https://developer.chrome.com/native-client), 
gabomdq@8833
     8
      (tested with Pepper version 33 or higher).
gabomdq@8833
     9
gabomdq@8833
    10
The SDL backend for Chrome's Native Client has been tested only with the PNaCl
gabomdq@8833
    11
toolchain, which generates binaries designed to run on ARM and x86_32/64 
gabomdq@8833
    12
platforms. This does not mean it won't work with the other toolchains!
gabomdq@8833
    13
gabomdq@8833
    14
================================================================================
gabomdq@8833
    15
Building SDL for NaCl
gabomdq@8833
    16
================================================================================
gabomdq@8833
    17
gabomdq@8833
    18
Set up the right environment variables (see naclbuild.sh), then configure SDL with:
gabomdq@8833
    19
gabomdq@8833
    20
    configure --host=pnacl --prefix some/install/destination
gabomdq@8833
    21
    
gabomdq@8833
    22
Then "make". 
gabomdq@8833
    23
gabomdq@8833
    24
As an example of how to create a deployable app a Makefile project is provided 
gabomdq@8833
    25
in test/nacl/Makefile, which includes some monkey patching of the common.mk file 
gabomdq@8833
    26
provided by NaCl, without which linking properly to SDL won't work (the search 
gabomdq@8833
    27
path can't be modified externally, so the linker won't find SDL's binaries unless 
gabomdq@8833
    28
you dump them into the SDK path, which is inconvenient).
gabomdq@8833
    29
Also provided in test/nacl is the required support file, such as index.html, 
gabomdq@8833
    30
manifest.json, etc.
gabomdq@8833
    31
gabomdq@8833
    32
gabomdq@8833
    33
================================================================================
gabomdq@8833
    34
Running tests
gabomdq@8833
    35
================================================================================
gabomdq@8833
    36
gabomdq@8833
    37
Due to the nature of NaCl programs, building and running SDL tests is not as
gabomdq@8833
    38
straightforward as one would hope. The script naclbuild.sh in build-scripts 
gabomdq@8833
    39
automates the process and should serve as a guide for users of SDL trying to build 
gabomdq@8833
    40
their own applications.
gabomdq@8833
    41
gabomdq@8833
    42
Basic usage:
gabomdq@8833
    43
    
gabomdq@8833
    44
    ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
gabomdq@8833
    45
    
gabomdq@8833
    46
This will build testgles2.c by default.
gabomdq@8833
    47
gabomdq@8833
    48
If you want to build a different test, for example testrendercopyex.c:
gabomdq@8833
    49
    
gabomdq@8833
    50
    SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
gabomdq@8833
    51
    
gabomdq@8833
    52
Once the build finishes, you have to serve the contents with a web server (the
gabomdq@8833
    53
script will give you instructions on how to do that with Python).
gabomdq@8833
    54
gabomdq@8833
    55
================================================================================
gabomdq@8833
    56
TODO - Known Issues
gabomdq@8833
    57
================================================================================
gabomdq@8833
    58
* Audio backend is not usable yet.
gabomdq@8833
    59
* Testing of all systems with a real application (something other than SDL's tests)
gabomdq@8833
    60