]> git.saurik.com Git - wxWidgets.git/blob - wxPython/BUILD.txt
Committing in .
[wxWidgets.git] / wxPython / BUILD.txt
1 Build Instructions
2 ------------------
3 I used SWIG (http://www.swig.org) to create the source code for the
4 extension module. This enabled me to only have to deal with a small
5 amount of code and only have to bother with the exceptional issues.
6 SWIG takes care of the rest and generates all the repetative code for
7 me. You don't need SWIG to build the extension module as all the
8 generated C++ code is included under the src directory.
9
10 I added a few minor features to SWIG to control some of the code
11 generation. If you want to play around with this you will need to get
12 a recent version of SWIG from their CVS or from a daily build. See
13 http://www.swig.org/ for details.
14
15 wxPython is organized as a Python package. This means that the
16 directory containing the results of the build process should be a
17 subdirectory of a directory on the PYTHONPATH. (And preferably should
18 be named wxPython.) You can control where the build process will dump
19 wxPython by setting the TARGETDIR variable for the build utility, (see
20 below.)
21
22
23
24 1. Build and install wxWindows as described in its BuildCVS.txt or
25 INSTALL.txt file.
26
27 1a. Building wxWindows on Unix/Linux/Etc.
28
29 For *nix systems I run configure with these flags:
30
31 --with-gtk
32 --with-libjpeg
33 --with-opengl
34 --without-odbc
35 --enable-unicode=no
36 --enable-threads=yes
37 --enable-socket=yes
38 --enable-static=no
39 --enable-shared=yes
40 --disable-std_iostreams
41 --enable-newgrid
42
43 You can use whatever flags you want, but these work for me. If you
44 want debug libraries, then you should add the "--enable-debug
45 --enable-mem_tracing" flags. I reccommend creating an empty build
46 directory, and then running make and configure from there. This
47 makes it easy to experiment with different configure options
48 without losing old builds.
49
50 Be sure to run "make install" to install the wxWindows headers and
51 shared library. You can check where the wxPython build will expect
52 to find them by running "wx-config --cflags" and "wx-config --libs"
53
54
55 1b. Building wxWindows on Win32.
56
57 For Win32 systems I use Visual C++ 6.0, but 5.0 should work. The
58 wxPython build utility currently does not support any other win32
59 compilers. Be sure to copy include/wx/msw/setup0.h to
60 include/wx/msw/setup.h and edit it for the options you want. At a
61 minimum you should set the following:
62
63 wxUSE_NEW_GRID 1
64 wxUSE_GLOBAL_MEMORY_OPERATORS 0
65 wxUSE_LIBTIFF 1
66 wxUSE_GLCANVAS 1
67
68 I also change these:
69
70 wxUSE_DIALUP_MANAGER 0
71 wxUSE_DYNLIB_CLASS 0
72 wxUSE_DOC_VIEW_ARCHITECTURE 0
73 wxUSE_MDI_ARCHITECTURE 0
74 wxUSE_PLOT 0
75 wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0
76
77
78 There are probably other flags that can be disabled to remove
79 things not being used in wxPython, but I havn't investigated all
80 the potential configurations yet.
81
82 I find it easiest to build wxWindows using the makefiles, that way
83 I don't have to worry about what the IDE might be doing behind the
84 scenes that might screw things up. Simply go to the src/msw
85 directory and run:
86
87 nmake -f makefile.vc CRTFLAG=/MD EXTRAFLAGS=-D__NO_VC_CRTDBG__ dll pch
88
89 If you want to make a release build, add FINAL=1 to the nmake
90 command, as well as to build.local for wxPython, (see below.)
91
92
93 2. For the win32 platform you should be sure to set an environment
94 variable named WXWIN to be the path to the top of the wxWindows
95 source tree.
96
97
98 3. If you are working from a copy of the code retrieved from CVS, then
99 you will find wxPython in $WXWIN/wxPython. If you are working from
100 the tar.gz or .zip files then you will probably want to unpack
101 wxPython in the $WXWIN directory and rename the new directory to
102 wxPython (or use a symlink.) If you want to keep it in a separate
103 directory then you can change where the build.py tool expects to
104 find it by creating a file named build.local (see step 7 for more
105 examples about build.local,) containing something like this:
106
107 WXPSRCDIR = "~/MyStuff/wxPython-2.1.15/src"
108
109 If your wxPython sources are not under $WXWIN then you'll need to
110 adjust the remainder of these instructions accordingly.
111
112
113 4. At this point you may want to make an alias, symlink, script,
114 batch file, or whatever on the PATH that invokes
115 $WXWIN/wxPython/distrib/build.py to help simplify matters somewhat.
116 For example, on my win32 system I have a file named build.bat in a
117 directory on the PATH that contains:
118
119 python %WXWIN%/wxPython/distrib/build.py %1 %2 %3 %4 %5 %6
120
121
122 5. Change into the $(WXWIN)/wxPython/src directory.
123
124
125 6. If you don't use SWIG, or don't have a new enough version
126 installed, you may have to update the timestamps of the files it
127 generates so the make utility won't think they are out of date and
128 try to run SWIG to update them. The standard touch utility can do
129 this for you:
130
131 touch gtk/*.cpp gtk/*.py
132 or
133 touch msw\*.cpp msw\*.py
134
135
136 7. Type "build -b" to build wxPython and "build -i" to install it.
137
138 The build.py script actually generates a Makefile based on what it
139 finds on your system and information found in the build.cfg file.
140 If you have troubles building or you want it built or installed in
141 a different way, take a look at the doc-string in build.py. You may
142 be able to override configuration options in a file named
143 build.local. For example, you can set a new TARGETDIR (the
144 installation directory) just by creating a file named build.local
145 in your wxPython source directory and assign a value to it, like
146 this:
147
148 TARGETDIR = "/usr/local/lib/python1.5/site-packages/wxPython"
149
150 The build.local file is executed as Python code so you can do very
151 creative things there if you need to.
152
153
154 8. To build and install the add-on modules, change to the appropriate
155 directory under $WXWIN/wxPython/contrib and run the build utility
156 again.
157
158
159 9. Change to the $WXWIN/wxPython/demo directory.
160
161
162 10. Try executing the demo program. For example:
163
164 python demo.py
165
166 To run it without requiring a console on win32, you can use the
167 pythonw.exe version of Python either from the command line or from
168 a shortcut.