File: wx321.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (90 lines) | stat: -rw-r--r-- 4,915 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<HTML>
<head><title>Building wxPython</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="wxpbuild"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx317.htm#wxPython"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx320.htm#wxpother"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx322.htm#wxpusing"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>Building wxPython</H2>
<P>
I used SWIG (<A HREF="http://www.swig.org">http://www.swig.org</A>) to
create the source code for the extension module.  This enabled me to
only have to deal with a small amount of code and only have to bother
with the exceptional issues.  SWIG takes care of the rest and
generates all the repetative code for me.  You don't need SWIG to
build the extension module as all the generated C++ code is included
under the src directory.  If you try to build wxPython and get errors
because SWIG is missing, then simply touch the .cpp and .py files so
make won't attempt to build them from the .i files.<P>
I added a few minor features to SWIG to control some of the code
generation.  If you want to play around with this the patches are in
wxPython/SWIG.patches and they should be applied to the 1.1p5 version
of SWIG.  These new patches are documented at 
<A HREF="http://starship.skyport.net/crew/robind/python/#swig">this site</A>,
and they should also end up in the 1.2 version of SWIG.<P>
wxPython is organized as a Python package.  This means that the
directory containing the results of the build process should be a
subdirectory of a directory on the <TT>PYTHONPATH</TT>, (and preferably
should be named wxPython.)  You can control where the build process
will dump wxPython by setting the <TT>TARGETDIR</TT> makefile variable.
The default is <TT>$(WXWIN)/utils/wxPython</TT>.  If you leave it here
then you should add <TT>$(WXWIN)/utils</TT> to your <TT>PYTHONPATH</TT>.
However, you may prefer to use something that is already on your 
<TT>PYTHONPATH</TT>, such as the <TT>site-packages</TT> directory on Unix
systems.<P>
<B><FONT COLOR="#FF0000">Win32</FONT></B><P>
These instructions assume that you have Microsoft Visual C++ 5.0 or
6.0, that you have installed the command-line tools, and that the
appropriate environment variables are set for these tools.  You should
also have Python 1.5.1 installed, and wxWindows installed and built as
specified below.<P>
<OL>

<LI> Build wxWindows with <TT>wxUSE_RESOURCE_LOADING_IN_MSW</TT> set to 1 in
<TT>include/wx/msw/setup.h</TT> so icons can be loaded dynamically.  While
there, make sure <TT>wxUSE_OWNER_DRAWN</TT> is also set to 1.
<LI> Change into the <TT>$(WXWIN)/utils/wxPython/src</TT> directory.
<LI> Edit makefile.vc and specify where your python installation is at.
You may also want to fiddle with the <TT>TARGETDIR</TT> variable as described
above.
<LI> Run <TT>nmake -f makefile.vc</TT>
<LI> If it builds successfully, congratulations!  Move on to the next
step.  If not then you can try mailing the wxwin-developers list for
help.  Also, I will always have a pre-built win32 version of this extension module at 
<A HREF="http://alldunn.com/wxPython">http://alldunn.com/wxPython</A>.
<LI> Change to the <TT>$(WXWIN)/utils/wxPython/tests</TT> directory.
<LI> Try executing the test programs.  Note that some of these print
diagnositc or test info to standard output, so they will require the
console version of python.  For example:<P>
<TT>python test1.py</TT><P>
To run them without requiring a console, you can use the <TT>pythonw.exe</TT>
version of Python either from the command line or from a shortcut.
</OL>
<P>
<B><FONT COLOR="#FF0000">Unix</FONT></B><P>
These directions assume that you have already successfully built
wxWindows for GTK, and installed Python 1.5.1.  If you build Python
yourself, you will get everything installed that you need simply by
doing <B><TT>make install</TT></B>.  If you get Python from an RPM or other
pre-packaged source then there will probably be a separate package
with the development libraries, etc. that you will need to install.<P>

<OL>

<LI> Change into the <TT>$(WXWIN)/utils/wxPython/src</TT> directory.
<LI> Edit <TT>Setup.in</TT> and ensure that the flags, directories, and toolkit
options are correct, (hopefully this will be done by <TT>configure</TT>
soon.)  See the above commentary about <TT>TARGETDIR</TT>.  There are a
few sample Setup.in.[platform] files provided.
<LI> Run this command to generate a makefile:<P>
<TT>make -f Makefile.pre.in boot</TT><P>
<LI> Once you have the <TT>Makefile</TT>, run <B><TT>make</TT></B> to build and then 
<B><TT>make install</TT></B> to install the wxPython extension module.
<LI> Change to the <TT>$(WXWIN)/utils/wxPython/tests</TT> directory.
<LI> Try executing the test programs.  For example:<P>
<TT>python test1.py</TT>
</OL>
<P>


</BODY></HTML>