Setting up a development environment (Mac)

From wiki.gp2x.org

Jump to: navigation, search

Currently, only one toolkit for the GP2x is available for Mac OSX, devkitGP2X (though Open2x may work either natively or through Fink, it is currently untested).

Download the pre-built devkitGP2X for Mac from the archive (direct link) and it should mount and install by itself.

The toolkit should now work.

To be safe, you should add '/opt/local/devkitpro/devkitGP2X/bin/' to your path.


Developing using SDL

If you want to develop using SDL, then you'll need to install the ARM SDL libraries too. They extract into /opt.

Here is a sample makefile that will build an SDL program called "helloworld.c" into "helloworld.gpe":

CROSS_COMPILE=/opt/local/devkitpro/devkitGP2X/bin/arm-linux-
SDL_BASE=/opt/local/gp2x/bin/arm-open2x-linux-
LDFLAGS=-static

CC=$(CROSS_COMPILE)gcc
CXX=$(CROSS_COMPILE)g++
STRIP=$(CROSS_COMPILE)strip

CFLAGS=`$(SDL_BASE)sdl-config --cflags` -O2 -Wall -Werror
CXXFLAGS=`$(SDL_BASE)sdl-config --cflags` -O2 -Wall -Werror
LIBS=`$(SDL_BASE)sdl-config --libs`

TARGET=helloworld.gpe
OBJS=helloworld.c

ALL_TARGETS=$(TARGET)

all: $(ALL_TARGETS)


$(TARGET): $(OBJS)
	$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS) $(CFLAGS)
	$(STRIP) $(TARGET)

clean:
	rm *.o $(TARGET)
Personal tools
Buy GP2X and accessories