Download Geant4 User's Guide for Application Developers

Transcript
Appendix
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 87.
Example 87. 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:
• Step by step Installation Guides.
6.1. Building on MS Visual C++
Geant4 can be compiled with the C++ compiler of MS Visual Studio C++ and the Cygwin toolset. Detailed
instructions are given in the Installation manual. As the build system relies on make and other Unix tools using
only the compiler of MS Visual Studio, the section on
Section 5 Makefile and environment variables applies also for building with MS Visual C++.
We do not support compilation directly under MS Visual Studio, i.e. we do not provide workspace files (.dsw)
or project files (.dsp).
However the executables created are debuggable using the debugger of MS Visual Studio. You may have to help
the debugger finding the path to source files the first time you debug a given executable.
Listed below are some useful pages with instructions on how to start with the installation of CygWin, and also
tips for creating a project under Visual Studio:
• Getting started with Cygwin.
• Cygwin Installation Notes.
• Building a MSVC++ Visual Studio 2005 Geant4 project.
288