author Sam Lantinga
Sun, 04 Jan 2004 17:04:54 +0000
changeset 770 ac44ddb84f6f
parent 221 50620ec9c86a
child 869 ae4ab3ac89a9
permissions -rw-r--r--
*** empty log message ***
     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 To use the library once it's built, you essential have two possibilities:
    22 use the traditional autoconf/automake/make method, or use Apple's Project Builder.
    24 ==============================================================================
    25 Using the Simple DirectMedia Layer with a traditional Makefile
    26 ==============================================================================
    28 An existing autoconf/automake build system for your SDL app has good chances
    29 to work almost unchanged on OS X. However, to produce a "real" MacOS X binary
    30 that you can distribute to users, you need to put the generated binary into a
    31 so called "bundle", which basically is a fancy folder with a name like
    32 "".
    34 To get this build automatically, add something like the following rule to
    35 your
    37 bundle_contents =
    38 APP_NAME_bundle: EXE_NAME
    39 	mkdir -p $(bundle_contents)/MacOS
    40 	mkdir -p $(bundle_contents)/Resources
    41 	echo "APPL????" > $(bundle_contents)/PkgInfo
    42 	$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
    44 You should replace EXE_NAME with the name of the executable. APP_NAME is what
    45 will be visible to the user in the Finder. Usually it will be the same
    46 as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME 
    47 usually is "TestGame". You might also want to use @PACKAGE@ to use the package
    48 name as specified in your file.
    50 If your project builds more than one application, you will have to do a bit
    51 more.  For each of your target applications, you need a seperate rule.
    53 If you want the created bundles to be installed, you may want to add this
    54 rule to your
    56 install-exec-hook: APP_NAME_bundle
    57 	rm -rf $(DESTDIR)$(prefix)/Applications/
    58 	mkdir -p $(DESTDIR)$(prefix)/Applications/
    59 	cp -r $< /$(DESTDIR)$(prefix)Applications/
    61 This rule takes the Bundle created by the rule from step 3 and installs them
    62 into $(DESTDIR)$(prefix)/Applications/.
    64 Again, if you want to install multiple applications, you will have to augment
    65 the make rule accordingly.
    68 ==============================================================================
    69 Using the Simple DirectMedia Layer with Project Builder
    70 ==============================================================================
    72 These instructions are for using Apple's Project Builder IDE to build SDL
    73 applications.
    75 - First steps
    77 The first thing to do is to unpack the PBProjects.tar.gz archive in the
    78 top level SDL directory (where the PBProjects.tar.gz archive resides).
    79 Because Stuffit Expander will unpack the archive into a subdirectory,
    80 you should unpack the archive manually from the command line:
    81 	cd [path_to_SDL_source]
    82 	tar zxf PBProjects.tar.gz
    83 This will create a new folder called PBProjects, which you can browse
    84 normally from the Finder.
    86 - Building the Framework
    88 The SDL Library is packaged as a framework bundle, an organized
    89 relocatable folder heirarchy of executible code, interface headers, 
    90 and additional resources. For practical purposes, you can think of a 
    91 framework as a more user and system-friendly shared library, whose library
    92 file behaves more or less like a standard UNIX shared library.
    94 To build the framework, simply open the framework project and build it. 
    95 By default, the framework bundle "SDL.framework" is installed in 
    96 ~/Library/Frameworks. Therefore, the testers and project stationary expect
    97 it to be located there. However, it will function the same in any of the
    98 following locations:
   100     ~/Library/Frameworks
   101     /Local/Library/Frameworks
   102     /System/Library/Frameworks
   104 - Build Options
   105     There are two "Build Styles" (See the "Targets" tab) for SDL.
   106     "Deployment" should be used if you aren't tweaking the SDL library.
   107     "Development" should be used to debug SDL apps or the library itself.
   109 - Building the Testers
   110     Open the SDLTest project and build away!
   112 - Using the Project Stationary
   113     Copy the stationary to the indicated folders to access it from
   114     the "New Project" and "Add target" menus. What could be easier?
   116 - Setting up a new project by hand
   117     Some of you won't want to use the Stationary so I'll give some tips:
   118     * Create a new "Cocoa Application"
   119     * Add src/main/macosx/SDLMain.m , .h and .nib to your project
   120     * Remove "main.c" from your project
   121     * Remove "MainMenu.nib" from your project
   122     * Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
   123     * Add "$(HOME)/Library/Frameworks" to the frameworks search path
   124     * Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
   125     * Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
   126     * Add your files
   127     * Clean and build
   129 - Building from command line
   130     Use pbxbuild in the same directory as your .pbproj file
   132 - Running your app
   133     You can send command line args to your app by either invoking it from
   134     the command line (in *.app/Contents/MacOS) or by entering them in the
   135     "Executibles" panel of the target settings.
   137 - Implementation Notes
   138     Some things that may be of interest about how it all works...
   139     * Working directory
   140         As defined in the SDL_main.m file, the working directory of your SDL app
   141         is by default set to its parent. You may wish to change this to better
   142         suit your needs.
   143     * You have a Cocoa App!
   144         Your SDL app is essentially a Cocoa application. When your app
   145         starts up and the libraries finish loading, a Cocoa procedure is called,
   146         which sets up the working directory and calls your main() method.
   147         You are free to modify your Cocoa app with generally no consequence 
   148         to SDL. You cannot, however, easily change the SDL window itself.
   149         Functionality may be added in the future to help this.
   152 Known bugs are listed in the file "BUGS"