|
|
Installation Guide |
3. Tips for Installing on Windows
To compile and run Geant4 under Windows systems, some additional information
and tools are required, although the installation produre is similar to that
required on a UNIX based system. On Windows, the Cygwin toolset and the
Microsoft Visual C++ compiler are used.
Cygwin32 is a UNIX development environment available for Microsoft Windows.
You can freely obtain Cygwin32 from
Cygwin or
Cygwin/X.
We do not support direct use of Visual Studio; i.e. we do not provide
Visual Studio workspace (.dsw) or project (.dsp) files, nor we do provide
makefiles for the nmake application of MS Visual C++.
A package and setup which is not officially supported, and including the
required configuration for creating a project under Visual Studio, can be
downloaded here.
We use several of the tools provided by the Cygwin toolset:
Due to known limitations of the MS-VC++ optimizer, it is suggested an installation performed with debug flags turned on, i.e. G4DEBUG=1, and no optimisation. In some cases, tests have shown problems both at compile and run time when optimisation was turned on.
The usage of Cygwin32 for the build environment results in a build procedure similar to that on a UNIX system. The documentation in the User's Guide for Application Developers, Section 10.5, is largely applicable in this case.
The following steps are required to install geant4:
. geant4-setup.sh
including the leading dot and blank space. You could also have this as
your .bashrc file. The commands in the command file should be:
# Set G4SYSTEM
export G4SYSTEM=WIN32-VC
#
# Set Path to CLHEP
export CLHEP_BASE_DIR=C:/usr/local
#
# --- Other optional settings
#Turn on verbose to show command used for compilation
#export CPPVERBOSE=1
#
Note, in the example above, CLHEP was installed in C:/usr/local,
therefore include/CLHEP and lib/CLHEP.lib must be
included therein.The binary of the example is placed by default into the geant4/bin/WIN32-VC directory. You may run it either from this directory or from the examples/novice/N01 directory; sample input and output files are placed in each of the examples/novice directories. Some of the examples will need to read data files, and the place has to be given in environment variables again similar to the following example:
# # Environment variables needed to find geant4 data files: # # Data for neutron scattering processes, # distributed in a separate tar file, then placed under data export NeutronHPCrossSections=c:/usr/local/geant4/data/G4NDL # # Nuclear Photon evaporation data, # distributed with the source files under data export G4LEVELGAMMADATA=c:/usr/local/geant4/data/PhotonEvaporation # # Data for radiative decay hadronic processes under data, # distributed in a separate tar file export G4RADIOACTIVEDATA=c:/usr/local/geant4/data/RadiativeDecay # # Data for low energy electromagnetic processes, # distributed in a separate tar file, then placed under data export G4LEDATA=c:/usr/local/geant4/data/G4EMLOW # # Data for elastic scattering processes, # distributed in a separate tar file, then placed under data export G4ELASTICDATA=c:/usr/local/geant4/data/G4ELASTIC #
All compiler and linker options are set in config/sys/WIN32-VC.gmk. If you require options different from our choice, you can modify this file.
DLLs (Dynamic Link Libraries) on Windows are supported for .NET VC++ and can be built for the compound kernel libraries of Geant4 (see the Installation Procedure of this Guide for a dissertation on global/compound libraries).
The libraries can be built either manually, issuing the command:
make dll
from the directory $G4INSTALL/source or by specifying it through
the Configure script used for the installation.
export PATH=$PATH:/usr/local/geant4/lib/$G4SYSTEM
You may then be able to run successfully your application.