Compiling ticpp for psp

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
sionlord
Posts: 3
Joined: Tue Mar 09, 2010 7:39 am

Compiling ticpp for psp

Post by sionlord »

Hi!

I would like to develop a PC-PSP portable game using basically C++ and SDL. The thing is that I'm also interested on a very useful library called ticpp which helps in parsing XML files. Obviously it compiles normally as static library for Linux or Windows but I can't write a proper makefile for PSP. I supose I have to change the compiler macro and a few things more but I just can't.

I hope someone here have more experiencing in writting correct makefiles for psp.

Ticpp official site: http://code.google.com/p/ticpp/
Building instructions for Linux and Windows: http://code.google.com/p/ticpp/wiki/BuildInstructions

Thank you very much!
psPea
Posts: 60
Joined: Sat Sep 01, 2007 12:51 pm

Post by psPea »

I tried a generic makefile and it compiled

Code: Select all

TARGET_LIB = ticpp.a
OBJS = ticpp.o \
       tinystr.o \
       tinyxml.o \
       tinyxmlerror.o \
       tinyxmlparser.o

INCDIR =
CFLAGS = -O2 -G0 -Wall -g
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR =
LDFLAGS =
LIBS = -lstdc++


PSPDIR=$(shell psp-config --psp-prefix)
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
sionlord
Posts: 3
Joined: Tue Mar 09, 2010 7:39 am

Post by sionlord »

Thanks, it compiled but now I have another problem: how can I write a makefile of a program which uses ticpp.a? How can I link the static library in a psp makefile?

Could someone help me please, I'm kind of a newbie with makefiles in general and psp ones in particular.

Thanks again.
NoEffex
Posts: 106
Joined: Thu Nov 27, 2008 6:48 am

Post by NoEffex »

sionlord wrote:Thanks, it compiled but now I have another problem: how can I write a makefile of a program which uses ticpp.a? How can I link the static library in a psp makefile?

Could someone help me please, I'm kind of a newbie with makefiles in general and psp ones in particular.

Thanks again.
CFLAGS += -L./folder_with_ticpp.a
LIBS += -lticpp.a

Something like that. If it doesn't work, rename ticpp.a to libticpp.a, and possibly remove .a.
Programming with:
Geany + Latest PSPSDK from svn
sionlord
Posts: 3
Joined: Tue Mar 09, 2010 7:39 am

Post by sionlord »

A normal makefile for a SDL game and ticpp would look like:

Code: Select all

# Rutas
MOTOR_DIR := .

# Ejecutable del juego.
EXE := sdltest
EXEWIN := airforcepilotwin.exe

# Ficheros fuente del juego (modificar para añadir) .
SRC := main.cpp

# Ficheros fuente del motor.
SRC_MOTOR := 
		
		
# motor_dir + fuentes
SRC_DIR_MOTOR := $(foreach src, $(SRC_MOTOR),$(MOTOR_DIR)/$(src) )

# Objetos
OBJS := $(SRC:%.cpp=%.o)
OBJS_MOTOR := $(SRC_DIR_MOTOR:%.cpp=%.o)

# Compilador y las opciones 
CXX = c++ 
CXXFLAGS = -pedantic -Wall -pipe -ggdb -D"TIXML_USE_TICPP" -I$(MOTOR_DIR)
LDFLAGS = -L$(MOTOR_DIR)/ticpp -lticpp -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf -ggdb
LDWINFLAGS = -L$(MOTOR_DIR)/ticpp -lticppwin -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_mixer -lSDL_ttf

# Config para make
all: $(EXE)
win32: $(EXEWIN)

# Obtención del ejecutable 
$(EXE): $(OBJS) $(OBJS_MOTOR)
	$(CXX) -o $@ $^ $(LDFLAGS)

$(EXEWIN): $(OBJS) $(OBJS_MOTOR)
	$(CXX) -o $@ $^ $(LDWINFLAGS)


# Limpieza
clean: 
	 $(RM) $(EXE) $(OBJS) $(OBJS_MOTOR) *~ -rf

clean-win32:
	del $(EXEWIN) *.o .\motor\*.o *~
While my psp makefile looks like:

Code: Select all

TARGET = Sdl_Example
PSPSDK = $(shell psp-config --pspsdk-path)
PSPBIN = $(shell psp-config --psp-prefix)/bin
SDL_CONFIG = $(PSPBIN)/sdl-config
OBJS =  main.o

DEFAULT_CFLAGS = $(shell $(SDL_CONFIG) --cflags)

MORE_CFLAGS = -G0 -O2 -DPSP 

CFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS) -D"TIXML_USE_TICPP" -I$(MOTOR_DIR)
CXXFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS) -fno-exceptions -fno-rtti

LIBS = -lSDL_gfx -lSDL_image -lSDL_mixer -lSDL_ttf -lvorbisidec \
	-lfreetype -lpng -ljpeg -lz -lm $(shell $(SDL_CONFIG) --libs) -L$(MOTOR_DIR)/ticpp -lticpp

EXTRA_TARGETS = EBOOT.PBP

include $(PSPSDK)/lib/build.mak
There is a ticpp.a file inside a ticpp folder compiled for the proper platform.

Still isn't working, hope you could help me having now this info.

Thanks again.
Post Reply