]> git.saurik.com Git - wxWidgets.git/blame - wxPython/BUILD.win32.txt
fix order of initializiton of rootless treectrl
[wxWidgets.git] / wxPython / BUILD.win32.txt
CommitLineData
c368d904
RD
1Building wxPython on Win32
2--------------------------
3
4
5Building wxPython for use on win32 systems is a fairly simple process
6consisting of just a few steps. However depending on where you get
7your sources from and what your desired end result is, there are
8several permutations of those steps. At a high level the basic steps
9are:
10
11 1. Get the wxWindows sources
12 2. Build the wxWindows DLL
13 3. Get the wxPython sources
14 4. Build and Install wxPython
15
16We'll go into more detail of each of these steps below, but first a
17few bits of background information on tools.
18
19I use a tool called SWIG (http://www.swig.org) to help generate the
20C++ sources used in the wxPython extension module. However you don't
21need to have SWIG unless you want to modify the *.i files. If you do
9df61a29
RD
22you'll want to have version 1.1-883 of SWIG and you'll need to apply
23the patches and updates in wxPython/SWIG and rebuild it. Then you'll
24need to change a flag in the setup.py script as described below so the
25wxPython build process will use SWIG if needed.
c368d904
RD
26
27I use the new Python Distutils tool to build wxPython. It is included
28with Python 2.0, but if you want to use Python 1.5.2 or 1.6 then
29you'll need to download and install Distutils 1.0 from
30http://www.python.org/sigs/distutils-sig/
31
32I use Microsoft Visual C++ 6.0 (5.0 with the service packs should work
33also) to compile the wxPython C++ sources. Since I am using Distutils
34it should be easier now to build with other win32 compilers such as
35the free mingw32 or Borland compilers, but I havn't tried them yet.
36If anybody wants to try it I'll take any required patches for the
37setup script and for these instructions.
38
39And now on to the fun stuff...
40
41
42
431. Get the wxWindows sources
44----------------------------
45
46A. There are a few possible ways to get sources for wxWindows. You
47 can download a released version from http://wxwindows.org/ or you
48 can get current development sources from the CVS server. (Some
49 information about annonymous CVS access is at
50 http://wxwindows.org/cvs.htm.) The advantage of using CVS is that
51 you can easily update as soon as the developers check in new
52 sources or fixes. The advantage of using a released version is
53 that it usually has had more testing done. You can decide which
54 method is best for you.
55
56B. You'll usually want to use wxWindows sources that have the same
57 version number as the wxPython sources you are using. (Another
58 advantage of using CVS is that you'll get both at the same time.)
59
c368d904
RD
60C. Once you get the sources be sure to put them in a path without a
61 space in it (i.e., NOT c:\Program Files\wx) and set an environment
62 variable named WXWIN to this directory. For example:
63
85112265
RD
64 mkdir \wx2
65 cd \wx2
66 unzip wxMSW-2.2.2.zip
67 set WXWIN=c:\wx2
c368d904
RD
68
69 You'll probably want to add that last line to your autoexec.bat or
70 System Properties depending on the type of system you are on.
71
72D. Change to the wx2\include\wx\msw directory and copy setup0.h to
73 setup.h and then edit setup.h. This is how you control which parts
74 of wxWindows are compiled into or left out of the build, simply by
85112265
RD
75 turning options on or off. I have the following differences from
76 the default setup0.h in my setup.h, but you can experiment with
77 other settings if you like:
c368d904 78
85112265
RD
79 wxDIALOG_UNIT_COMPATIBILITY 0
80 wxUSE_GLOBAL_MEMORY_OPERATORS 0
81 wxUSE_DEBUG_NEW_ALWAYS 0
82 wxUSE_CMDLINE_PARSER 0
83 wxUSE_DIALUP_MANAGER 0
84 wxUSE_TREELAYOUT 0
85 wxUSE_POSTSCRIPT 1
c368d904
RD
86
87
19cf4f80
RD
88 ** NEW **
89 Be sure that wxUSE_GLCANVAS is defined to be 0 as wxPython now
90 keeps its own copy of the glcanvas sources and expects that it is
926bb76c
RD
91 not in the main library. This is done to reduce the number of
92 dependant DLLs on the core library and therefore help reduce
93 startup time.
19cf4f80 94
c368d904
RD
95
96
972. Build the wxWindows DLL
98---------------------------
99
100A. Although MSVC project files are provided I always use the makefiles
101 to build wxWindows because by default the flags are compatible with
102 Python, (and I make sure they stay that way.) You would have to
103 edit the project files a bit to make it work otherwise.
104
105B. There are three different types of wxWindows DLLs that can be
106 produced by the VC makefile simply by providing a flag on the nmake
107 command-line, I call the three types DEBUG, FINAL, and HYBRID.
108 (The last one is brand new, you'll need my version of the 2.2.2
109 sources to get the HYBRID capability.) Here are some more details:
110
111 DEBUG Specified with "FINAL=0" and produces a DLL named
85112265
RD
112 wx[version]d.dll. This DLL is compiled with full
113 debugging information and with the __WXDEBUG__ set which
114 enables some debugging-only code in wxWindows such as
115 assertions and failure log messages. The /MDd flag is
116 used which means that it is linked with the debugging
117 version of the C runtime library and also that you must
118 use the debugging version of Python, (python_d.exe and
119 pythonXX_d.dll) which also means that all extensions
120 loaded by Python should also have the _d in the name.
121 With this option you can use the MSVC debugger to trace
122 though the Python interpreter, as well as the code for the
123 wxPython extension and the wxWindows DLL.
c368d904
RD
124
125 FINAL Specified with "FINAL=1" and produces a DLL named
126 wx[version].dll. This DLL is compiled with optimizations
127 turned on and without debugging information and without
128 __WXDEBUG__. The /MD flag is used which means that you
129 can use this version with the standard python.exe. This
130 is the version that I use when making the binary installer
131 for win32.
132
133 HYBRID Specified with "FINAL=hybrid" and produces a DLL named
134 wx[version]h.dll. This DLL is almost the same as the
135 DEBUG version except the /MD flag is used which means that
136 you can use the standard python.exe but you still get the
137 debugging info and the __WXDEBUG__ code enabled. With the
138 debugger you can trace through the the code for the
139 wxPython extension and the wxWindows DLL, but not the
140 Python interpreter. You might use this version when you
141 want to deploy a wxPython app with the __WXDEBUG__ code
142 enabled. I use this mode most of the time during
143 development simply because it's easier than having to
144 remember to type python_d all the time.
145
146 Since different DLL names and object file directories are used you
147 can build all three types if you like.
148
149C. Change to the wx2\src\msw directory and type the following command,
150 using the value for FINAL that you want:
151
85112265 152 nmake -f makefile.vc dll pch FINAL=hybrid
c368d904
RD
153
154 Your machine will then crunch away for possibly a long time,
155 depending on your hardware, and when it's done you should have a
156 DLL and some library files in \wx2\lib.
157
158D. You'll either need to add \wx2\lib to the PATH or copy the DLL file
159 to a directory already on the PATH so the DLL can be found at runtime.
160
161E. You can test your build by changing to one of the directories under
162 \wx2\samples or \wx2\demos and typing (using the right FINAL flag):
163
85112265 164 nmake -f makefile.vc FINAL=hybrid WXUSINGDLL=1
c368d904
RD
165
166 and then executing the resulting .exe file.
167
168
169
1703. Get the wxPython sources
171---------------------------
172
173A. You have the same options (and same advantages/disadvantages) for
174 getting the wxPython source, either a released snapshot or from
175 CVS. The released version file is named wxPython-[version].tar.gz
176 and is available at http://wxpython.org/download.php. You can use
177 WinZip to unpack it if you don't have tar and gzip. If you want to
178 use CVS you'll find wxPython in the wxWindows CVS tree (see above)
179 in the wxWindows/wxPython directory.
180
181
182
1834. Build and Install wxPython
184-----------------------------
185
186A. As mentioned previouslly, wxPython is built with the standard
187 Python Distutils tool. If you are using Python 2.0c1 or later you
188 are all set, otherwise you need to download and install Distutils
189 1.0 from http://www.python.org/sigs/distutils-sig/.
190
191B. Change to the root wxPython directory and look at the setup.py
192 file. This is the script that configures and defines all the
193 information that Distutils needs to build wxPython. There are some
194 options near the begining of the script that you may want or need
195 to change based on what options you have selected up to this point,
196 (type of DLL built, sources from tar.gz or from CVS, etc.) You can
197 either change these flags directly in setup.py or supply them on
198 the command-line.
199
85112265
RD
200 BUILD_GLCANVAS Set to zero if you don't want to build the
201 Open GL canvas extension module.
c368d904 202
85112265
RD
203 BUILD_OGL Set to zero if you don't want to build the
204 Object Graphics Library extension module.
c368d904 205
85112265
RD
206 BUILD_STC Set to zero if you don't want to build the
207 wxStyledTextCtrl (the Scintilla wrapper)
208 extension module.
c368d904 209
85112265
RD
210 USE_SWIG If you have edited any of the *.i files you
211 will need to set this flag to non-zero so SWIG
212 will be executed to regenerate the wrapper C++
213 and shadow python files.
c368d904 214
85112265
RD
215 IN_CVS_TREE If you are using the CVS version of the
216 wxWindows and wxPython sources then you will
217 need to set this flag to non-zero. This is
218 needed because some source files from the
219 wxWindows tree are copied to be under the
220 wxPython tree in order to keep Distutils happy.
221 With this flag set then setup.py will
222 automatically keep these copied sources up to
223 date if the original version is ever updated.
224 If you are using the tar.gz version of the
225 Python sources then these copied sources are
226 already present in your source tree.
c368d904
RD
227
228
229C. To build and install wxPython you simply need to execute the
230 setup.py script. If you have more than one version of Python
231 installed, be sure to execute setup.py with the version you want to
232 build wxPython for.
233
234 Depending on what kind of wxWindows DLL you built there are
235 different command-line parameters you'll want to pass to setup (in
236 addition to possibly one or more of the above):
237
85112265 238 FINAL: python setup.py install
c368d904 239
85112265 240 DEBUG: python setup.py build --debug install
c368d904 241
85112265 242 HYBRID: python setup.py HYBRID=1 install
c368d904
RD
243
244
245D. At this point you should be able to change into the wxPython\demo
246 directory and run the demo:
247
85112265 248 python demo.py
c368d904
RD
249
250E. If you would like to make a test build that doesn't overwrite the
251 installed version of wxPython you can do so with one of these
252 commands instead of the install command above:
253
85112265 254 FINAL: python setup.py build_ext --inplace
c368d904 255
85112265 256 DEBUG: python setup.py build_ext --debug --inplace
c368d904 257
85112265 258 HYBRID: python setup.py HYBRID=1 build_ext --inplace
c368d904
RD
259
260 This will build the wxPython package in the local wxPython
261 directory instead of installing it under your Python installation.
262 To run using this test version just add the base wxPython source
263 directory to the PYTHONPATH:
264
265 set PYTHONPATH=c:\wx2\wxPython
85112265
RD
266 cd c:\wx2\wxPython\demo
267 python demo.py
c368d904
RD
268
269
270That's all folks!
271
272
273-----------------
274robin@alldunn.com
275