Skip to content

Latest commit

 

History

History
179 lines (139 loc) · 7.88 KB

README.MacOSX

File metadata and controls

179 lines (139 loc) · 7.88 KB
 
Apr 26, 2001
Apr 26, 2001
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.)
Sep 11, 2001
Sep 11, 2001
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
==============================================================================
In the following, it will be mostly assumed that you are using autoconf and
automake to setup your SDL project, and furthermore that you use the AM_PATH_SDL
macro provided by SDL in sdl.m4. If you are not using these tools, you can
still use SDL but it will be somewhat hard to get running.
Only step 1) is really required to get started, but for full OS X support you
will want to do the other steps, too.
1) Update your acinclude.m4 file in case you have copied an older version of
sdl.m4 into it. This is essential as AM_PATH_SDL now performs some additional
tasks when used on MacOS X
Rationale: AM_PATH_SDL copies /usr/local/share/sdl/Info.plist and the folder
Sep 23, 2001
Sep 23, 2001
41
/usr/local/share/sdl/SDL_main.nib/ into the directory where configure is invoked.
Sep 11, 2001
Sep 11, 2001
42
43
44
45
46
47
48
49
50
51
52
53
54
This is essential for the configure script to be able to run the test code
that detects SDL.
2) Copy SDL's Info.plist.in file (from src/main/macosx) into your project's main
folder (the same spot that your configure.in sits), and edit it to suite your
needs. Then add it to your AC_OUTPUT list in configure.in
Rationale: The Info.plist file can be used to specify an icon file for
your app, and also to provide a human readable version/copyright string
and other meta-information to the user via the Finder's Get Info dialog.
3) Add something like the following rule to your Makefile.am:
Sep 23, 2001
Sep 23, 2001
55
56
57
58
59
60
61
62
63
bundle_contents = APP_NAME.app/Contents
APP_NAME_bundle: EXE_NAME
mkdir -p $(bundle_contents)/MacOS
mkdir -p $(bundle_contents)/Resources
mkdir -p $(bundle_contents)/Resources/SDL_main.nib
echo "APPL????" > $(bundle_contents)/PkgInfo
$(INSTALL_DATA) Info.plist $(bundle_contents)/
$(INSTALL_DATA) SDL_main.nib/*.nib $(bundle_contents)/Resources/SDLMain.nib
$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
Sep 11, 2001
Sep 11, 2001
64
65
66
67
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
Sep 23, 2001
Sep 23, 2001
68
69
usually is "TestGame". You might also want to use @PACKAGE@ to use the package
name as specified in your configure.in file.
Sep 11, 2001
Sep 11, 2001
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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. Furthermore, each
needs its own Info.plist file, since that has to contain the exact name of the
executable (i.e. EXE_NAME above). One way to do that is to use sed in your make rules
and modify a single master Info.plist.
Rationale: on Mac OS X, executables have to be put into so-called "bundles".
The make rule given above will construct such a bundle around the executable
for you. You need to make a copy of it for each target application.
4) If you want the create bundles to be installed, you may want to add this
rule to your Makefile.am:
Sep 23, 2001
Sep 23, 2001
84
85
86
87
install-exec-hook: APP_NAME_bundle
rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
mkdir -p $(DESTDIR)$(prefix)/Applications/
cp -r $< /$(DESTDIR)$(prefix)Applications/
Sep 11, 2001
Sep 11, 2001
88
89
This rule takes the Bundle created by the rule from step 3 and installs them
Sep 23, 2001
Sep 23, 2001
90
into $(DESTDIR)$(prefix)/Applications/.
Sep 11, 2001
Sep 11, 2001
91
92
93
94
Again, if you want to install multiple applications, you will have to augment
the make rule accordingly.
Apr 26, 2001
Apr 26, 2001
95
Jun 7, 2001
Jun 7, 2001
96
97
98
99
100
101
==============================================================================
Using the Simple DirectMedia Layer with Project Builder
==============================================================================
These instructions are for using Apple's Project Builder IDE to build SDL applications.
Jun 10, 2001
Jun 10, 2001
102
103
104
105
106
107
108
109
110
111
112
- 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.
Jun 7, 2001
Jun 7, 2001
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
- 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?
Apr 26, 2001
Apr 26, 2001
142
Jun 7, 2001
Jun 7, 2001
143
144
145
- 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"
Oct 16, 2001
Oct 16, 2001
146
* Add src/main/macosx/SDLMain.m , .h and .nib to your project
Jun 7, 2001
Jun 7, 2001
147
148
149
150
* 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
Oct 16, 2001
Oct 16, 2001
151
152
* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
* Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
Jun 7, 2001
Jun 7, 2001
153
154
* Add your files
* Clean and build
Apr 26, 2001
Apr 26, 2001
155
Jun 7, 2001
Jun 7, 2001
156
157
158
159
160
161
162
163
164
165
166
- 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
Sep 23, 2001
Sep 23, 2001
167
As defined in the SDL_main.m file, the working directory of your SDL app
Jun 7, 2001
Jun 7, 2001
168
169
170
171
172
173
174
175
176
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.
Oct 16, 2001
Oct 16, 2001
177
178
Apr 26, 2001
Apr 26, 2001
179
Known bugs are listed in the file "BUGS"