]>
Commit | Line | Data |
---|---|---|
1 | wxWidgets for Mac installation | |
2 | ------------------------------ | |
3 | ||
4 | On MacOS X, you can download Apple's free developer tools (gcc | |
5 | and associated headers and libraries, such as the Carbon API). | |
6 | You can then use configure in a similar way to compiling | |
7 | wxWidgets on Linux (or on Windows using MinGW or Cygwin). See | |
8 | 'Apple Developer Tools' below for more details on using | |
9 | configure. | |
10 | ||
11 | To target on MacOS 8 or 9, you need to buy Metrowerks | |
12 | CodeWarrior. You can then compile Mac Classic or MacOS X | |
13 | applications on Mac OS X, or compile Mac Classic or MacOS X | |
14 | applications on Mac Classic. However you can only run and debug | |
15 | each type of application on the target operating system. | |
16 | ||
17 | ||
18 | Apple Developer Tools: command line | |
19 | ----------------------------------- | |
20 | ||
21 | As in all Unix projects, you need to do something like this under MacOS X | |
22 | with the Apple Developer Tools installed: | |
23 | ||
24 | 1) cd into the base dir | |
25 | 2) mkdir osx-build | |
26 | 3) cd osx-build | |
27 | 4) ../configure | |
28 | 5) make | |
29 | ||
30 | If you want to install the library into the system directories you'll need | |
31 | to do this as root. The accepted way of running commands as root is to | |
32 | use the built-in sudo mechanism. First of all, you must be using an | |
33 | account marked as a "Computer Administrator". Then | |
34 | ||
35 | 6) sudo make install | |
36 | 7) type <YOUR OWN PASSWORD> | |
37 | ||
38 | Note that while using this method is okay for development, it is not | |
39 | recommended that you require endusers to install wxWidgets into their | |
40 | system directories in order to use your program. One way to avoid this | |
41 | is to configure wxWidgets with --disable-shared. Another way to avoid | |
42 | it is to make a framework for wxWidgets. Making frameworks is beyond | |
43 | the scope of this document. | |
44 | ||
45 | Note: | |
46 | We recommend you configure a static library instead: | |
47 | ||
48 | 4) ../configure --disable-shared | |
49 | ||
50 | or activate OpenGL: | |
51 | ||
52 | 4) ../configure --with-opengl | |
53 | ||
54 | Note: | |
55 | It is rarely desirable to install non-Apple software into system directories. | |
56 | By configuring the library with --disable-shared and using the full path | |
57 | to wx-config with the --in-place option you can avoid installing the library. | |
58 | ||
59 | ||
60 | Apple Developer Tools: Xcode | |
61 | ---------------------------- | |
62 | ||
63 | You can use the project in src/wxWindows.xcodeproj to build wxWidgets, | |
64 | and there is a sample project supplied with the minimal sample. | |
65 | ||
66 | Notice that the command line build above builds not just the library itself but | |
67 | also wxrc tool which doesn't have its own Xcode project. If you need this tool, | |
68 | the simplest possibility is to build it from the command line after installing | |
69 | the libraries using commands like this: | |
70 | ||
71 | $ cd utils/wxrc | |
72 | $ g++ -o wxrc wxrc.cpp `wx-config --cxxflags --libs base,xml` | |
73 | ||
74 | Creating universal binaries | |
75 | --------------------------- | |
76 | ||
77 | The Xcode projects for the wxWidgets library and minimal project are set up | |
78 | to create universal binaries. | |
79 | ||
80 | If using the Apple command line tools, pass --enable-universal_binary when | |
81 | configuring wxWidgets. If you use wx-config --libs to link your application, | |
82 | he necessary linker flags will be added. When compiling your own files, | |
83 | you need to add -arch ppc -arch i386 to your CFLAGS. | |
84 | ||
85 | As an alternative to using --enable-universal_binary, you can build for | |
86 | each architecture separately and then use the lipo tool to glue the | |
87 | binaries together. Assuming building on a PPC system: | |
88 | ||
89 | 1. First build in the usual way to get the PPC library. | |
90 | ||
91 | 2. Then, build for Intel, in a different folder. This time use: | |
92 | ||
93 | export CFLAGS="-g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386" | |
94 | export LDFLAGS="-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" | |
95 | ||
96 | ./configure --disable-dependency-tracking --enable-static=yes --enable-shared=no \ | |
97 | --target=i386-apple-darwin8 --host=powerpc-apple-darwin8 --build=i386-apple-darwin8 | |
98 | ||
99 | You will need to reverse the powerpc and i386 parameters everywhere to build PPC on an Intel | |
100 | machine. | |
101 | ||
102 | 3. Use lipo to glue the binaries together. | |
103 | ||
104 | See also: | |
105 | http://developer.apple.com/technotes/tn2005/tn2137.html | |
106 | ||
107 | ||
108 | Building with CodeWarrior | |
109 | ------------------------- | |
110 | ||
111 | (Note that using the Apple tools is recommended.) | |
112 | ||
113 | Installing latest headers (and Carbon Support) | |
114 | ---------------------------------------------- | |
115 | ||
116 | Patching headers: CodeWarrior 8.x | |
117 | --------------------------------- | |
118 | ||
119 | If you run into trouble with WCHAR_MIN and WCHAR_MAX the for | |
120 | MacOS X Support:Headers:(wchar_t Support fix):machine:ansi.h, | |
121 | apply the patch ansi.diff. | |
122 | ||
123 | You may also need to comment out the _T definition in | |
124 | ctype.h if you get multiple definition errors. | |
125 | ||
126 | setup.h | |
127 | ------- | |
128 | ||
129 | in order to build wxMac with CodeWarrior, you must copy or alias the file | |
130 | include/wx/mac/setup0.h to include/wx/setup.h. | |
131 | ||
132 | this step is not needed when using the Apple Developer Tools under Mac OS X | |
133 | since the setup.h file is automatically generated during the configuration. | |
134 | ||
135 | OpenGL | |
136 | ------ | |
137 | ||
138 | In order to build opengl support with CodeWarrior, you must install the opengl | |
139 | libraries and headers from http://developer.apple.com/opengl/index.html | |
140 | ||
141 | If you want OpenGL support with CodeWarrior, set wxUSE_OPENGL to 1 in | |
142 | include/wx/setup.h | |
143 | ||
144 | If you don't want OpenGl support, set wxUSE_OPENGL to 0 (the | |
145 | default) and remove the file OpenGLLibraryStub from the project | |
146 | before compilation. | |
147 | ||
148 | If you want OpenGL support with the Apple Developer Tools under Mac OS X, add | |
149 | --with-opengl to the arguments of configure when configuring wxMac. | |
150 | ||
151 | Project Files | |
152 | ------------- | |
153 | ||
154 | The project files are stored as xml text files and converted to binary | |
155 | CodeWarrior projects in the distribution (see AppleScript Files below): | |
156 | ||
157 | - *M8.xml -> *M8.mcp for CodeWarrior 8 and above. | |
158 | ||
159 | AppleScript Files | |
160 | ----------------- | |
161 | ||
162 | Several AppleScript files are provided in the docs:mac directory: | |
163 | ||
164 | - M8xml2mcp.applescript to convert xml files to CodeWarrior 8 projects | |
165 | - M8mcp2xml.applescript to convert CodeWarrior 8 projects to xml files | |
166 | - SetXMLCreator.applescript to set correct creator type (see below) | |
167 | ||
168 | To run the XML to MCP conversion scripts: | |
169 | ||
170 | Double click on e.g. docs/mac/M8xml2mcp.applescript, then "run" | |
171 | the applescript and when asked for a folder pick src/. Then it | |
172 | takes a while to scan all dirs for the xml files and convert | |
173 | them to mcps. If some conversions fail it means an mcp already | |
174 | exists (back them up prior to running the script). | |
175 | ||
176 | To set the correct creator type for importing into CodeWarrior, | |
177 | you may need to run SetXMLCreator.applescript. | |
178 | ||
179 | Problems with .xpm files | |
180 | ------------------------ | |
181 | ||
182 | if you have downloaded all the files and get errors like : | |
183 | ||
184 | Error : the file 'wx/generic/tip.xpm' cannot be opened | |
185 | tipdlg.cpp line 201 #include "wx/generic/tip.xpm" | |
186 | ||
187 | then your cvs has changed the type of the .xpm files to something other than | |
188 | text, in order to fix this either change the type by using a resource editor | |
189 | or drag the files from /include/wx/generic/..xpm on the SetTypeFromExtension | |
190 | application that is included in this folder. This small applet itself queries | |
191 | the Internet Config, so you will have to associate the "xpm" extension with | |
192 | CodeWarrior before making use of this applet. | |
193 | ||
194 | Missing PLStringFuncsLib | |
195 | ------------------------ | |
196 | ||
197 | You will have to build All Targets for MacOS Support:Libraries:Sources:PLStringFuncs:Glue:PLStringFuncsGlue.mcp | |
198 | ||
199 |