ARM compiled SDL library. Just decompress it to a directory you can find. I suggest ~user/dev because I like to put all my dev work in the dev directory.
This is based on the 1.2.11 source. They're up to 1.2.14 now, but it shouldn't make much difference. Writing an app is "simple": in your makefile, point your include variable at the include directory and your lib variable at the lib directory. Actually writing your programs is the exact same. Your makefile might look something like so:
Code:
# Setup SDL library, change SDL_DIR to wherever you copy it
ifeq ($(PLATFORM),PANDORA)
SDL_DIR = ~user/dev/sdl4arm
else
SDL_DIR = /usr
endif
SDL_CFLAGS := -I$(SDL_DIR)/include -D_GNU_SOURCE=1 -D_REENTRANT
SDL_LFLAGS := -L$(SDL_DIR)/lib -Wl,-rpath,/usr/lib -lSDL -lpthread
# Cross compiler, change TOOLSHOME to wherever you've installed one of the myriad of cross compilers, and CC/CXX to the actual binary names
ifeq ($(PLATFORM),PANDORA)
TOOLSHOME=~user/oe/tmp/cross/armv7a/bin
CC = $(TOOLSHOME)/arm-angstrom-linux-gnueabi-gcc
CXX = $(TOOLSHOME)/arm-angstrom-linux-gnueabi-g++
else
CC = gcc
CXX = g++
endif
# Standard flags and stuff, don't mess with unless you know what they mean
WARN = -Wall -W -Wshadow -Wpointer-arith \
-Wbad-function-cast -Wcast-qual
WARNXX = -Wall -W -Wshadow -Wpointer-arith -Wcast-qual
ifeq($(PLATFORM),PANDORA)
DEF_FLAGS = -DPANDORA
else
DEF_FLAGS = -DDESKTOP
endif
OPT_FLAGS = -O2
CFLAGS = $(OPT_FLAGS) $(WARN) -I. $(DEF_FLAGS) $(EXTRA)
CXXFLAGS = $(OPT_FLAGS) $(WARNXX) -I. $(DEF_FLAGS) $(EXTRA)
LFLAGS = -lpthread
CFLAGS += $(SDL_CFLAGS)
LFLAGS += $(SDL_LFLAGS)
# Stuff to build here
OBJS=myprog.o extrafile.o datafiles.o
ifeq($(PLATFORM),PANDORA)
PROG=myprog.pandora
else
PROG=myprog
endif
TOCLEAN=$(PROG)
# And finally the instructions that actually build stuff
all: $(OBJS) $(PROG)
$(PROG): $(OBJS)
$(CC) -o $(PROG) $(OBJS) $(CFLAGS) $(LFLAGS)
clean:
$(RM) $(OBJS)
$(RM) $(TOCLEAN)
%.o: %.c
$(CC) -o $@ $(CFLAGS) -c $<
And that should do it. Write your .c files, type "make", and let it do its magic. Outputs the file myprog.pandora, given that extension only so I can differentiate it from the PC version.
Speaking of PC version, if you want to build your app for a desktop instead of Pandora, change SDL_DIR to wherever the SDL library is installed on your PC (usually /usr) and set CC and CXX to the regular gcc and g++ respectively. ie:
Code:
SDL_DIR=/usr
CC=gcc
CXX=g++
DEF_FLAGS=
PROG=myprog
# note I removed the extension
Type "make clean && make" and it compiles into x86 code. Need to clean first, otherwise it will just try to rebuild using the ARM object files, and that won't work.
Note that I set DEF_FLAGS to set PANDORA for the Pandora file, but removed it for the PC file. You can then check for that inside of your program by "#ifdef PANDORA .... #endif" in case there's any Pandora specific stuff you want to do (screen resolution for example).
One final caveat. In the VERY limited experience I had with a Pandora (ie, a bunch of binaries I sent to Pickle once), the only graphic init call that worked was 800x480 fullscreen. No other resolution (and especially not Windowed) seemed to work, thought I may have been doing it wrong. It will need more experimentation.
And there you have it. Write your programs exactly as you would on your PC, even test them on your PC, and when you're ready to rebuild it for the Pandora, unpack the tar.gz file like I said, update your Makefile accordingly, and rebuild. The truly clever can even mount their Pandora as an external hard drive and copy the binary onto it as the last step in the Makefile, so you just "make", pick up your Pandora, and play
edit: NEW AND IMPROVED MAKEFILE!
call "make" and it will build the PC version. Call as "make PLATFORM=PANDORA" and it will build the Pandora version. Don't forget to clean between the two.
Further improvements could be to stick the .o files into different directories depending on the platform so you don't need to clean between making the PC and Pandora version, but I'm too lazy for that. A better improvement would have put all the PANDORA specific stuff in one place, rather than calling ifeq four times, but again, lazy.