< index
< 0. Compiling with libtcod

=====================================
0.6 GCC on MacOSX
=====================================

To compile the samples under OSX, use 'make -f makefile-samples-osx all'. For your own application, modify the makefile to include your c/cpp source files, and create a new executable target. For example, if your application is called 'MyRoguelike', and uses source files src1.c, src2.c and src3.c, you would add the following lines to the end of makefile-samples-osx.

MY_OBJS=$(TEMP)/src1.o $(TEMP)/src2.o $(TEMP)/src3.o
myroguelike : $(MY_OBJS) libtcod.a
	$(CC) $(MY_OBJS) $(CFLAGS) -o $@ -L. -ltcod $(ZLIB_LIBS) $(PNG_LIBS) $(SDL_LIBS)

Build using 'make -f makefile-samples-osx myroguelike' to get a command-line build of your application. To create a double-clickable application, create a new Info.plist file for your binary (see the osx directory for examples), and add the following to the makefile:

myroguelike.app : myroguelike
	mkdir -p myroguelike.app/Contents/MacOS
	cp osx/myroguelike_Info.plist myroguelike.app/Contents/Info.plist
	cp myroguelike myroguelike.app/Contents/MacOS/

Build using 'make -f makefile-samples-osx myroguelike.app', and you should have a self-contained application bundle that will work on any OSX system.

Important Note: If you need to access system information (resolution etc) via SDL before you call TCOD_sys_init(), you must explicitly call TCOD_sys_startup(), using code similar to the following:

#ifdef __APPLE__
TCOD_sys_startup();
#endif
//access system info....
bool success = TCOD_sys_init(....


insert a comment