Download Geant4 User's Guide for Application Developers

Transcript
Appendix
Example 84. An example of a customised GNUmakefile for an application or example
using an external module not bound to Geant4.
# -------------------------------------------------------------------# GNUmakefile for the application "sim" depending on module "Xplotter"
# -------------------------------------------------------------------name := sim
G4TARGET := $(name)
G4EXLIB := true
CPPFLAGS += -I$(HOME)/Xplotter/include
EXTRALIBS += -L$(HOME)/Xplotter/lib -lXplotter
EXTRA_LINK_DEPENDENCIES := $(HOME)/Xplotter/lib/libXplotter.a
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
$(HOME)/Xplotter/lib/libXplotter.a:
cd $(HOME)/Xplotter; $(MAKE)
5.3.2. Adding external libraries which use Geant4
In addition to the above, specify, in EXTRALIBSSOURCEDIRS, a list of directories containing source files in its
src/ subdirectory. Thus, your GNUmakefile might contain:
EXTRALIBS += $(G4WORKDIR)/tmp/$(G4SYSTEM)/<myApp>/lib<myApp>.a \
-L<your-path>/lib -l<myExtraLib>
EXTRALIBSSOURCEDIRS += <your-path>/<myApp> <your-path>/<MyExtraModule>
EXTRA_LINK_DEPENDENCIES := $(G4WORKDIR)/tmp/$(G4SYSTEM)/<myApp>/lib<myApp>.a
MYSOURCES := $(wildcard <your-path>/<myApp>/src/*cc)
$(G4WORKDIR)/tmp/$(G4SYSTEM)/<myApp>/lib<myApp>.a: $(MYSOURCES)
cd <your-path>/<myApp>; $(MAKE)
See Example 85.
Example 85. An example of a customised GNUmakefile for an application or example
using external modules bound to Geant4.
# ----------------------------------------------------------------# GNUmakefile for the application "phys" depending on module "reco"
# ----------------------------------------------------------------name := phys
G4TARGET := $(name)
G4EXLIB := true
EXTRALIBS += $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a \
-L$(HOME)/reco/lib -lreco
EXTRALIBSSOURCEDIRS += $(HOME)/phys $(HOME)/reco
EXTRA_LINK_DEPENDENCIES := $(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
MYSOURCES := $(wildcard $(HOME)/phys/src/*cc)
$(G4WORKDIR)/tmp/$(G4SYSTEM)/$(name)/libphys.a: $(MYSOURCES)
cd $(HOME)/phys; $(MAKE)
6. Step-by-Step Installation Guides
You can find below some useful pages collecting instructions on how to install Geant4 in a detailed step-by-step
tutorial:
288