1 Building wxPython 2.5 for Development and Testing
2 =================================================
4 This file describes how I build wxWindows and wxPython while doing
5 development and testing, and is meant to help other people that want
6 to do the same thing. I'll assume that you are using either a CVS
7 snapshot or a checkout from CVS. I'll also assume that you know what
8 you are doing and so I may not be as detailed here as I am in other
11 If you want to make changes to any of the *.i files, or regenerate the
12 extension sources or renamer modules, then you will need an up to date
13 version of SWIG. Either get and build the current CVS version, or
14 version 1.3.20 when it is released. If you install this build of SWIG
15 to a location that is not on the PATH (so it doesn't interfere with an
16 existing SWIG install for example) then you can set a setup.py
17 command-line variable named SWIG to be the full path name of the
18 executable and the wxPython build will use it. See below for an
24 Building on Linux and OS X
25 --------------------------
27 These two platforms are built almost the same way while in development
28 so I'll combine the descriptions about their build process here.
29 First we will build wxWindows and install it to an out of the way
30 place, then do the same for wxPython.
33 1. Create a build directory in the main wxWindows dir, and configure
34 wxWindows. If you want to have multiple builds with different
35 configure options, just use different subdirectories. I normally
36 put the configure command in a script named ".configure" in each
37 build dir so I can easily blow away everything in the build dir and
38 rerun the script without having to remember the options I used
43 ../configure --prefix=/opt/wx/2.5 \
46 --disable-monolithic \
51 On OS X of course you'll want to use --with-mac instead of
52 --with-gtk. For GTK2 and unicode add:
57 Notice that I used a prefix of /opt/wx/2.5. You can use whatever
58 path you want, even the standard ones if you like, but this lets me
59 easily have multiple versions and ports of wxWindows "installed"
60 and makes it easy to switch between them.
63 2. To build and install wxWindows you could just use "make" but there
64 are other libraries that also need to be built so again I make a
65 script to do it all for me so I don't forget anything. This time
66 it is called ".make" (I use the leading ". so when I do "rm -r *"
67 in my build dir I don't lose my scripts too.) This is what it
71 && make -C contrib/src/gizmos $* \
72 && make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" $* \
73 && make -C contrib/src/stc $* \
74 && make -C contrib/src/xrc $*
76 So you just use .make as if it where make, but don't forget to set
77 the execute bit on .make first!::
82 When it's done you should have an installed set of files under
83 /opt/wx/2.5 containing just wxWindows. Now to use this version of
84 wxWindows you just need to add /opt/wx/2.5/bin to the PATH and set
85 LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH on OS X) to /opt/wx/2.5/lib.
88 3. I also have a script to help me build wxPython and it is checked in
89 to the CVS as wxWindows/wxPython/b, but probably don't want to use
90 it as it's very cryptic and expects that you want to run SWIG, so
91 if you don't have the latest patched up version of SWIG then you'll
92 probably get stuck. So I'll just give the raw commands instead.
94 We're not going to install the development version of wxPython with
95 these commands, so it won't impact your already installed version
96 of the latest release. You'll be able test with this version when
97 you want to, and use the installed release version the rest of the
98 time. If you ever do want to install the development verison just
99 use the normal distutils commands to do it.
101 Make sure that the first wx-config found on the PATH is the one you
102 installed above, and then change to the wxWindows/wxPython dir and
103 run the this command::
106 python2.3 setup.py build_ext --inplace --debug
108 If you are building with GTK2 then add the following flags to the
111 WXPORT=gtk2 UNICODE=1
113 If you are wanting to have the source files regenerated with swig,
114 then you need to turn on the USE_SWIG flag and optionally tell it
115 where to find the new swig executable, so add these flags::
117 USE_SWIG=1 SWIG=/opt/swig/bin/swig
119 When the setup.py command is done you should have fully populated
120 wxPython and wx packages locally in wxWindows/wxPython/wxPython and
121 .../wx, with all the extension modules (*.so files) located in the
125 4. To run code with the development verison of wxPython, just set the
126 PYTHONPATH to the wxPython dir in the CVS tree. For example::
128 export LD_LIBRARY=/opt/wx/2.5/lib
129 export PYTHONPATH=/myprojects/wxWindows/wxPython
130 cd /myprojects/wxWindows/wxPython/demo
140 The Windows builds currently require the use of Microsoft Visual C++.
141 Theoretically, other compilers (such as mingw32 or the Borland
142 compilers) can also be used but I've never done the work to make that
143 happen. If you want to try that then first you'll want to find out if
144 there are any tricks that have to be done to make Python extension
145 modules using that compiler, and then make a few changes to setup.py
146 to accomodate that. (And send the patches to me.) If you plan on
147 using VisualStudio.Net (a.k.a. MSVC 7.1) keep in mind that you'll also
148 have to build Python and any other extension modules that you use with
149 that compiler because a different version of the C runtime likbrary is
150 used. The Python executable that comes from PythonLabs and the
151 wxPythons that I distribute are built with MSVC 6 with all the Service
154 If you want to build a debugable version of wxWindows and wxPython you
155 will need to have also built a debug version of Python and any other
156 extension modules you need to use. You can tell if you have them
157 already if there is a _d in the file names, for example python_d.exe
158 or python23_d.dll. If you don't need to trace through the C/C++ parts
159 of the code with the debugger then building the normal (or hybrid)
160 version is fine, and you can use the regular python executables with
163 Just like the unix versions I also use some scripts to help me build
164 wxWindows, but I use some non-standard stuff to do it. So if you want
165 to use them too you'll need to get a copy or 4DOS or 4NT from
166 http://www.jpsoft.com/ and also a copy of unix-like cat and sed
167 programs. You can also do by hand what my scripts are doing, but
168 there are a lof steps involved and I won't be going into details
169 here. There is a copy of my build scripts in wxWindows\wxPython\distrib\msw
172 1. Set an environment variable to the root of the wxWindows source
175 set WXWIN=e:\projects\wxWindows
177 2. Copy setup0.h to setup.h
179 cd %WXWIN%\include\wx\msw
180 copy setup0.h setup.h
182 3. Edit setup.h and change a few settings. Some of them are changed
183 by my build scripts depending on the type of build (debug/hybrid,
184 unicode/ansi). I change a few of the other defaults to have these
187 wxDIALOG_UNIT_COMPATIBILITY 0
188 wxUSE_DEBUG_CONTEXT 1
189 wxUSE_MEMORY_TRACING 1
190 wxUSE_DIALUP_MANAGER 0
193 wxUSE_AFM_FOR_POSTSCRIPT 0
196 4. Make a %WXWIN%\BIN directory and add it to the PATH. My build
197 scripts will copy the wxWindows DLLs there.
199 5. Change to the %WXWIN%\build\msw directory and copy my build scripts
202 6. Use the .make command to build wxWindows. It needs one
203 command-line parameter which controls what kind of build(s) to do.
204 Use one of the following::
206 debug Build debug version
207 hybrid Build hybrid version
208 both Both debug and hybrid
209 debug-uni Build a debug unicode library
210 hybrid-uni Hybrid unicode (see the pattern yet? ;-)
211 both-uni and finally both unicode libraries
218 7. When that is done there should be a ton of DLLs in %WXDIR%\bin and
219 lots of lib files and stuff in %WXDIR%\lib\vc_dll
222 8. Building wxPython on Windows is very similar to doing it for the
223 unix systems. We're not going to install the development version
224 of wxPython with these commands, so it won't impact your already
225 installed version of the latest release. You'll be able test with
226 this version when you want to, and use the installed release
227 version the rest of the time. If you ever do want to install the
228 development verison just use the normal distutils commands to do
231 Change to the wxWindows\wxPython dir and run the this command::
234 python setup.py build_ext --inplace
236 If you are wanting to have the source files regenerated with swig,
237 then you need to turn on the USE_SWIG flag and optionally tell it
238 where to find the new swig executable, so add these flags::
240 USE_SWIG=1 SWIG=e:\projects\SWIG-cvs\swig.exe
242 If you have a debug version of Python and wxWindows and want to
243 build a debug version of wxPython too, add the --debug flag to the
244 command line. You should then end up with a set of *_d.pyd files
245 in the wx package and you'll have to use python_d.exe to use them.
246 The debug and hybrid(release) versions can coexist.
248 When the setuyp.py command is done you should have fully populated
249 wxPython and wx packages locally in wxWindows/wxPython/wxPython and
250 .../wx, with all the extension modules (*.pyd files) located in the
254 9. To run code with the development verison of wxPython, just set the
255 PYTHONPATH to the wxPython dir in the CVS tree. For example::
257 set PYTHONPATH=e:\projects\wxWindows\wxPython
258 cd e:\projects\wxWindows\wxPython