1 | <!-- ******************************************************** --> |
---|
2 | <!-- --> |
---|
3 | <!-- [History] --> |
---|
4 | <!-- Converted to DocBook: Katsuya Amako, Aug-2006 --> |
---|
5 | <!-- --> |
---|
6 | <!-- ******************************************************** --> |
---|
7 | |
---|
8 | |
---|
9 | <!-- ******************* Section (Level#1) ****************** --> |
---|
10 | <sect1 id="sect.Cygwin"> |
---|
11 | <title> |
---|
12 | Windows with the Cygwin Toolset and Microsoft Visual C++ |
---|
13 | </title> |
---|
14 | |
---|
15 | <para> |
---|
16 | To compile and run Geant4 under Windows systems, some additional |
---|
17 | information and tools are required, although the installation |
---|
18 | produre is similar to that required on a UNIX based system. On |
---|
19 | Windows, the Cygwin toolset and the Microsoft Visual C++ compiler |
---|
20 | are used. |
---|
21 | </para> |
---|
22 | |
---|
23 | <para> |
---|
24 | Cygwin32 is a UNIX development environment available for Microsoft |
---|
25 | Windows. You can freely obtain Cygwin32 from |
---|
26 | <ulink url="http://cygwin.com/"> |
---|
27 | Cygwin |
---|
28 | </ulink> |
---|
29 | or |
---|
30 | <ulink url="http://x.cygwin.com/"> |
---|
31 | Cygwin/X |
---|
32 | </ulink> |
---|
33 | . |
---|
34 | </para> |
---|
35 | |
---|
36 | <para> |
---|
37 | We do not support direct use of Visual Studio; i.e. we do not |
---|
38 | provide Visual Studio workspace (.dsw) or project (.dsp) files, nor |
---|
39 | we do provide makefiles for the <literal>nmake</literal> application of MS |
---|
40 | Visual C++. |
---|
41 | </para> |
---|
42 | |
---|
43 | <para> |
---|
44 | We use several of the tools provided by the Cygwin toolset: |
---|
45 | |
---|
46 | <itemizedlist spacing="compact"> |
---|
47 | <listitem><para> |
---|
48 | <literal>make.exe</literal> as a make tool |
---|
49 | </para></listitem> |
---|
50 | <listitem><para> |
---|
51 | <literal>g++.exe</literal> as a tool to analyse source file dependencies |
---|
52 | and create dependency (<literal>.d</literal>) files |
---|
53 | </para></listitem> |
---|
54 | <listitem><para> |
---|
55 | several other unix tools like <literal>cp</literal>, <literal>mv</literal>, |
---|
56 | <literal>rm</literal>, <literal>touch</literal>, etc. |
---|
57 | </para></listitem> |
---|
58 | </itemizedlist> |
---|
59 | </para> |
---|
60 | |
---|
61 | <para> |
---|
62 | At the installation of the Cygwin toolset it is therefore required |
---|
63 | to explicitely select some packages (i.e. <emphasis>gmake</emphasis>, |
---|
64 | <emphasis>gcc</emphasis>, <emphasis>binutils</emphasis> |
---|
65 | and <emphasis>tcsh</emphasis> from the "devel" category) in |
---|
66 | addition to those which are part of the default installation. |
---|
67 | </para> |
---|
68 | |
---|
69 | <para> |
---|
70 | For more details on the toolset, please see the documentation |
---|
71 | available on the |
---|
72 | <ulink url="http://cygwin.com/"> |
---|
73 | Cygwin pages |
---|
74 | </ulink> |
---|
75 | . |
---|
76 | The User's Guide has quick start guides and help with |
---|
77 | setting up Cygwin with <literal>setup.exe</literal>. |
---|
78 | </para> |
---|
79 | |
---|
80 | <para> |
---|
81 | Links to some installation tips for the Cygwin toolset and also |
---|
82 | "step by step" installation guides can be found in the section |
---|
83 | <ulink url="http://cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/apas06.html"> |
---|
84 | Appendix - Step-by-Step Installation Guides - Build for MS Visual C++ |
---|
85 | </ulink> |
---|
86 | of <emphasis>Geant4 User's Guide - For Application Developers</emphasis>. |
---|
87 | </para> |
---|
88 | |
---|
89 | <para> |
---|
90 | The usage of Cygwin32 for the build environment results in a |
---|
91 | build procedure similar to that on a UNIX system. |
---|
92 | </para> |
---|
93 | |
---|
94 | <para> |
---|
95 | The following steps are required to install geant4: |
---|
96 | |
---|
97 | <orderedlist spacing="compact"> |
---|
98 | <listitem><para> |
---|
99 | Install Cygwin (see also notes above and additional |
---|
100 | <ulink url="http://cern.ch/geant4/support/windows_note.shtml">installation |
---|
101 | notes</ulink> for known issues related to the most current version): |
---|
102 | <para> |
---|
103 | We do not depend on any specific feature of the version of Cygwin, |
---|
104 | so newer versions (or slightly older) are expected to work. |
---|
105 | </para> |
---|
106 | </para></listitem> |
---|
107 | <listitem><para> |
---|
108 | Set the environment for MS Visual C++, i.e. set the paths to |
---|
109 | libraries, include files, and executables for MS Visual C++. This |
---|
110 | can be done by modifying the start-up batch file |
---|
111 | <literal>cygwin.bat</literal> of Cygwin32 to include all the MSDOS commands |
---|
112 | found in the file <literal>vcvars32.bat</literal> provided in MS Visual C++ |
---|
113 | (in the VC++ .NET compiler installation directory, and usually |
---|
114 | located inside the <literal>Common7/Tools</literal> directory). This |
---|
115 | modification should be done after the installation of the Cygwin |
---|
116 | toolset, so that the environment gets properly set at the time of |
---|
117 | the invocation of the shell. |
---|
118 | </para></listitem> |
---|
119 | <listitem><para> |
---|
120 | Unpack the source code into a directory of your choice. |
---|
121 | </para></listitem> |
---|
122 | <listitem><para> |
---|
123 | Start the <literal>Cygwin</literal> shell from the start menu. |
---|
124 | </para></listitem> |
---|
125 | <listitem><para> |
---|
126 | At this point you're ready to install Geant4. If manual |
---|
127 | installation is chosen, you must set the necessary environment |
---|
128 | variables. There are various ways to do so; for example through a |
---|
129 | command file for the Cygwin bash shell. This command file could be |
---|
130 | named <literal>geant4-setup.sh</literal>, and you must execute it with |
---|
131 | |
---|
132 | <informalexample> |
---|
133 | <programlisting> |
---|
134 | . geant4-setup.sh |
---|
135 | </programlisting> |
---|
136 | </informalexample> |
---|
137 | |
---|
138 | including the leading dot and blank space. You could also have this |
---|
139 | as your <literal>.bashrc</literal> file. The commands in the command file |
---|
140 | should be: |
---|
141 | |
---|
142 | <informalexample> |
---|
143 | <programlisting> |
---|
144 | # Set G4SYSTEM |
---|
145 | export G4SYSTEM=WIN32-VC |
---|
146 | # |
---|
147 | # Set Path to CLHEP |
---|
148 | export CLHEP_BASE_DIR=C:/usr/local |
---|
149 | # |
---|
150 | # --- Other optional settings |
---|
151 | #Turn on verbose to show command used for compilation |
---|
152 | #export CPPVERBOSE=1 |
---|
153 | # |
---|
154 | </programlisting> |
---|
155 | </informalexample> |
---|
156 | Note, in the example above, CLHEP was installed in |
---|
157 | <literal>C:/usr/local</literal>, therefore <literal>include/CLHEP</literal> and |
---|
158 | <literal>lib/CLHEP.lib</literal> must be included therein. |
---|
159 | </para></listitem> |
---|
160 | <listitem><para> |
---|
161 | Once the environment is correctly set, the libraries are built |
---|
162 | using make from the <literal>geant4/source</literal> directory typing |
---|
163 | <literal>make</literal> from the <literal>Cygwin bash</literal> shell |
---|
164 | prompt. |
---|
165 | </para></listitem> |
---|
166 | </orderedlist> |
---|
167 | </para> |
---|
168 | |
---|
169 | <para> |
---|
170 | Examples can be built in the same way as the libraries from |
---|
171 | examples/novice/N01, for instance: type <literal>make</literal> from the |
---|
172 | shell prompt. |
---|
173 | </para> |
---|
174 | |
---|
175 | <para> |
---|
176 | Note that, depending on which external software is used, there may |
---|
177 | be some warnings in linking about conflictings libraries. This often |
---|
178 | seems to be caused by an external library compiled for a different |
---|
179 | run time environment. |
---|
180 | </para> |
---|
181 | |
---|
182 | <para> |
---|
183 | The binary of the example is placed by default into the |
---|
184 | <literal>geant4/bin/WIN32-VC</literal> directory. You may run it either from |
---|
185 | this directory or from the <literal>examples/novice/N01</literal> directory; |
---|
186 | sample input and output files are placed in each of the |
---|
187 | <literal>examples/novice</literal> directories. Some of the examples will |
---|
188 | need to read data files, and the place has to be given in |
---|
189 | environment variables again similar to the following example: |
---|
190 | |
---|
191 | <informalexample> |
---|
192 | <programlisting> |
---|
193 | # |
---|
194 | # Environment variables needed to find geant4 data files: |
---|
195 | # |
---|
196 | # Data for neutron scattering processes, |
---|
197 | # distributed in a separate tar file, then placed under data |
---|
198 | export G4NEUTRONHPDATA=c:/usr/local/geant4/data/G4NDL |
---|
199 | # |
---|
200 | # Nuclear Photon evaporation data, |
---|
201 | # distributed with the source files under data |
---|
202 | export G4LEVELGAMMADATA=c:/usr/local/geant4/data/PhotonEvaporation |
---|
203 | # |
---|
204 | # Data for radiative decay hadronic processes under data, |
---|
205 | # distributed in a separate tar file |
---|
206 | export G4RADIOACTIVEDATA=c:/usr/local/geant4/data/RadiativeDecay |
---|
207 | # |
---|
208 | # Data for low energy electromagnetic processes, |
---|
209 | # distributed in a separate tar file, then placed under data |
---|
210 | export G4LEDATA=c:/usr/local/geant4/data/G4EMLOW |
---|
211 | # |
---|
212 | # Data for nuclear shell effects for INCL/ABLA hadronic model, |
---|
213 | # distributed in a separate tar file, then placed under data |
---|
214 | export G4ABLADATA=c:/usr/local/geant4/data/G4ABLA |
---|
215 | # |
---|
216 | </programlisting> |
---|
217 | </informalexample> |
---|
218 | </para> |
---|
219 | |
---|
220 | <para> |
---|
221 | All compiler and linker options are set in |
---|
222 | <literal>config/sys/WIN32-VC.gmk</literal>. If you require options different |
---|
223 | from our choice, you can modify this file. |
---|
224 | </para> |
---|
225 | |
---|
226 | </sect1> |
---|
227 | |
---|
228 | |
---|
229 | <!-- ******************* Section (Level#1) ****************** --> |
---|
230 | <sect1 id="sect.BuildLibDLLs"> |
---|
231 | <title> |
---|
232 | Building Kernel Libraries DLLs |
---|
233 | </title> |
---|
234 | |
---|
235 | <para> |
---|
236 | DLLs (Dynamic Link Libraries) on Windows are supported for MS-VC++ |
---|
237 | and can be built for the <literal>compound</literal> kernel libraries of |
---|
238 | Geant4 (see <xref linkend="sect.InstManually.OptEnvVar"/> of the |
---|
239 | Installation Procedure of this Guide for a dissertation on |
---|
240 | <literal>global/compound</literal> libraries). |
---|
241 | </para> |
---|
242 | |
---|
243 | <para> |
---|
244 | The libraries can be built either manually, issuing the |
---|
245 | command: |
---|
246 | |
---|
247 | <informalexample> |
---|
248 | <programlisting> |
---|
249 | make dll |
---|
250 | </programlisting> |
---|
251 | </informalexample> |
---|
252 | |
---|
253 | from the directory <literal>$G4INSTALL/source</literal> or by specifying it |
---|
254 | through the <literal>Configure</literal> script used for the |
---|
255 | installation. |
---|
256 | </para> |
---|
257 | |
---|
258 | <para> |
---|
259 | Then, to build any application making use of the installed DLLs, |
---|
260 | the environment variable <literal>G4LIB_USE_DLL</literal> must be set in the |
---|
261 | environment. |
---|
262 | </para> |
---|
263 | |
---|
264 | <para> |
---|
265 | Once the application is built, it is required to specify to the |
---|
266 | system the path where the DLLs are installed. To do so, add the |
---|
267 | absolute path (in Cygwin format) of the DLLs installation directory |
---|
268 | to the <literal>PATH</literal> variable; for example: |
---|
269 | |
---|
270 | <informalexample> |
---|
271 | <programlisting> |
---|
272 | export PATH=$PATH:/usr/local/geant4/lib/$G4SYSTEM |
---|
273 | </programlisting> |
---|
274 | </informalexample> |
---|
275 | </para> |
---|
276 | |
---|
277 | <para> |
---|
278 | You may then be able to run successfully your application. |
---|
279 | </para> |
---|
280 | |
---|
281 | |
---|
282 | </sect1> |
---|