docs/README-porting.md
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Sun, 15 Mar 2015 19:25:10 +0100
changeset 9383 62164ad0b7d5
parent 9316 f4d22285caec
child 9824 d5a7d25c5b22
permissions -rw-r--r--
Updated name of assert type in test program.
gabomdq@9023
     1
Porting
gabomdq@9023
     2
=======
gabomdq@9023
     3
gabomdq@9023
     4
* Porting To A New Platform
gabomdq@9023
     5
gabomdq@9023
     6
  The first thing you have to do when porting to a new platform, is look at
gabomdq@9023
     7
include/SDL_platform.h and create an entry there for your operating system.
gabomdq@9023
     8
The standard format is __PLATFORM__, where PLATFORM is the name of the OS.
gabomdq@9023
     9
Ideally SDL_platform.h will be able to auto-detect the system it's building
gabomdq@9023
    10
on based on C preprocessor symbols.
gabomdq@9023
    11
gabomdq@9023
    12
There are two basic ways of building SDL at the moment:
gabomdq@9023
    13
gabomdq@9023
    14
1. The "UNIX" way:  ./configure; make; make install
gabomdq@9023
    15
gabomdq@9023
    16
   If you have a GNUish system, then you might try this.  Edit configure.in,
gabomdq@9023
    17
   take a look at the large section labelled:
philipp@9316
    18
	"Set up the configuration based on the host platform!"
gabomdq@9023
    19
   Add a section for your platform, and then re-run autogen.sh and build!
gabomdq@9023
    20
gabomdq@9023
    21
2. Using an IDE:
gabomdq@9023
    22
gabomdq@9023
    23
   If you're using an IDE or other non-configure build system, you'll probably
gabomdq@9023
    24
   want to create a custom SDL_config.h for your platform.  Edit SDL_config.h,
gabomdq@9023
    25
   add a section for your platform, and create a custom SDL_config_{platform}.h,
gabomdq@9023
    26
   based on SDL_config.h.minimal and SDL_config.h.in
gabomdq@9023
    27
gabomdq@9023
    28
   Add the top level include directory to the header search path, and then add
gabomdq@9023
    29
   the following sources to the project:
gabomdq@9023
    30
	src/*.c
gabomdq@9023
    31
	src/atomic/*.c
gabomdq@9023
    32
	src/audio/*.c
gabomdq@9023
    33
	src/cpuinfo/*.c
gabomdq@9023
    34
	src/events/*.c
gabomdq@9023
    35
	src/file/*.c
gabomdq@9023
    36
	src/haptic/*.c
gabomdq@9023
    37
	src/joystick/*.c
gabomdq@9023
    38
	src/power/*.c
gabomdq@9023
    39
	src/render/*.c
gabomdq@9023
    40
	src/stdlib/*.c
gabomdq@9023
    41
	src/thread/*.c
gabomdq@9023
    42
	src/timer/*.c
gabomdq@9023
    43
	src/video/*.c
gabomdq@9023
    44
	src/audio/disk/*.c
gabomdq@9023
    45
	src/audio/dummy/*.c
gabomdq@9023
    46
	src/video/dummy/*.c
gabomdq@9023
    47
	src/haptic/dummy/*.c
gabomdq@9023
    48
	src/joystick/dummy/*.c
gabomdq@9023
    49
	src/main/dummy/*.c
gabomdq@9023
    50
	src/thread/generic/*.c
gabomdq@9023
    51
	src/timer/dummy/*.c
gabomdq@9023
    52
	src/loadso/dummy/*.c
gabomdq@9023
    53
gabomdq@9023
    54
gabomdq@9023
    55
Once you have a working library without any drivers, you can go back to each
gabomdq@9023
    56
of the major subsystems and start implementing drivers for your platform.
gabomdq@9023
    57
gabomdq@9023
    58
If you have any questions, don't hesitate to ask on the SDL mailing list:
gabomdq@9023
    59
	http://www.libsdl.org/mailing-list.php
gabomdq@9023
    60
gabomdq@9023
    61
Enjoy!
gabomdq@9023
    62
	Sam Lantinga				(slouken@libsdl.org)
gabomdq@9023
    63