docs/README-porting.md
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Sat, 25 Jun 2016 19:40:02 +0200
changeset 10184 cb09212d4480
parent 10153 2abd425e41dc
child 10941 e42332dd9f4e
permissions -rw-r--r--
Mac: Updated file name in README.
philipp@10153
     1
Porting
philipp@10153
     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.
philipp@10153
     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@10153
    18
philipp@9316
    19
	"Set up the configuration based on the host platform!"
philipp@10153
    20
gabomdq@9023
    21
   Add a section for your platform, and then re-run autogen.sh and build!
gabomdq@9023
    22
gabomdq@9023
    23
2. Using an IDE:
gabomdq@9023
    24
gabomdq@9023
    25
   If you're using an IDE or other non-configure build system, you'll probably
gabomdq@9023
    26
   want to create a custom SDL_config.h for your platform.  Edit SDL_config.h,
gabomdq@9023
    27
   add a section for your platform, and create a custom SDL_config_{platform}.h,
gabomdq@9023
    28
   based on SDL_config.h.minimal and SDL_config.h.in
gabomdq@9023
    29
gabomdq@9023
    30
   Add the top level include directory to the header search path, and then add
gabomdq@9023
    31
   the following sources to the project:
philipp@10153
    32
gabomdq@9023
    33
	src/*.c
gabomdq@9023
    34
	src/atomic/*.c
gabomdq@9023
    35
	src/audio/*.c
gabomdq@9023
    36
	src/cpuinfo/*.c
gabomdq@9023
    37
	src/events/*.c
gabomdq@9023
    38
	src/file/*.c
gabomdq@9023
    39
	src/haptic/*.c
gabomdq@9023
    40
	src/joystick/*.c
gabomdq@9023
    41
	src/power/*.c
gabomdq@9023
    42
	src/render/*.c
gabomdq@9023
    43
	src/stdlib/*.c
gabomdq@9023
    44
	src/thread/*.c
gabomdq@9023
    45
	src/timer/*.c
gabomdq@9023
    46
	src/video/*.c
gabomdq@9023
    47
	src/audio/disk/*.c
gabomdq@9023
    48
	src/audio/dummy/*.c
philipp@9824
    49
	src/filesystem/dummy/*.c
gabomdq@9023
    50
	src/video/dummy/*.c
gabomdq@9023
    51
	src/haptic/dummy/*.c
gabomdq@9023
    52
	src/joystick/dummy/*.c
gabomdq@9023
    53
	src/main/dummy/*.c
gabomdq@9023
    54
	src/thread/generic/*.c
gabomdq@9023
    55
	src/timer/dummy/*.c
gabomdq@9023
    56
	src/loadso/dummy/*.c
gabomdq@9023
    57
gabomdq@9023
    58
gabomdq@9023
    59
Once you have a working library without any drivers, you can go back to each
gabomdq@9023
    60
of the major subsystems and start implementing drivers for your platform.
gabomdq@9023
    61
gabomdq@9023
    62
If you have any questions, don't hesitate to ask on the SDL mailing list:
gabomdq@9023
    63
	http://www.libsdl.org/mailing-list.php
gabomdq@9023
    64
gabomdq@9023
    65
Enjoy!
gabomdq@9023
    66
	Sam Lantinga				(slouken@libsdl.org)
gabomdq@9023
    67