]> git.saurik.com Git - wxWidgets.git/blame - wxPython/docs/BUILD.devel.txt
Applied patch [ 827011 ] Event-based processing of item tooltips in wxTreeCtrl
[wxWidgets.git] / wxPython / docs / BUILD.devel.txt
CommitLineData
d14a1e28
RD
1Building wxPython 2.5 for Development and Testing
2=================================================
3
4This file describes how I build wxWindows and wxPython while doing
5development and testing, and is meant to help other people that want
6to do the same thing. I'll assume that you are using either a CVS
be052e4e
RD
7snapshot or a checkout from CVS. I'll also assume that you know what
8you are doing and so I may not be as detailed here as I am in other
9BUILD docs.
d14a1e28
RD
10
11If you want to make changes to any of the *.i files, or regenerate the
12extension sources or renamer modules, then you will need an up to date
13version of SWIG. Either get and build the current CVS version, or
14version 1.3.20 when it is released. If you install this build of SWIG
15to a location that is not on the PATH (so it doesn't interfere with an
16existing SWIG install for example) then you can set a setup.py
17command-line variable named SWIG to be the full path name of the
18executable and the wxPython build will use it. See below for an
19example.
20
21
22
23
24Building on Linux and OS X
25--------------------------
26
27These two platforms are built almost the same way while in development
28so I'll combine the descriptions about their build process here.
29First we will build wxWindows and install it to an out of the way
30place, then do the same for wxPython.
31
32
331. 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
39 before::
40
41 mkdir bld
42 cd bld
43 ../configure --prefix=/opt/wx/2.5 \
44 --with-gtk \
45 --with-opengl \
46 --disable-monolithic \
47 --enable-debug \
48 --enable-geometry
49
50
51 On OS X of course you'll want to use --with-mac instead of
52 --with-gtk. For GTK2 and unicode add:
53
54 --enable-gtk2 \
55 --enable-unicode
56
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.
61
62
632. 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
68 looks like::
69
70 make $* \
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 $*
75
76 So you just use .make as if it where make, but don't forget to set
77 the execute bit on .make first!::
78
79 .make
80 .make install
81
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.
86
87
883. 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.
93
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.
100
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::
104
105 cd wxPython
106 python2.3 setup.py build_ext --inplace --debug
107
108 If you are building with GTK2 then add the following flags to the
109 command line::
110
111 WXPORT=gtk2 UNICODE=1
112
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::
116
117 USE_SWIG=1 SWIG=/opt/swig/bin/swig
118
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
122 wx package.
123
124
1254. To run code with the development verison of wxPython, just set the
126 PYTHONPATH to the wxPython dir in the CVS tree. For example::
127
128 export LD_LIBRARY=/opt/wx/2.5/lib
129 export PYTHONPATH=/myprojects/wxWindows/wxPython
130 cd /myprojects/wxWindows/wxPython/demo
131 python2.3 demo.py
132
133
134
135
136
137Building on Windows
138-------------------
139
140The Windows builds currently require the use of Microsoft Visual C++.
141Theoretically, other compilers (such as mingw32 or the Borland
142compilers) can also be used but I've never done the work to make that
143happen. If you want to try that then first you'll want to find out if
144there are any tricks that have to be done to make Python extension
145modules using that compiler, and then make a few changes to setup.py
146to accomodate that. (And send the patches to me.) If you plan on
147using VisualStudio.Net (a.k.a. MSVC 7.1) keep in mind that you'll also
148have to build Python and any other extension modules that you use with
149that compiler because a different version of the C runtime likbrary is
150used. The Python executable that comes from PythonLabs and the
151wxPythons that I distribute are built with MSVC 6 with all the Service
152Packs applied.
153
154If you want to build a debugable version of wxWindows and wxPython you
155will need to have also built a debug version of Python and any other
156extension modules you need to use. You can tell if you have them
157already if there is a _d in the file names, for example python_d.exe
158or python23_d.dll. If you don't need to trace through the C/C++ parts
159of the code with the debugger then building the normal (or hybrid)
160version is fine, and you can use the regular python executables with
161it.
162
163Just like the unix versions I also use some scripts to help me build
164wxWindows, but I use some non-standard stuff to do it. So if you want
165to use them too you'll need to get a copy or 4DOS or 4NT from
166http://www.jpsoft.com/ and also a copy of unix-like cat and sed
167programs. You can also do by hand what my scripts are doing, but
168there are a lof steps involved and I won't be going into details
169here. There is a copy of my build scripts in wxWindows\wxPython\distrib\msw
170
171
1721. Set an environment variable to the root of the wxWindows source
173 tree::
174
175 set WXWIN=e:\projects\wxWindows
176
1772. Copy setup0.h to setup.h
178
179 cd %WXWIN%\include\wx\msw
180 copy setup0.h setup.h
181
1823. 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
185 values::
186
187 wxDIALOG_UNIT_COMPATIBILITY 0
188 wxUSE_DEBUG_CONTEXT 1
189 wxUSE_MEMORY_TRACING 1
190 wxUSE_DIALUP_MANAGER 0
191 wxUSE_GLCANVAS 1
192 wxUSE_POSTSCRIPT 1
193 wxUSE_AFM_FOR_POSTSCRIPT 0
194
195
1964. Make a %WXWIN%\BIN directory and add it to the PATH. My build
197 scripts will copy the wxWindows DLLs there.
198
1995. Change to the %WXWIN%\build\msw directory and copy my build scripts
200 there.
201
2026. 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::
205
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
212
213 For example::
214
215 .make hybrid
216
217
2187. 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
220
221
2228. 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
229 it.
230
231 Change to the wxWindows\wxPython dir and run the this command::
232
233 cd %WXWIN%\wxPython
234 python setup.py build_ext --inplace
235
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::
239
240 USE_SWIG=1 SWIG=e:\projects\SWIG-cvs\swig.exe
241
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.
247
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
251 wx package.
252
253
2549. To run code with the development verison of wxPython, just set the
255 PYTHONPATH to the wxPython dir in the CVS tree. For example::
256
257 set PYTHONPATH=e:\projects\wxWindows\wxPython
258 cd e:\projects\wxWindows\wxPython
259 python demo.py
260