Okay, there’s a whole new batch of Win32 cross-compilers available:
http://www.devolution.com/~slouken/SDL/Xmingw32/
including a working native Windows NT compiler!
Also, the latest CVS snapshot of SDL is updated for DirectX 6.0
Here’s some documentation, written by popular demand.
---- README.Win32 -----==============================================================================
Using the Simple DirectMedia Layer with Windows 95,NT
==============================================================================
I. Building the Simple DirectMedia Layer libraries:
(This step isn’t necessary if you have the SDL binary distribution)
First, get an EGCS-based compiler for Win32, which can be found at:
http://www.devolution.com/~slouken/SDL/Xmingw32/index.html
If you want to build the DirectX version of the SDL dynamic link library,
you’ll need to get the DirectX 6.0 header files from Microsoft:
http://www.microsoft.com/directx/download.asp
-
You’ll have to download the SDK, unpack it, and copy the header files
from \dx6sdk\include\ to ./directx/include/ – from your Windows drive
to SDL source directory. Be sure to run the ./directx/utils/fixdirectx.sh
script so the headers are usable by the EGCS compiler. -
The fixdirectx.sh script requires perl. If you are using the native
WinNT EGCS compiler, you may want to get Perl for Win32 or fix the
headers on a UNIX system and copy them over to the SDL source directory.
Note that even though SDL uses DirectX 6.0 headers, programs built with
it will run on systems with DirectX 5.0 or better.
I’m not allowed to distribute the DirectX headers myself. If you don’t
have them, you can still use the pre-built SDL library binaries, or build
a slower version of SDL which doesn’t use DirectX.
Once you have the compiler, and copied the DirectX headers if you want them,
you are ready to build SDL for Win32. Make sure the EGCS compiler is in
your PATH, and then:
make win32; make
If everything compiles successfully, you now have the EGCS archive library
libSDL.a and the windows dynamic link libraries in ./lib
==============================================================================
II. Building the Simple DirectMedia Layer test programs:
This is easy once you have built the libraries:
cd test; make
==============================================================================
III. Building the Simple DirectMedia Layer demo programs:
Go to the directory containing the demo you want to build and type:
make all target=win32
Common problems:
1. The compiler complains about including <windows.h>
- You need to have the Win32 compiler in your execution path.
2. ‘make’ complains about Makefile syntax or missing separators
- You need GNU make, from ftp://ftp.gnu.ai.mit.edu/pub/gnu/
==============================================================================
IV. Building your own Simple DirectMedia Layer demo programs:
Let’s say you already have the SDL libraries, have played with the source,
and want to write a new demo called “powerSDL”.
-
Create a new directory in SDL-demos with the name of your project,
for example “powerSDL”. -
Go to your new directory and create a file called “Makefile” that
looks something like this:
#######
Makefile for powerSDL
TARGET = powerSDL
include …/GNUmake
$(TARGET): powerSDL.o
#######
-
Now, create a file called powerSDL.c which contains the source code
to your program. -
Just type ‘make’ and watch for errors.
-
If your program was successfully compiled, you can now copy powerSDL.exe
and the SDL libraries (SDL-dib.dll and SDL-dx5.dll) to a PC running
Windows and try them out. -
Debugging your program is very tricky under Windows. Your best bet at
getting your program working is to develop it under Linux, and then
using “fprintf(stderr, …)” to fix any quirks your program has in
Windows. Note: This may change if VC++ or BC++ can compile SDL.
==============================================================================
V. Enjoy!
If you have a project you’d like me to know about, or want to ask questions,
go ahead and join the SDL developer’s mailing list by sending e-mail to:
sdl-subscribe at surfnetcity.com.au
==============================================================================