]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wxSWIG/README
added clipping test
[wxWidgets.git] / wxPython / wxSWIG / README
1 SWIG (Simplified Wrapper and Interface Generator)
2 Version 1.1 (Maintenance)
3
4 Copyright (C) 1995-1999
5 University of Utah and the Regents of the University of California
6
7 August 8, 1999
8
9 1. Introduction
10 ---------------
11 SWIG is a compiler that attempts to make it easy to integrate C, C++,
12 or Objective-C code with scripting languages including Perl, Tcl, and
13 Python. In a nutshell, you give it a bunch of ANSI C/C++ declarations
14 and it generates an interface between C and your favorite scripting
15 language. However, this is only scratching the surface of what SWIG
16 can do--some of its more advanced features include automatic
17 documentation generation, module and library management, extensive
18 customization options, and more.
19
20 SWIG is entirely the product of users who have used the system and
21 suggested new ideas. There are far too many people to thank
22 individually, but without this support, SWIG would be not be nearly as
23 powerful or fun to use as it is now. Many thanks!
24
25 2. Currently Supported Languages
26 ----------------------------------
27
28 To use SWIG, you will need at least one of the following scripting
29 languages :
30
31 Tcl7.3, Tk3.6 (and all newer versions)
32 Tcl8.0, Tk8.0 (somewhat experimental)
33 Python1.3 (or newer)
34 Perl5.003 (or newer)
35 Perl4
36 FSF Guile 1.0 (experimental)
37
38 If you don't have any of these, SWIG will still compile, but it won't
39 be particularly useful. Note : it is not necessary to have *all* of
40 these languages installed to use SWIG--only the scripting languages you
41 want to use.
42
43 3. Installation (Unix)
44 ------------------------
45
46 To compile and use SWIG, you will need the following on your machine:
47
48 A C++ compiler (ie. g++)
49 An ANSI C compiler (ie. gcc)
50 yacc or bison (only needed if you are going to rebuild the SWIG parser)
51
52 To compile and install SWIG, type the following :
53
54 ./configure
55 make
56 make runtime (optional. see below)
57 make install
58
59 The configuration script will attempt to locate various packages on
60 your machine, including Tcl, Perl5, and Python. Don't panic if
61 you get 'not found' messages--SWIG does not need these packages
62 to compile or run. The configure script is actually looking for
63 these packages so that you can try out the SWIG examples contained
64 in the 'Examples' directory without having to hack Makefiles.
65 See the Examples section below for more details.
66
67 The 'make runtime' option is an optional step that can be used to
68 build the SWIG runtime libraries. These libraries are only used with
69 larger packages and are not necessary for learning SWIG or trying
70 the examples (please refer to the "Advanced topics" section of the
71 SWIG Users manual for more details about this).
72
73 Typing 'make test' will run a rather extensive series of tests
74 and can be run before running 'make install' (if you are paranoid).
75
76 There are a number of configuration options that you can give to
77 'configure' :
78
79 --prefix=/usr/local
80
81 Set the installation prefix. SWIG installs into
82 /usr/local by default.
83
84 --exec_prefix=/usr/local
85
86 Set the prefix used to install platform specific
87 files (binaries and libraries). Use this if the
88 location is different than that given with --prefix.
89
90 --with-lang={TCL,TCL8,PYTHON,PERL5,PERL4,GUILE}
91
92 This lets you choose the default SWIG target language.
93 By default, SWIG chooses TCL, but you can select
94 another as shown :
95
96 ./configure --with-lang=PYTHON
97
98 --with-doc={ASCII,LATEX,HTML,NODOC}
99
100 This lets you choose the default SWIG documentation
101 method. By default, SWIG chooses ASCII.
102
103
104 4. Site specific installation
105 -------------------------------
106
107 While not required for compiling SWIG, the configuration script looks
108 for various packages in order to create a makefile for compiling the
109 examples. This makefile is also installed with the SWIG package.
110 The following configuration options can be used to set the location
111 of various packages.
112
113 --with-tcl=pathname - Set root directory of Tcl installation.
114 SWIG will use $pathname/include and
115 $pathname/lib.
116
117 --with-tclincl=pathname - Set exact location of Tcl include files
118
119 --with-tcllib=pathname - Set exact location of Tcl library files
120
121 --with-itcl=pathname - Same as above but for [incr Tcl]
122
123 --with-itclincl=pathname - Location of [incr Tcl] include files
124
125 --with-itcllib=pathname - Location of [incr Tcl] libraries
126
127 --with-py=pathname - Set package location of Python. This is usually
128 something like /usr/local. configure will attempt
129 to locate the appropriate include and library files.
130
131 --with-pyincl=pathname - Set location of Python include files
132 (for example, /usr/local/include)
133
134 --with-pylib=pathname - Set location of Python library files
135 (for example, /usr/local/lib)
136
137 --with-perl5=executable - Specify your perl5 executable. SWIG will figure
138 out where files are by running this version of
139 Perl and grabbing its configuration data.
140
141
142 Other options :
143
144 --without-yacc - Try to compile SWIG using a pregenerated YACC
145 file generated by Berkeley YACC (byacc). Only recommended
146 if you get compiler errors when trying to compile parser.y
147 or parser.cxx.
148
149 Changing the C++ compiler:
150
151 By default, SWIG will look for g++. You can change the C++ compile as follows :
152
153 env CXX=CC configure --prefix=/usr/local ... etc...
154
155 or
156
157 setenv CXX=CC
158 ./configure ... etc ...
159
160 SWIG has been successfully compiled and tested under g++, the SGI C++
161 compiler, and the SunPro C++ compiler.
162
163 5. Testing
164 -----------
165 The SWIG parser and language modules can be tested by typing 'make test'.
166 Be forewarned, this runs a large collection of tests on all of SWIG's
167 language modules and documentation methods. The tests may take 5-10
168 minutes to run, but a report of errors will be written to 'test.log'.
169 If this exists, it will contain error messages for failed tests. If
170 the file is missing, it means all tests were considered successful.
171
172 The testing process requires approximately 30-40 Mbytes of disk space.
173 After testing, you may wish to type 'make testclean' which will
174 return the testing directory to its original state.
175
176 Note : The testing procedure requires both 'sh' and 'perl'. If you
177 don't have these installed, some of the tests won't work.
178
179 6. Installation for Windows 95 and NT
180 -------------------------------------
181
182 The Win directory contains makefiles for Microsoft Visual C++ 4.x/5.x and
183 Borland C++. See the README.txt file in the Win directory for specific
184 build instructions. Many thanks to Kevin Butler (butler@cs.byu.edu)
185 and Pier Giorgio Esposito for supplying these Makefiles.
186
187 7. Installation for Macintosh
188 -----------------------------
189
190 A Macintosh version of SWIG is available separately as a PowerPC
191 executable. A source version is also available, but is somewhat
192 complicated to build due to dependencies on other packages
193 including Tcl 8.0. Please refer to the SWIG homepage for more
194 information.
195
196 8. Examples
197 ------------
198
199 The 'Examples' directory contains examples for all of the supported
200 scripting languages. All of the examples rely on the file
201 'Makefile.template' located in the top-level directory. This makefile
202 is created by 'configure', but the configuration process is not
203 foolproof. To check this Makefile type
204
205 make testbuild
206
207 This will attempt to build various kinds of extensions and report its
208 success or failure. If this fails, you may need to edit the file
209 'Makefile.template' by hand. This usually isn't difficult--just
210 follow the instructions contained within the file. Once the 'make
211 testbuild' works for the language you are interested in using, you
212 should be able to build the examples.
213
214 The examples will not compile properly if you have not installed SWIG.
215 If you would like to try the examples before installation, set the
216 SWIG_LIB environment variable as follows :
217
218 setenv SWIG_LIB ${pathname}/SWIG1.1/swig_lib
219
220 Where ${pathname} the location of the SWIG source.
221
222 *** NOTE *** If you are replacing an older version of SWIG with a new
223 one, the examples may not compile correctly unless you set the
224 above environment variable or do a 'make install' first.
225
226 9. Resources
227 --------------
228
229 Up-to-date SWIG related information can be found at
230
231 http://www.swig.org
232
233 SWIG source code and software updates are also available via anonymous
234 ftp at
235
236 ftp://ftp.swig.org
237
238
239 You can join the SWIG mailing list by going to the following location:
240
241 http://www.cs.uchicago.edu/mailman/listinfo/swig
242
243 The SWIG mailing list is a forum for discussing various applications
244 of SWIG, installation problems, ideas for system improvements and
245 future work.
246
247 *** NEWSFLASH *** SWIG development has moved to the Univerity of
248 Chicago. Developer information can be found at
249
250 http://swig.cs.uchicago.edu
251
252 10. Installation Problems
253 -------------------------
254
255 As far as I know the installation works on the following platforms :
256
257 - SunOS 4.1.3
258 - Solaris
259 - Irix 5.3
260 - Irix 6.2
261 - HPUX
262 - AIX 4.1
263 - Linux
264 - MkLinux
265 - MachTen
266 - UNICOS
267 - Windows 95
268 - Windows NT 4.0
269 - MacOS System 7.5.3
270
271 SWIG development takes place primarily on Linux and Solaris 2.6. I've
272 tested most of the examples on these platforms. I have also tested
273 SWIG under Win95 and MacOS, but that is still somewhat experimental.
274
275 If you've tried everything and can't get SWIG to compile, please send
276 me e-mail at beazley@cs.uchicago.edu, and we'll try to figure it out.
277 I try to answer all e-mail that I receive. However, occasionally I
278 receive messages with bad return addresses and can't respond. If you
279 don't hear back within a few days, try sending a message to
280 'swig@cs.uchicago.edu'.
281
282 11. Documentation
283 -----------------
284
285 Over 300 pages of documentation describing almost every aspect of SWIG
286 is available in the Doc directory. Don't let the amount of
287 documentation scare you--SWIG is easy enough to use that you can
288 probably start using it by only looking at a few simple examples.
289 However, at some point you will probably want to know more so I hope
290 that the manual will come in useful. Besides, I hate black boxes...
291
292 The documentation is distributed in Adobe PDF format and can be viewed
293 using the Adobe Acrobat Reader. Acrobat is available for virtually
294 all machines and can be freely obtained from Adobe at www.adobe.com.
295 Postscript and HTML versions of the manual are also available from the
296 SWIG FTP site.
297
298 12. Incompatibilities
299 ---------------------
300
301 This release should be mostly compatible with SWIG 1.0
302 (Final). However, the SWIG documentation system has been completely
303 rewritten and the C API has been changed greatly. It is unlikely that
304 any custom SWIG language modules written in C++ for 1.0 will work with
305 1.1. While porting to 1.1 is not that difficult, there are a number
306 of important changes. See the file 'Doc/Porting' for a list of
307 changes to the C++ API and how to convert an older SWIG module to work
308 with 1.1.
309
310 13. Bug Reports
311 ----------------
312
313 Bug reports should be submitted to the online bug-tracking system
314 which is available at :
315
316 http://swig.cs.uchicago.edu/cgi-bin/swig
317
318 Before submitting a bug, please check this site to see if it has
319 already been reported. If not, provide as much information as
320 possible including the SWIG version number, operating system, and
321 compiler being used. Note : I tend to fix bugs in batches and may
322 only respond to a bug report when it has actually been fixed---posting
323 to the mailing list is often a better way to get an immediate response
324 to a problem.
325
326 14. Legal Stuff
327 ---------------
328 SWIG is completely free and non-proprietary. You can do whatever you
329 want with it (including distribution), provided that you follow these
330 rules, 1) Keep all of the copyright notices intact, 2) don't claim
331 that you wrote it, and 3) Don't sue anyone if it breaks. Otherwise,
332 have fun.
333
334 15. Disclaimer
335 ----------------
336
337 While I believe that SWIG is reasonably stable, I'm always tinkering
338 with it and trying to make it better. There may be a few bugs hiding
339 around so if you experience any problems let me know. If you think
340 that SWIG is missing some capability that would be useful to have
341 have, post a message on the SWIG mailing list. Most of the previous
342 suggestions have already been incorporated into this release.
343
344 16. Acknowledgments
345 ---------------------
346
347 SWIG would not be possible without the contributions of people who
348 tried out the beta versions and offered feedback and bug reports.
349 While there are far too many people to list at point, I'd like to
350 especially acknowledge the following individuals and organizations
351 for supporting SWIG and making major contributions :
352
353 David Ascher, Erik Bierwagen, Kurtis Bleeker, John Buckman, Kevin
354 Butler, Pier Giorgio Esposito, David Fletcher, Mark Hammond, Mark
355 Harrison, Brad Holian, Gary Holt, Chris Johnson, Peter Lomdahl, Mark
356 Lutz, Chris Myers, Paul Saxe, John Schmidt, Tom Schwaller, Peter-Pike
357 Sloan, Patrick Tullmann, Larry Virden, Tser-Yuan Yang, Shujia Zhou.
358
359 and
360
361 Los Alamos National Laboratory
362 Lawrence Livermore National Laboratory
363 Cornell Theory Center
364 University of Utah
365 The Scientific Computing and Imaging Group (University of Utah)
366
367 (My apologies to anyone I missed...)
368
369 If you find SWIG to be useful, I'd like to know about it.
370
371 Enjoy!
372
373 Dave Beazley
374 Department of Computer Science
375 University of Chicago
376 Chicago, IL 60637
377 beazley@cs.uchicago.edu
378
379
380
381