-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-geant4
More file actions
executable file
·48 lines (40 loc) · 1.2 KB
/
build-geant4
File metadata and controls
executable file
·48 lines (40 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
modulefile=/etc/modulefiles/geant4/geant4-git
sourceDir=${HOME}/programs/geant4/repo
echo "Pulling update from git repository"
cd $sourceDir
git pull origin master --tags
tag=`git describe --always --tag`
cd -
buildDir=/tmp/geant4-build
installDir=/opt/geant4/$tag
if [ -d $installDir ]
then
rm -rf $installDir
fi
if [ -d $buildDir ]
then
echo "Removing previous build"
rm -r $buildDir
fi
mkdir $buildDir
cd $buildDir
cmake3 $sourceDir -DCMAKE_INSTALL_PREFIX=$installDir \
-DGEANT4_BUILD_MULTITHREADED=ON \
-DGEANT4_INSTALL_DATA=ON \
-DGEANT4_INSTALL_DATADIR=$installDir/data \
-DGEANT4_USE_GDML=ON \
-DGEANT4_USE_OPENGL_X11=ON \
-DGEANT4_USE_QT=ON \
-DGEANT4_USE_RAYTRACER_X11=ON \
-DGEANT4_USE_SYSTEM_CLHEP=OFF \
-DGEANT4_USE_SYSTEM_EXPAT=OFF \
-DGEANT4_USE_SYSTEM_ZLIB=OFF \
-DGEANT4_USE_XM=ON \
-DGEANT4_BUILD_CXXSTD=c++11 \
&& make -j24 install \
&& rm -rf $buildDir
echo "Updating the modulefile at " $modulefile
awk -v t=$tag '{if($1 == "set" && $2 == "version") print $1,$2,t; else print $0}' $modulefile > /tmp/geant4-git
mv /tmp/geant4-git $modulefile
echo "You should ensure that the data paths in the modulefile are accurate!"