~ubuntu-branches/ubuntu/edgy/swig1.3/edgy

« back to all changes in this revision

Viewing changes to Doc/Manual/Windows.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:16:04 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205011604-ygx904it6413k3go
Tags: 1.3.27-1ubuntu1
Resynchronise with Debian again, for the new subversion packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
<html>
3
3
<head>
4
4
<title>Getting started on Windows</title>
 
5
<link rel="stylesheet" type="text/css" href="style.css">
5
6
</head>
6
7
 
7
8
<body bgcolor="#ffffff">
8
9
<H1><a name="Windows"></a>3 Getting started on Windows </H1>
9
10
<!-- INDEX -->
 
11
<div class="sectiontoc">
10
12
<ul>
11
13
<li><a href="#Windows_nn2">Installation on Windows</a>
12
14
<ul>
36
38
<li><a href="#examples_cygwin">Running the examples on Windows using Cygwin</a>
37
39
</ul>
38
40
</ul>
 
41
</div>
39
42
<!-- INDEX -->
40
43
 
41
44
 
42
45
 
 
46
<p>
43
47
This chapter describes SWIG usage on Microsoft Windows. 
44
48
Installing SWIG and running the examples is covered as well as building the SWIG executable.
45
49
Usage within the Unix like environments MinGW and Cygwin is also detailed.
 
50
</p>
46
51
 
47
52
 
48
53
<H2><a name="Windows_nn2"></a>3.1 Installation on Windows</H2>
49
54
 
50
55
 
 
56
<p>
51
57
SWIG does not come with the usual Windows type installation program, however it is quite easy to get started. The main steps are:
 
58
</p>
52
59
<ul>
53
60
        <li>Download the swigwin zip package from the <a href="http://www.swig.org">SWIG website</a> and unzip into a directory. This is all that needs downloading for the Windows platform.
54
61
        <li>Set environment variables as described in the <a href="#examples">SWIG Windows Examples</a> section in order to run examples using Visual C++.
57
64
<H3><a name="Windows_nn3"></a>3.1.1 Windows Executable</H3>
58
65
 
59
66
 
 
67
<p>
60
68
The swigwin distribution contains the SWIG Windows executable, swig.exe, which will run on 32 bit versions of Windows, ie Windows 95/98/ME/NT/2000/XP. 
61
69
If you want to build your own swig.exe have a look at <a href="#swig_exe">Building swig.exe on Windows</a>.
 
70
</p>
62
71
 
63
72
 
64
73
<H2><a name="examples"></a>3.2 SWIG Windows Examples</H2>
65
74
 
66
75
 
 
76
<p>
67
77
Using Microsoft Visual C++ is the most common approach to compiling and linking SWIG's output. 
68
78
The Examples directory has a few Visual C++ project files (.dsp files). 
69
79
These were produced by Visual C++ 6, although they should also work in Visual C++ 5. 
71
81
The C# examples come with .NET 2003 solution (.sln) and project files instead of Visual C++ 6 project files.
72
82
The project files have been set up to execute SWIG in a custom build rule for the SWIG interface (.i) file. 
73
83
Alternatively run the <a href="#examples_cygwin">examples using Cygwin</a>.
 
84
 
74
85
<p>
75
 
 
76
86
More information on each of the examples is available with the examples distributed with SWIG (Examples/index.html).
77
87
 
78
88
<H3><a name="Windows_nn5"></a>3.2.1 Instructions for using the Examples with Visual Studio</H3>
79
89
 
80
90
 
 
91
<p>
81
92
Ensure the SWIG executable is as supplied in the SWIG root directory in order for the examples to work. 
82
93
Most languages require some environment variables to be set <b>before</b> running Visual C++. 
83
94
Note that Visual C++ must be re-started to pick up any changes in environment variables. 
84
95
Open up an example .dsp file, Visual C++ will create a workspace for you (.dsw file). 
85
96
Ensure the Release build is selected then do a Rebuild All from the Build menu.
86
 
The required environment variables are displayed with their current values. <p>
87
 
 
 
97
The required environment variables are displayed with their current values.
 
98
</p>
 
99
<p>
88
100
The list of required environment variables for each module language is also listed below.
89
101
They are usually set from the Control Panel and System properties, but this depends on which flavour of Windows you are running.
90
102
If you don't want to use environment variables then change all occurences of the environment variables in the .dsp files with hard coded values.
91
103
If you are interested in how the project files are set up there is explanatory information in some of the language module's documentation.
 
104
</p>
92
105
 
93
106
<H4><a name="Windows_nn6"></a>3.2.1.1 Python</H4>
94
107
 
95
108
 
 
109
<p>
96
110
<b><tt>PYTHON_INCLUDE</tt></b> : Set this to the directory that contains python.h<br>
97
111
<b><tt>PYTHON_LIB</tt></b> : Set this to the python library including path for linking<p>
98
112
Example using Python 2.1.1:<br>
100
114
PYTHON_INCLUDE: d:\python21\include<br>
101
115
PYTHON_LIB: d:\python21\libs\python21.lib<br>
102
116
</tt>
 
117
</p>
103
118
 
104
119
<H4><a name="Windows_nn7"></a>3.2.1.2 TCL</H4>
105
120
 
106
121
 
 
122
<p>
107
123
<b><tt>TCL_INCLUDE</tt></b> : Set this to the directory containing tcl.h<br>
108
124
<b><tt>TCL_LIB</tt></b> : Set this to the TCL library including path for linking<p>
109
125
Example using ActiveTcl 8.3.3.3 <br>
111
127
TCL_INCLUDE: d:\tcl\include<br>
112
128
TCL_LIB: d:\tcl\lib\tcl83.lib<br>
113
129
</tt>
 
130
</p>
114
131
 
115
132
<H4><a name="Windows_nn8"></a>3.2.1.3 Perl</H4>
116
133
 
117
134
 
 
135
<p>
118
136
<b><tt>PERL5_INCLUDE</tt></b> : Set this to the directory containing perl.h<br>
119
137
<b><tt>PERL5_LIB</tt></b> : Set this to the Perl library including path for linking<p>
120
138
Example using nsPerl 5.004_04:<p>
122
140
PERL5_INCLUDE: D:\nsPerl5.004_04\lib\CORE<br>
123
141
PERL5_LIB: D:\nsPerl5.004_04\lib\CORE\perl.lib<br>
124
142
</tt>
 
143
</p>
125
144
 
126
145
<H4><a name="Windows_nn9"></a>3.2.1.4 Java</H4>
127
146
 
128
147
 
 
148
<p>
129
149
<b><tt>JAVA_INCLUDE</tt></b> : Set this to the directory containing jni.h<br>
130
150
<b><tt>JAVA_BIN</tt></b> : Set this to the bin directory containing javac.exe<p>
131
151
Example using JDK1.3:<br>
133
153
JAVA_INCLUDE: d:\jdk1.3\include<br>
134
154
JAVA_BIN: d:\jdk1.3\bin<br>
135
155
</tt>
 
156
</p>
136
157
 
137
158
<H4><a name="Windows_nn10"></a>3.2.1.5 Ruby</H4>
138
159
 
139
160
 
 
161
<p>
140
162
<b><tt>RUBY_INCLUDE</tt></b> : Set this to the directory containing ruby.h<br>
141
163
<b><tt>RUBY_LIB</tt></b> : Set this to the ruby library including path for linking<p>
142
164
Example using Ruby 1.6.4:<br>
144
166
RUBY_INCLUDE: D:\ruby\lib\ruby\1.6\i586-mswin32<br>
145
167
RUBY_LIB: D:\ruby\lib\mswin32-ruby16.lib<br>
146
168
</tt>
 
169
</p>
147
170
 
148
171
<H4><a name="Windows_nn11"></a>3.2.1.6 C#</H4>
149
172
 
150
173
 
 
174
<p>
151
175
The C# examples do not require any environment variables to be set as a C# project file is included.
152
176
Just open up the .sln solution file in Visual Studio .NET 2003 and do a Rebuild All from the Build menu.
153
177
The accompanying C# and C++ project file are automatically used by the solution file.
 
178
</p>
154
179
 
155
180
<H3><a name="Windows_nn12"></a>3.2.2 Instructions for using the Examples with other compilers</H3>
156
181
 
157
182
 
 
183
<p>
158
184
If you do not have access to Visual C++ you will have to set up project files / Makefiles for your chosen compiler. There is a section in each of the language modules detailing what needs setting up using Visual C++ which may be of some guidance. Alternatively you may want to use Cygwin as described in the following section.
 
185
</p>
159
186
 
160
187
<H2><a name="Windows_nn13"></a>3.3 SWIG on Cygwin and MinGW</H2>
161
188
 
162
189
 
 
190
<p>
163
191
SWIG can also be compiled and run using <a href="http://www.cygwin.com">Cygwin</a> or <a href="http://www.mingw.org">MinGW</a> which provides a Unix like front end to Windows and comes free with gcc, an ANSI C/C++ compiler. However, this is not a recommended approach as the prebuilt executable is supplied. 
 
192
</p>
164
193
 
165
194
<H3><a name="swig_exe"></a>3.3.1 Building swig.exe on Windows</H3>
166
195
 
167
196
 
 
197
<p>
168
198
If you want to replicate the build of swig.exe that comes with the download, follow the MinGW instructions below.
169
199
This is not necessary to use the supplied swig.exe. 
170
200
This information is provided for those that want to modify the SWIG source code in a Windows environment. 
171
201
Normally this is not needed, so most people will want to ignore this section. 
 
202
</p>
172
203
 
173
204
<H4><a name="Windows_nn15"></a>3.3.1.1 Building swig.exe using MinGW and MSYS</H4>
174
205
 
182
213
<H4><a name="Windows_nn16"></a>3.3.1.2 Building swig.exe using Cygwin</H4>
183
214
 
184
215
 
 
216
<p>
185
217
Note that SWIG can also be built using Cygwin.
186
218
However, the SWIG will then require the Cygwin DLL when executing. 
187
219
Follow the Unix instructions in the README file in the SWIG root directory.
188
220
Note that the Cygwin environment will also allow one to regenerate the autotool generated files which are supplied with the release distribution. 
189
221
These files are generated using the <tt>autogen.sh</tt> script and will only need regenerating in circumstances such as changing the build system.
 
222
</p>
190
223
 
191
224
<H4><a name="Windows_nn17"></a>3.3.1.3 Building swig.exe alternatives</H4>
192
225
 
193
226
 
 
227
<p>
194
228
If you don't want to install Cygwin or MinGW, use a different compiler to build 
195
229
SWIG. For example, all the source code files can be added to a Visual C++ project 
196
230
file in order to build swig.exe from the Visual C++ IDE.
 
231
</p>
197
232
 
198
233
 
199
234
<H3><a name="examples_cygwin"></a>3.3.2 Running the examples on Windows using Cygwin</H3>
200
235
 
201
236
 
 
237
<p>
202
238
The examples and test-suite work as successfully on Cygwin as on any other Unix operating system. 
203
239
The modules which are known to work are Python, Tcl, Perl, Ruby, Java and C#.
204
240
Follow the Unix instructions in the README file in the SWIG root directory to build the examples.
 
241
</p>
205
242
 
206
243
</body>
207
244
</html>