README.MacOSX
author Sam Lantinga <slouken@libsdl.org>
Sun, 17 Nov 2002 17:55:45 +0000
changeset 541 796f2fe699be
parent 221 50620ec9c86a
child 869 ae4ab3ac89a9
permissions -rw-r--r--
Support 1-bit alpha on surfaces passed to SDL_WM_SetIcon() (thanks Glenn!)
     1 ==============================================================================
     2 Using the Simple DirectMedia Layer with Mac OS X
     3 ==============================================================================
     4 
     5 These instructions are for people using Apple's Mac OS X (pronounced
     6 "ten").
     7 
     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).
    11 
    12 To build using the command line, use the standard configure and make
    13 process:
    14 
    15 	./configure
    16 	make
    17 	make install
    18 
    19 (You may need to create the subdirs of /usr/local manually.)
    20 
    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.
    23 
    24 ==============================================================================
    25 Using the Simple DirectMedia Layer with a traditional Makefile
    26 ==============================================================================
    27 
    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 "MyCoolGame.app".
    33 
    34 To get this build automatically, add something like the following rule to
    35 your Makefile.am:
    36 
    37 bundle_contents = APP_NAME.app/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/
    43 
    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 configure.in file.
    49 
    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.
    52 
    53 If you want the created bundles to be installed, you may want to add this
    54 rule to your Makefile.am:
    55 
    56 install-exec-hook: APP_NAME_bundle
    57 	rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
    58 	mkdir -p $(DESTDIR)$(prefix)/Applications/
    59 	cp -r $< /$(DESTDIR)$(prefix)Applications/
    60 
    61 This rule takes the Bundle created by the rule from step 3 and installs them
    62 into $(DESTDIR)$(prefix)/Applications/.
    63 
    64 Again, if you want to install multiple applications, you will have to augment
    65 the make rule accordingly.
    66 
    67 
    68 ==============================================================================
    69 Using the Simple DirectMedia Layer with Project Builder
    70 ==============================================================================
    71 
    72 These instructions are for using Apple's Project Builder IDE to build SDL
    73 applications.
    74 
    75 - First steps
    76 
    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.
    85 
    86 - Building the Framework
    87 
    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.
    93 
    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:
    99 
   100     ~/Library/Frameworks
   101     /Local/Library/Frameworks
   102     /System/Library/Frameworks
   103 
   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.
   108 
   109 - Building the Testers
   110     Open the SDLTest project and build away!
   111 
   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?
   115 
   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
   128 
   129 - Building from command line
   130     Use pbxbuild in the same directory as your .pbproj file
   131          
   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.
   136     
   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.
   150 	
   151 
   152 Known bugs are listed in the file "BUGS"