author Sam Lantinga <>
Sun, 10 Jun 2001 18:20:23 +0000
changeset 53 25dfe480c75e
parent 47 45b1c4303f87
child 172 37e3ca9254c7
permissions -rw-r--r--
Added MacOS X Project Builder projects
     1 ==============================================================================
     2 Using the Simple DirectMedia Layer with Mac OS X
     3 ==============================================================================
     5 These instructions are for people using Apple's Mac OS X (pronounced
     6 "ten").
     8 From the developer's point of view, OS X is a sort of hybrid Mac and
     9 Unix system, and you have the option of using either traditional
    10 command line tools or Apple's IDE ProjectBuilder (PB).
    12 To build using the command line, use the standard configure and make
    13 process:
    15 	./configure
    16 	make
    17 	make install
    19 (You may need to create the subdirs of /usr/local manually.)
    21 For some reason, libtool doesn't run ranlib properly, so do this
    22 manually:
    24 	ranlib /usr/local/lib/libSDL.a
    26 To use the library once it's built, you need to use the "Carbon
    27 framework", which is the port of the old Mac Toolbox to OS X.
    28 To do this, use the -F and -framework arguments for compiling
    29 and linking, respectively:
    31 	cc -c myprog.c -I/usr/local/include/SDL -F/System/Library/Frameworks/Carbon.framework
    32 	cc myprog.o -L/usr/local/lib -lSDL -framework Carbon
    34 sdl-config knows about the linking path and -framework, so it's
    35 recommended to use it to fill in your Makefile variables.
    37 ==============================================================================
    38 Using the Simple DirectMedia Layer with Project Builder
    39 ==============================================================================
    41 These instructions are for using Apple's Project Builder IDE to build SDL applications.
    43 - First steps
    45 The first thing to do is to unpack the PBProjects.tar.gz archive in the
    46 top level SDL directory (where the PBProjects.tar.gz archive resides).
    47 Because Stuffit Expander will unpack the archive into a subdirectory,
    48 you should unpack the archive manually from the command line:
    49 	cd [path_to_SDL_source]
    50 	tar zxf PBProjects.tar.gz
    51 This will create a new folder called PBProjects, which you can browse
    52 normally from the Finder.
    54 - Building the Framework
    56 The SDL Library is packaged as a framework bundle, an organized
    57 relocatable folder heirarchy of executible code, interface headers, 
    58 and additional resources. For practical purposes, you can think of a 
    59 framework as a more user and system-friendly shared library, whose library
    60 file behaves more or less like a standard UNIX shared library.
    62 To build the framework, simply open the framework project and build it. 
    63 By default, the framework bundle "SDL.framework" is installed in 
    64 ~/Library/Frameworks. Therefore, the testers and project stationary expect
    65 it to be located there. However, it will function the same in any of the
    66 following locations:
    68     ~/Library/Frameworks
    69     /Local/Library/Frameworks
    70     /System/Library/Frameworks
    72 - Build Options
    73     There are two "Build Styles" (See the "Targets" tab) for SDL.
    74     "Deployment" should be used if you aren't tweaking the SDL library.
    75     "Development" should be used to debug SDL apps or the library itself.
    77 - Building the Testers
    78     Open the SDLTest project and build away!
    80 - Using the Project Stationary
    81     Copy the stationary to the indicated folders to access it from
    82     the "New Project" and "Add target" menus. What could be easier?
    84 - Setting up a new project by hand
    85     Some of you won't want to use the Stationary so I'll give some tips:
    86     * Create a new "Cocoa Application"
    87     * Add src/main/macosx/SDLMain.m , .h and .nib to your project
    88     * Remove "main.c" from your project
    89     * Remove "MainMenu.nib" from your project
    90     * Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
    91     * Add "$(HOME)/Library/Frameworks" to the frameworks search path
    92     * Add "-framework SDL" to the "OTHER_LDFLAGS" variable
    93     * Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
    94     * Add your files
    95     * Clean and build
    97 - Building from command line
    98     Use pbxbuild in the same directory as your .pbproj file
   100 - Running your app
   101     You can send command line args to your app by either invoking it from
   102     the command line (in *.app/Contents/MacOS) or by entering them in the
   103     "Executibles" panel of the target settings.
   105 - Implementation Notes
   106     Some things that may be of interest about how it all works...
   107     * Working directory
   108         As defined in the SDLMain.m file, the working directory of your SDL app
   109         is by default set to its parent. You may wish to change this to better
   110         suit your needs.
   111     * You have a Cocoa App!
   112         Your SDL app is essentially a Cocoa application. When your app
   113         starts up and the libraries finish loading, a Cocoa procedure is called,
   114         which sets up the working directory and calls your main() method.
   115         You are free to modify your Cocoa app with generally no consequence 
   116         to SDL. You cannot, however, easily change the SDL window itself.
   117         Functionality may be added in the future to help this.
   118     * My development setup:
   119         I am using version 1.0.1 (v63.0) of Project Builder on MacOS X 10.0.3,
   120         from the Developer Tools CD for May 2001.
   121         As of May 31 2001, Apple hasn't released this version of the tools to the public, 
   122         but I expect that things will still work on older versions.
   124 Known bugs are listed in the file "BUGS"