source: trunk/documents/UserDoc/DocBookUsersGuides/InstallationGuide/xml/PCMachines/pcMachines.xml @ 1358

Last change on this file since 1358 was 1211, checked in by garnier, 15 years ago

CVS update

File size: 9.6 KB
Line 
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>
12Windows with the Cygwin Toolset and Microsoft Visual C++
13</title>
14
15<para>
16To compile and run Geant4 under Windows systems, some additional
17information and tools are required, although the installation
18produre is similar to that required on a UNIX based system. On
19Windows, the Cygwin toolset and the Microsoft Visual C++ compiler
20are used.
21</para>
22
23<para>
24Cygwin32 is a UNIX development environment available for Microsoft
25Windows. You can freely obtain Cygwin32 from
26<ulink url="http://cygwin.com/">
27Cygwin
28</ulink>
29or
30<ulink url="http://x.cygwin.com/">
31Cygwin/X
32</ulink>
33.
34</para>
35
36<para>
37We do not support direct use of Visual Studio; i.e. we do not
38provide Visual Studio workspace (.dsw) or project (.dsp) files, nor
39we do provide makefiles for the <literal>nmake</literal> application of MS
40Visual C++.
41</para>
42
43<para>
44We 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>
62At the installation of the Cygwin toolset it is therefore required
63to explicitely select some packages (i.e. <emphasis>gmake</emphasis>,
64<emphasis>gcc</emphasis>, <emphasis>binutils</emphasis> 
65and <emphasis>tcsh</emphasis> from the "devel" category) in
66addition to those which are part of the default installation.
67</para>
68
69<para>
70For more details on the toolset, please see the documentation
71available on the
72<ulink url="http://cygwin.com/">
73Cygwin pages
74</ulink>
75.
76The User's Guide has quick start guides and help with
77setting up Cygwin with <literal>setup.exe</literal>.
78</para>
79
80<para>
81Links 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">
84Appendix - Step-by-Step Installation Guides - Build for MS Visual C++
85</ulink> 
86of <emphasis>Geant4 User's Guide - For Application Developers</emphasis>.
87</para>
88
89<para>
90The usage of Cygwin32 for the build environment results in a
91build procedure similar to that on a UNIX system.
92</para>
93
94<para>
95The 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>
170Examples can be built in the same way as the libraries from
171examples/novice/N01, for instance: type <literal>make</literal> from the
172shell prompt.
173</para>
174
175<para>
176Note that, depending on which external software is used, there may
177be some warnings in linking about conflictings libraries. This often
178seems to be caused by an external library compiled for a different
179run time environment.
180</para>
181
182<para>
183The binary of the example is placed by default into the
184<literal>geant4/bin/WIN32-VC</literal> directory. You may run it either from
185this directory or from the <literal>examples/novice/N01</literal> directory;
186sample input and output files are placed in each of the
187<literal>examples/novice</literal> directories. Some of the examples will
188need to read data files, and the place has to be given in
189environment 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        # Data for measured optical surface reflectance in optical processes,
217        #    distributed in a separate tar file, then placed under data
218        export G4REALSURFACEDATA=c:/usr/local/geant4/data/RealSurface
219        #
220</programlisting>
221</informalexample>
222</para>
223
224<para>
225All compiler and linker options are set in
226<literal>config/sys/WIN32-VC.gmk</literal>. If you require options different
227from our choice, you can modify this file.
228</para>
229
230</sect1>
231
232
233<!-- ******************* Section (Level#1) ****************** -->
234<sect1 id="sect.BuildLibDLLs">
235<title>
236Building Kernel Libraries DLLs
237</title>
238
239<para>
240DLLs (Dynamic Link Libraries) on Windows are supported for MS-VC++
241and can be built for the <literal>compound</literal> kernel libraries of
242Geant4 (see <xref linkend="sect.InstManually.OptEnvVar"/> of the
243Installation Procedure of this Guide for a dissertation on
244<literal>global/compound</literal> libraries).
245</para>
246
247<para>
248The libraries can be built either manually, issuing the
249command:
250
251<informalexample>
252<programlisting>
253        make dll
254</programlisting>
255</informalexample>
256
257from the directory <literal>$G4INSTALL/source</literal> or by specifying it
258through the <literal>Configure</literal> script used for the
259installation.
260</para>
261
262<para>
263Then, to build any application making use of the installed DLLs,
264the environment variable <literal>G4LIB_USE_DLL</literal> must be set in the
265environment.
266</para>
267
268<para>
269Once the application is built, it is required to specify to the
270system the path where the DLLs are installed. To do so, add the
271absolute path (in Cygwin format) of the DLLs installation directory
272to the <literal>PATH</literal> variable; for example:
273
274<informalexample>
275<programlisting>
276        export PATH=$PATH:/usr/local/geant4/lib/$G4SYSTEM
277</programlisting>
278</informalexample>
279</para>
280
281<para>
282You may then be able to run successfully your application.
283</para>
284
285
286</sect1>
Note: See TracBrowser for help on using the repository browser.