1wxWidgets for Mac OS X installation 2----------------------------------- 3 4wxWidgets can be compiled using Apple's Carbon or Cocoa libraries. 5Carbon is the older library, and Cocoa is the more modern library. 6 7In wxWidgets 2.8.x, Carbon is the recommended library because it is the 8more stable. Cocoa is incomplete in wxWidgets 2.8.x. If you are interested 9in using Cocoa, you should start with wxWidgets 2.9.x where Cocoa is 10much more complete. 11 12Most Mac OS X developers should start by downloading and installing Xcode 13from http://developer.apple.com. It is a free IDE from Apple that provides 14all of the tools you need for working with wxWidgets. 15 16After Xcode is installed, download either wxWidgets-{version}.tar.gz or 17wxMac-{version}.tar.gz and then double-click on it to unpack it to create 18a wxWidgets directory. 19 20Next use Terminal (under Applications, Utilities, Terminal) to access a command 21prompt. Use cd to change directory to your wxWidgets directory and execute 22one of the following sets of commands: 23 24--------- 25 26# For Mac OS X 10.6 Snow Leopard or later, with a 64-bit processor, build the 27# Carbon libraries like this 28mkdir build-carbon-debug 29cd build-carbon-debug 30arch_flags="-arch i386" 31../configure CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags" --enable-unicode --enable-debug --disable-shared 32make;cd .. 33# Build the samples and demos 34cd build-carbon-debug/samples;make;cd ../.. 35cd build-carbon-debug/demos; make;cd ../.. 36 37--------- 38 39# For Mac OS X 10.5 or older or with a 32-bit processor, build Carbon like this: 40mkdir build-carbon-debug 41cd build-carbon-debug 42../configure --enable-unicode --enable-debug --disable-shared 43make;cd .. 44# Build the samples and demos 45cd build-carbon-debug/samples;make;cd ../.. 46cd build-carbon-debug/demos; make;cd ../.. 47 48--------- 49 50# For Mac OS X 10.5 or older or with a 32-bit processor, you can build the 51# Cocoa libraries like this, but wxWidgets 2.9.x is really much better than 2.8.x 52mkdir build-cocoa-debug 53cd build-cocoa-debug 54../configure --enable-unicode --enable-debug --disable-shared --with-cocoa 55make;cd .. 56# Build the samples and demos 57cd build-cocoa-debug/samples; make;cd ../.. 58cd build-cocoa-debug/demos; make;cd ../.. 59 60--------- 61 62After the compilation completes, use Finder to run the samples and demos 63 Go to build-carbon-debug/samples to experiment with the Carbon samples. 64 Go to build-carbon-debug/demos to experiment with the Carbon demos. 65 Go to build-cocoa-debug/samples to experiment with the Cocoa samples. 66 Go to biuld-cocoa-debug/demos to experiment with the Cocoa demos. 67Double-click on the executables which have an icon showing three small squares. 68The source code for the samples is in wxWidgets/samples 69The source code for the demos is in wxWidgets/demos 70 71--------- 72 73More information about building on Mac OS X is available in the wxWiki. 74Here are two useful links 75 http://wiki.wxwidgets.org/Guides_%26_Tutorials 76 http://wiki.wxwidgets.org/Development:_wxMac 77 78--------- 79 80More advanced topics are covered below. 81 82--------- 83 84 85Apple Developer Tools: command line 86----------------------------------- 87 88If you want to install the library into the system directories you'll need 89to do this as root. The accepted way of running commands as root is to 90use the built-in sudo mechanism. First of all, you must be using an 91account marked as a "Computer Administrator". Then 92 936) sudo make install 947) type <YOUR OWN PASSWORD> 95 96Note that while using this method is okay for development, it is not 97recommended that you require endusers to install wxWidgets into their 98system directories in order to use your program. One way to avoid this 99is to configure wxWidgets with --disable-shared. Another way to avoid 100it is to make a framework for wxWidgets. Making frameworks is beyond 101the scope of this document. 102 103Note: 104We recommend you configure a static library instead: 105 1064) ../configure --disable-shared 107 108or activate OpenGL: 109 1104) ../configure --with-opengl 111 112Note: 113It is rarely desirable to install non-Apple software into system directories. 114By configuring the library with --disable-shared and using the full path 115to wx-config with the --in-place option you can avoid installing the library. 116 117 118Apple Developer Tools: XCode 119---------------------------- 120 121You can use the project in src/wxWindows.xcodeproj to build wxWidgets, 122and there is a sample project supplied with the minimal sample. 123 124Creating universal binaries 125--------------------------- 126 127The Xcode projects for the wxWidgets library and minimal project are set up 128to create universal binaries. 129 130If using the Apple command line tools, pass --enable-universal_binary when 131configuring wxWidgets. If you use wx-config --libs to link your application, 132he necessary linker flags will be added. When compiling your own files, 133you need to add -arch ppc -arch i386 to your CFLAGS. 134 135As an alternative to using --enable-universal_binary, you can build for 136each architecture separately and then use the lipo tool to glue the 137binaries together. Assuming building on a PPC system: 138 1391. First build in the usual way to get the PPC library. 140 1412. Then, build for Intel, in a different folder. This time use: 142 143export CFLAGS="-g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386" 144export LDFLAGS="-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" 145 146./configure --disable-dependency-tracking --enable-static=yes --enable-shared=no \ 147 --target=i386-apple-darwin8 --host=powerpc-apple-darwin8 --build=i386-apple-darwin8 148 149You will need to reverse the powerpc and i386 parameters everywhere to build PPC on an Intel 150machine. 151 1523. Use lipo to glue the binaries together. 153 154See also: 155http://developer.apple.com/technotes/tn2005/tn2137.html 156 157 158Building with CodeWarrior 159------------------------- 160 161(Note that using the Apple tools is recommended.) 162 163Installing latest headers (and Carbon Support) 164---------------------------------------------- 165 166Patching headers: CodeWarrior 8.x 167--------------------------------- 168 169If you run into trouble with WCHAR_MIN and WCHAR_MAX the for 170MacOS X Support:Headers:(wchar_t Support fix):machine:ansi.h, 171apply the patch ansi.diff. 172 173You may also need to comment out the _T definition in 174ctype.h if you get multiple definition errors. 175 176setup.h 177------- 178 179in order to build wxMac with CodeWarrior, you must copy or alias the file 180include/wx/mac/setup0.h to include/wx/setup.h. 181 182this step is not needed when using the Apple Developer Tools under Mac OS X 183since the setup.h file is automatically generated during the configuration. 184 185OpenGL 186------ 187 188In order to build opengl support with CodeWarrior, you must install the opengl 189libraries and headers from http://developer.apple.com/opengl/index.html 190 191If you want OpenGL support with CodeWarrior, set wxUSE_OPENGL to 1 in 192include/wx/setup.h 193 194If you don't want OpenGl support, set wxUSE_OPENGL to 0 (the 195default) and remove the file OpenGLLibraryStub from the project 196before compilation. 197 198If you want OpenGL support with the Apple Developer Tools under Mac OS X, add 199--with-opengl to the arguments of configure when configuring wxMac. 200 201Project Files 202------------- 203 204The project files are stored as xml text files and converted to binary 205CodeWarrior projects in the distribution (see AppleScript Files below): 206 207 - *M8.xml -> *M8.mcp for CodeWarrior 8 and above. 208 209AppleScript Files 210----------------- 211 212Several AppleScript files are provided in the docs:mac directory: 213 214 - M8xml2mcp.applescript to convert xml files to CodeWarrior 8 projects 215 - M8mcp2xml.applescript to convert CodeWarrior 8 projects to xml files 216 - SetXMLCreator.applescript to set correct creator type (see below) 217 218To run the XML to MCP conversion scripts: 219 220Double click on e.g. docs/mac/M8xml2mcp.applescript, then "run" 221the applescript and when asked for a folder pick src/. Then it 222takes a while to scan all dirs for the xml files and convert 223them to mcps. If some conversions fail it means an mcp already 224exists (back them up prior to running the script). 225 226To set the correct creator type for importing into CodeWarrior, 227you may need to run SetXMLCreator.applescript. 228 229Problems with .xpm files 230------------------------ 231 232if you have downloaded all the files and get errors like : 233 234Error : the file 'wx/generic/tip.xpm' cannot be opened 235tipdlg.cpp line 201 #include "wx/generic/tip.xpm" 236 237then your cvs has changed the type of the .xpm files to something other than 238text, in order to fix this either change the type by using a resource editor 239or drag the files from /include/wx/generic/..xpm on the SetTypeFromExtension 240application that is included in this folder. This small applet itself queries 241the Internet Config, so you will have to associate the "xpm" extension with 242CodeWarrior before making use of this applet. 243 244Missing PLStringFuncsLib 245------------------------ 246 247You will have to build All Targets for MacOS Support:Libraries:Sources:PLStringFuncs:Glue:PLStringFuncsGlue.mcp 248 249 250