Geant4 comes with three options for configuring your environment and application build to use the installed headers and libraries.
Geant4Make is the Geant4 GNU Make toolchain formerly used to build the toolkit
and applications. It is installed for backwards compatibility
with the Geant4 Examples and your existing applications which use a
GNUmakefile and the Geant4Make binmake.gmk
file.
Geant4Make is configured by environment variables, so to use this
toolchain to build applications you need to source the setup script
CMAKE_INSTALL_PREFIX/share/Geant4-9.5.0/geant4make/geant4make.(c)sh
as appropriate for your shell.
The usage of Geant4Make and syntax of the needed
GNUMakefile
is described in the FAQ and Appendices of
the Geant4 User's Guide for Application Developers.
Please note that this toolchain is provided purely for conveniance and backwards compatibility. We encourage you to use, or migrate your applications to, the new CMake and geant4-config tools described below.
Geant4 provides a CMake module, Geant4Config.cmake, located in
+- CMAKE_INSTALL_PREFIX +- lib/ +- Geant4-9.5.0/ +- Geant4Config.cmake
for use by CMake's find_package command.
This allows you to use CMake to easily build your own Geant4 application,
and can be used on all platforms transparently. To do this, your CMake
script needs to call find_package
find_package(Geant4)
and you need to point CMake to the location of the
Geant4Config.cmake
file via the CMake option
Geant4_DIR
.
The usage of CMake to build a Geant4 application using this module is
described in more detail in the Appendices of the Geant4 User's Guide for
Application Developers. We welcome feedback, suggestions for improvement
and bug reports on Geant4Config.cmake
.
On Unix platforms only, a simple config script is provided in
+- CMAKE_INSTALL_PREFIX +- bin/ +- geant4-config
This script may be run and passed arguments to obtain the installation
location of Geant4, the compile and link flags needed to build an
application against Geant4, and the features the install of Geant4
provides. You can pass the --help
argument to obtain
the usage of the script:
$ geant4-config --help Usage: geant4-config [OPTION...] --prefix output installation prefix of Geant4 --version output version for Geant4 --libs output all linker flags --cflags output all preprocessor and compiler flags --libs-without-gui output linker flags without GUI components --cflags-without-gui output preprocessor and compiler flags without GUI components --has-feature FEATURE output yes if FEATURE is supported, or no if not supported Known Features: clhep[yes] expat[no] gdml[no] qt[no] motif[no] raytracer-x11[no] opengl-x11[no] openinventor[no] Help options: -?, --help show this help message --usage display brief usage message
If you are on Unix and do not wish to use CMake to build applications, we recommend the use of
geant4-config
. We welcome feedback, suggestions for
improvement and bug reports on
geant4-config
.