]> git.saurik.com Git - wxWidgets.git/blame - docs/osx/install.txt
Fix uniconizing hidden top level windows in wxMSW.
[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
5e418ef2
VZ
27../configure --with-osx_cocoa --enable-debug
28make
cc27bb07 29# Build the samples and demos
5e418ef2
VZ
30cd samples; make;cd ..
31cd demos; make;cd ..
cc27bb07
JS
32
33---------
34
35# Build the library for Carbon
36mkdir build-carbon-debug
37cd build-carbon-debug
5e418ef2
VZ
38../configure --with-osx_carbon --enable-debug
39make
cc27bb07 40# Build the samples and demos
5e418ef2
VZ
41cd samples;make;cd ..
42cd demos; make;cd ..
cc27bb07
JS
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
0cd6a2f8
JS
83Note:
84It is rarely desirable to install non-Apple software into system directories.
85By configuring the library with --disable-shared and using the full path
86to wx-config with the --in-place option you can avoid installing the library.
87
88
a7d9f9fc 89Apple Developer Tools: Xcode
0cd6a2f8
JS
90----------------------------
91
92You can use the project in src/wxWindows.xcodeproj to build wxWidgets,
93and there is a sample project supplied with the minimal sample.
94
a7d9f9fc
VZ
95Notice that the command line build above builds not just the library itself but
96also wxrc tool which doesn't have its own Xcode project. If you need this tool,
97the simplest possibility is to build it from the command line after installing
98the libraries using commands like this:
99
100$ cd utils/wxrc
101$ g++ -o wxrc wxrc.cpp `wx-config --cxxflags --libs base,xml`
102
0cd6a2f8
JS
103Creating universal binaries
104---------------------------
105
106The Xcode projects for the wxWidgets library and minimal project are set up
107to create universal binaries.
108
109If using the Apple command line tools, pass --enable-universal_binary when
33f270af
VZ
110configuring wxWidgets. This will create the libraries for all the supported
111architectures, currently ppc, i386 and x86_64 when using Cocoa (Carbon isn't
112available in 64 bit builds). You may explicitly specify the architectures to
113use as a comma-separated list, e.g. --enable-universal_binary=i386,x86_64.
114
115Notice that if you use wx-config --libs to link your application, the -arch
116flags are not added automatically as it is possible to link e.g. x86_64-only
117program to a "fat" library containing other architectures. If you want to
118build a universal application, you need to add the necessary "-arch xxx" flags
119to your project or makefile separately.
0cd6a2f8
JS
120
121As an alternative to using --enable-universal_binary, you can build for
122each architecture separately and then use the lipo tool to glue the
123binaries together. Assuming building on a PPC system:
124
1251. First build in the usual way to get the PPC library.
126
1272. Then, build for Intel, in a different folder. This time use:
128
129export CFLAGS="-g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386"
130export LDFLAGS="-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
131
132./configure --disable-dependency-tracking --enable-static=yes --enable-shared=no \
133 --target=i386-apple-darwin8 --host=powerpc-apple-darwin8 --build=i386-apple-darwin8
134
135You will need to reverse the powerpc and i386 parameters everywhere to build PPC on an Intel
136machine.
137
1383. Use lipo to glue the binaries together.
139
140See also:
141http://developer.apple.com/technotes/tn2005/tn2137.html
142
143