Chapter 3.  Setting Up and Using an Install of Geant4

3.1.  Geant4 Installation Locations

If you choose the default installation paths, then your install of Geant4 is completely contained under the directory you chose for CMAKE_INSTALL_PATH, with the structure

    +- CMAKE_INSTALL_PREFIX
       +- bin/
       |  +- geant4-config   (UNIX ONLY)
       |  +- geant4.csh      (UNIX ONLY)
       |  +- geant4.sh       (UNIX ONLY)
       |  +- G4global.dll    (WINDOWS ONLY)
       |  +- ...
       +- include/
       |  +- Geant4/
       |     +- G4global.hh
       |     +- ...
       |     +- CLHEP/       (WITH INTERNAL CLHEP ONLY)
       |     +- tools/
       +- lib/               (MAY BE lib64 on LINUX)
       |  +- libG4global.so  (AND/OR .a, OR G4Global.lib ON WINDOWS)
       |  +- ...
       |  +- Geant4-9.5.0/
       |     +- Geant4Config.cmake
       |     +- Geant4ConfigVersion.cmake
       |     +- Geant4LibraryDepends.cmake
       |     +- Geant4LibraryDepends-Release.cmake
       |     +- UseGeant4.cmake
       |     +- Linux-g++    (OR Darwin-g++ UNIX ONLY SOFTLINK -> ..)
       +- share
          +- Geant4-9.5.0
             +- data/        (IF GEANT4_INSTALL_DATA WAS SET)
             +- geant4make/
                +- geant4make.csh
                +- geant4make.sh
                +- config/
              

To make the Geant4 binaries and libraries available on your PATH and library path (LD_LIBRARY_PATH on Linux, DYLD_LIBRARY_PATH on Mac OS X), you should source the relevant script in the CMAKE_INSTALL_PREFIX

On bourne shells (e.g. bash), do (assuming you are in CMAKE_INSTALL_PREFIX):

    $ . bin/geant4.sh
  

On C shells, do (assuming you are in CMAKE_INSTALL_PREFIX):

    $ source bin/geant4.csh
  

On Windows, you should add the directory containing the Geant4 dll files to your PATH environment variable. On Windows 7/XP, this can be done via the Control Panel as follows

  • Step 1:

    Open the Windows Control Panel.

  • Step 2:

    Open the System item in the Control Panel.

  • Step 3:

    Click on the Advanced system settings link on the System window (on Windows XP, click on the Advanced tab).

  • Step 4:

    Click on the Environment Variables button in the System Properties window.

  • Step 5:

    Select the PATH entry in the User variables list, and click the Edit button. If PATH is not present, click on the New and create it.

  • Step 6:

    In the popup Edit User Variable window, append the directory in which the Geant4 dlls are installed to the Variable value entry of the PATH variable (Note that on Windows, path entries are separated by semicolons). It's very important to append the Geant4 dll path if you have an existing PATH, otherwise other programs may stop working correctly! If the Variable value entry of the PATH variable is empty, or you've just created it, you can simply set the value to the directory in which the Geant4 dlls are installed. Once you have edited, click OK.