]>
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 | ||
12 | Apple Developer Tools: command line | |
13 | ----------------------------------- | |
14 | ||
15 | As in all Unix projects, you need to do something like this under MacOS X | |
16 | with the Apple Developer Tools installed: | |
17 | ||
18 | 1) cd into the base dir | |
19 | 2) mkdir osx-build | |
20 | 3) cd osx-build | |
21 | 4) ../configure (add --with-osx_cocoa for the Cocoa port) | |
22 | 5) make | |
23 | ||
24 | If you want to install the library into the system directories you'll need | |
25 | to do this as root. The accepted way of running commands as root is to | |
26 | use the built-in sudo mechanism. First of all, you must be using an | |
27 | account marked as a "Computer Administrator". Then | |
28 | ||
29 | 6) sudo make install | |
30 | 7) type <YOUR OWN PASSWORD> | |
31 | ||
32 | Note that while using this method is okay for development, it is not | |
33 | recommended that you require endusers to install wxWidgets into their | |
34 | system directories in order to use your program. One way to avoid this | |
35 | is to configure wxWidgets with --disable-shared. Another way to avoid | |
36 | it is to make a framework for wxWidgets. Making frameworks is beyond | |
37 | the scope of this document. | |
38 | ||
39 | Note: | |
40 | We recommend you configure a static library instead: | |
41 | ||
42 | 4) ../configure --disable-shared | |
43 | ||
44 | or activate OpenGL: | |
45 | ||
46 | 4) ../configure --with-opengl | |
47 | ||
48 | Note: | |
49 | It is rarely desirable to install non-Apple software into system directories. | |
50 | By configuring the library with --disable-shared and using the full path | |
51 | to wx-config with the --in-place option you can avoid installing the library. | |
52 | ||
53 | ||
54 | Apple Developer Tools: Xcode | |
55 | ---------------------------- | |
56 | ||
57 | You can use the project in src/wxWindows.xcodeproj to build wxWidgets, | |
58 | and there is a sample project supplied with the minimal sample. | |
59 | ||
60 | Notice that the command line build above builds not just the library itself but | |
61 | also wxrc tool which doesn't have its own Xcode project. If you need this tool, | |
62 | the simplest possibility is to build it from the command line after installing | |
63 | the libraries using commands like this: | |
64 | ||
65 | $ cd utils/wxrc | |
66 | $ g++ -o wxrc wxrc.cpp `wx-config --cxxflags --libs base,xml` | |
67 | ||
68 | Creating universal binaries | |
69 | --------------------------- | |
70 | ||
71 | The Xcode projects for the wxWidgets library and minimal project are set up | |
72 | to create universal binaries. | |
73 | ||
74 | If using the Apple command line tools, pass --enable-universal_binary when | |
75 | configuring wxWidgets. If you use wx-config --libs to link your application, | |
76 | he necessary linker flags will be added. When compiling your own files, | |
77 | you need to add -arch ppc -arch i386 to your CFLAGS. | |
78 | ||
79 | As an alternative to using --enable-universal_binary, you can build for | |
80 | each architecture separately and then use the lipo tool to glue the | |
81 | binaries together. Assuming building on a PPC system: | |
82 | ||
83 | 1. First build in the usual way to get the PPC library. | |
84 | ||
85 | 2. Then, build for Intel, in a different folder. This time use: | |
86 | ||
87 | export CFLAGS="-g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386" | |
88 | export LDFLAGS="-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" | |
89 | ||
90 | ./configure --disable-dependency-tracking --enable-static=yes --enable-shared=no \ | |
91 | --target=i386-apple-darwin8 --host=powerpc-apple-darwin8 --build=i386-apple-darwin8 | |
92 | ||
93 | You will need to reverse the powerpc and i386 parameters everywhere to build PPC on an Intel | |
94 | machine. | |
95 | ||
96 | 3. Use lipo to glue the binaries together. | |
97 | ||
98 | See also: | |
99 | http://developer.apple.com/technotes/tn2005/tn2137.html | |
100 | ||
101 |