]> git.saurik.com Git - wxWidgets.git/blame - docs/osx/install.txt
Don't use deprecated wxDataViewCtrl::StartEditor() in the sample.
[wxWidgets.git] / docs / osx / install.txt
CommitLineData
cc27bb07
JS
1wxWidgets for Mac OS X installation
2-----------------------------------
2b5f62a0 3
cc27bb07
JS
4wxWidgets can be compiled using Apple's Carbon or Cocoa libraries.
5Carbon is the older library, and Cocoa is the more modern library.
2b5f62a0 6
cc27bb07
JS
7In wxWidgets 2.9.x, Cocoa is the recommended library. While Carbon is still
8supported by Apple, little new work is being done in Carbon.
0cd6a2f8 9
cc27bb07
JS
10Most Mac OS X developers should start by downloading and installing Xcode
11from http://developer.apple.com. It is a free IDE from Apple that provides
12all of the tools you need for working with wxWidgets.
13
14After Xcode is installed, download either wxWidgets-{version}.tar.gz or
15wxMac-{version}.tar.gz and then double-click on it to unpack it to create
16a wxWidgets directory.
17
18Next use Terminal (under Applications, Utilities, Terminal) to access a command
19prompt. Use cd to change directories to your wxWidgets directory and execute
20one of the following sets of commands from the wxWidgets directory
21
22---------
23
24# Build the library for Cocoa (wxWidgets 2.9.0 and later)
25mkdir build-cocoa-debug
26cd build-cocoa-debug
27../configure --enable-unicode --enable-debug --disable-shared --with-osx_cocoa
28make;cd ..
29# Build the samples and demos
30cd build-cocoa-debug/samples; make;cd ../..
31cd build-cocoa-debug/demos; make;cd ../..
32
33---------
34
35# Build the library for Carbon
36mkdir build-carbon-debug
37cd build-carbon-debug
38../configure --enable-unicode --enable-debug --disable-shared
39make;cd ..
40# Build the samples and demos
41cd build-carbon-debug/samples;make;cd ../..
42cd build-carbon-debug/demos; make;cd ../..
43
44---------
45
46After the compilation completes, use Finder to run the samples and demos
47 Go to build-carbon-debug/samples to experiment with the Carbon samples.
48 Go to build-carbon-debug/demos to experiment with the Carbon demos.
49 Go to build-cocoa-debug/samples to experiment with the Cocoa samples.
50 Go to biuld-cocoa-debug/demos to experiment with the Cocoa demos.
51Double-click on the executables which have an icon showing three small squares.
52The source code for the samples is in wxWidgets/samples
53The source code for the demos is in wxWidgets/demos
54
55---------
56
57More information about building on Mac OS X is available in the wxWiki.
58Here are two useful links
59 http://wiki.wxwidgets.org/Guides_%26_Tutorials
60 http://wiki.wxwidgets.org/Development:_wxMac
61
62---------
0cd6a2f8 63
cc27bb07 64More advanced topics are covered below.
0cd6a2f8 65
cc27bb07 66---------
0cd6a2f8
JS
67
68If you want to install the library into the system directories you'll need
69to do this as root. The accepted way of running commands as root is to
70use the built-in sudo mechanism. First of all, you must be using an
71account marked as a "Computer Administrator". Then
72
736) sudo make install
747) type <YOUR OWN PASSWORD>
75
76Note that while using this method is okay for development, it is not
77recommended that you require endusers to install wxWidgets into their
78system directories in order to use your program. One way to avoid this
79is to configure wxWidgets with --disable-shared. Another way to avoid
80it is to make a framework for wxWidgets. Making frameworks is beyond
81the scope of this document.
82
83Note:
84We recommend you configure a static library instead:
85
864) ../configure --disable-shared
87
88or activate OpenGL:
89
904) ../configure --with-opengl
91
92Note:
93It is rarely desirable to install non-Apple software into system directories.
94By configuring the library with --disable-shared and using the full path
95to wx-config with the --in-place option you can avoid installing the library.
96
97
a7d9f9fc 98Apple Developer Tools: Xcode
0cd6a2f8
JS
99----------------------------
100
101You can use the project in src/wxWindows.xcodeproj to build wxWidgets,
102and there is a sample project supplied with the minimal sample.
103
a7d9f9fc
VZ
104Notice that the command line build above builds not just the library itself but
105also wxrc tool which doesn't have its own Xcode project. If you need this tool,
106the simplest possibility is to build it from the command line after installing
107the libraries using commands like this:
108
109$ cd utils/wxrc
110$ g++ -o wxrc wxrc.cpp `wx-config --cxxflags --libs base,xml`
111
0cd6a2f8
JS
112Creating universal binaries
113---------------------------
114
115The Xcode projects for the wxWidgets library and minimal project are set up
116to create universal binaries.
117
118If using the Apple command line tools, pass --enable-universal_binary when
119configuring wxWidgets. If you use wx-config --libs to link your application,
120he necessary linker flags will be added. When compiling your own files,
121you need to add -arch ppc -arch i386 to your CFLAGS.
122
123As an alternative to using --enable-universal_binary, you can build for
124each architecture separately and then use the lipo tool to glue the
125binaries together. Assuming building on a PPC system:
126
1271. First build in the usual way to get the PPC library.
128
1292. Then, build for Intel, in a different folder. This time use:
130
131export CFLAGS="-g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386"
132export LDFLAGS="-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
133
134./configure --disable-dependency-tracking --enable-static=yes --enable-shared=no \
135 --target=i386-apple-darwin8 --host=powerpc-apple-darwin8 --build=i386-apple-darwin8
136
137You will need to reverse the powerpc and i386 parameters everywhere to build PPC on an Intel
138machine.
139
1403. Use lipo to glue the binaries together.
141
142See also:
143http://developer.apple.com/technotes/tn2005/tn2137.html
144
145