40
40
<p>In the text below I'll use WXDIR with environment variable syntax
41
41
(either $WXDIR or %WXDIR%) to refer to the top level directory where
42
42
your wxWidgets and wxPython sources are located. It will equate to
43
whereever you checked out the wxWidgets module from CVS, or untarred
43
where ever you checked out the wxWidgets code from SVN, or untarred
44
44
the wxPython-src tarball to. You can either substitute the $WXDIR text
45
45
below with your actual dir, or set the value in the environment and
46
46
use it just like you see it below.</p>
47
47
<p>If you run into what appears to be compatibility issues between
48
48
wxWidgets and wxPython while building wxPython, be sure you are using
49
49
the wxWidgets sources included with the wxPython-src tarball or the
50
CVS snapshot, and not a previously installed version or a version
50
SVN snapshot, and not a previously installed version or a version
51
51
installed from one of the standard wxWidgets installers. With the
52
52
"unstable" releases (have a odd-numbered minor release value, where
53
53
the APIs are allowed to change) there are often significant
428
<div class="section">
429
<h1><a id="building-on-windows-with-cygwin-mingw32" name="building-on-windows-with-cygwin-mingw32">Building on Windows with Cygwin/MingW32</a></h1>
430
<p>Starting with release 2.8.6.1 wxPython is also able to be built for
431
the stock Python on Windows using the cywin environnment and the
432
mingw32 compiler. It can probably also be done with a few
433
modifications to these instructions without cygwin, using just the
434
standalone mingw32 compiler and MSYS, but that has not been tested
435
yet. Another potential option is to build wxWidgets and wxPython for
436
cygwin and the cygwin version of Python, but the details for that also
437
has not yet been worked out. If you do work out the details then
438
please send me patches for this document.</p>
439
<p>This build has some aspects of both of the builds desctibed above, but
440
leans more towards the Unix-like style of doing things. If you have
441
any questions about the steps detailed in these instructions please
442
read the above sections as well, as the answer could be there.</p>
444
<li><p class="first">If you don't already have cygwin installed on your Windows box
445
please do so know. Make sure you have these additional packages
446
installed as well:</p>
462
<li><p class="first">Create a build directory in the main wxWidgets dir, and configure
463
wxWidgets. Notice that we set some environment variables so
464
configure will know to override the defaults for some compiler and
465
linker flags settings, this is what causes the mingw32 compiler to
466
be used even though we are in the full cygwin environment:</p>
467
<pre class="literal-block">
472
CC="gcc -mno-cygwin -mwindows" \
473
CXX="g++ -mno-cygwin -mwindows" \
474
LDFLAGS="-mno-cygwin -mwindows" \
477
--build=i686-pc-mingw32 \
478
--prefix=/opt/wx/2.8 \
485
--with-expat=builtin \
486
--with-regex=builtin \
489
<p>Read the note above in the unix-like section for why I used
490
/opt/wx/2.8 for the prefix, and for some discussion about what your
491
options are. For a cygwin environment the default of using
492
/usr/local for the prefix would also be a good choice. Note that
493
the wx DLLs will be installed to {prefix}/lib and since DLLs need
494
to be found in the PATH you'll either want to add that dir to your
495
PATH if it isn't already there, or be prepared to move those DLLs
496
someplace else when the build is finished.</p>
497
<p>If you don't need to use the debugger you can leave off the
498
--enable-debug and --enable-debug_gdb flags, and add the
499
--enable-optimise flag to cause the compiler to generate more
500
efficient code. I recommend that you also add the
501
--enable-debug_flag flag so that some C++ runtime checks will be
502
turned into Python exceptions when they fail.</p>
504
<li><p class="first">To build and install wxWidgets you could just use the "make"
505
command but there are a couple other libraries besides the main
506
wxWidgets libs that also need to be built so I make a script called
507
".make" to do it all for me so I don't forget anything. This is
508
what it looks like:</p>
509
<pre class="literal-block">
511
&& make -C contrib/src/gizmos $* \
512
&& make -C contrib/src/stc $*
514
<p>So you just use .make as if it where make:</p>
515
<pre class="literal-block">
519
<p>This is going to take a while as GCC on Windows is very slow. This
520
would be a good time to go take a nap, or have dinner, or both.
521
When it's done you should have an installed set of files under
522
/opt/wx/2.8 (or whatever prefix you used) containing just
523
wxWidgets. Now to use this version of wxWidgets you just need to
524
add /opt/wx/2.8/bin and /opt/wx/2.8/lib to the PATH.</p>
526
<li><p class="first">Building wxPython is very similar to how it is done for the other
527
build styles. We simply run the setup.py in the wxPython dir, and
528
pass it some commands and flags. Make sure that the Python that
529
you use for running setup.py is the one that you want to use when
530
running wxPython apps. In other words, if you have the cygwin
531
Python installed, or multiple versions of stock Windows Python,
532
then use the full pathname to python.exe to make sure you use the
535
<dl class="docutils">
536
<dt>python setup.py COMPILER=mingw32 </dt>
537
<dd><p class="first last">BUILD_GLCANVAS=0 BUILD_ACTIVEX=0 WX_CONFIG="bash.exe -e /opt/wx/2.8/bin/wx-config" build_ext --inplace</p>
541
<p>This builds the wxPython extension modules and places them directly
542
in the wx package dir located in the source tree. This is
543
convenient for testing the build or running the demo and samples
544
without needing to do an install to site-packages and possibly
545
disturbing the wxPython you already have installed. You just need
546
to set PYTHONPATH so Python will find this version of the wx
547
package first. When you are ready to install this build you can do
548
it by adding 'install' to the command line and running it again.
549
See the INSTALL.txt file for more details.</p>
550
<p>Notice that we had to turn off the building of the wx.glcanvas and
551
wx.activex modules. There are also a few other features that are
552
not currently supported by this build, most notably the
553
wx.GraphicsContext and wx.media.MediaCtrl families of classes.
554
Hopefully that will improve over time.</p>