Skip to content

Latest commit

 

History

History
152 lines (118 loc) · 6.29 KB

README.MacOSX

File metadata and controls

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