Skip to content

Commit ffbebda

Browse files
committed
Initial commit
0 parents  commit ffbebda

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build Geant4
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'Geant4 version to build'
7+
required: true
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
env:
12+
GEANT4_VERSION: "${{ github.event.inputs.version }}"
13+
GEANT4_ARCHIVE: "geant4.${{ github.event.inputs.version }}-binaries.tar.gz"
14+
steps:
15+
- name: Check out repository code
16+
uses: actions/checkout@v2
17+
- name: Install packages
18+
run: sudo apt-get install libxerces-c-dev
19+
- name: Build Geant4
20+
run: |
21+
cd $HOME
22+
$GITHUB_WORKSPACE/build.sh
23+
tar czf $GITHUB_WORKSPACE/$GEANT4_ARCHIVE Geant4
24+
- name: Upload binaries
25+
uses: actions/upload-artifact@v2
26+
with:
27+
name: geant4.${{ github.event.inputs.version }}
28+
path: ${{ env.GEANT4_ARCHIVE }}

build.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
if [ -z "$GEANT4_VERSION" ]; then
6+
echo "Please set GEANT4_VERSION!"
7+
exit 1
8+
fi
9+
10+
# Download the source code.
11+
dir="geant4.$GEANT4_VERSION"
12+
archive="$dir.tar.gz"
13+
url="https://geant4-data.web.cern.ch/releases/$archive"
14+
wget "$url"
15+
tar xf "$archive"
16+
17+
# Build the libraries and install them, including the data files.
18+
mkdir build
19+
cd build
20+
cmake \
21+
-DCMAKE_BUILD_TYPE=Release \
22+
-DCMAKE_INSTALL_PREFIX=../Geant4 \
23+
-DGEANT4_INSTALL_DATA=ON \
24+
-DGEANT4_INSTALL_EXAMPLES=OFF \
25+
-DGEANT4_BUILD_MULTITHREADED=ON \
26+
-DGEANT4_USE_GDML=ON \
27+
"../$dir"
28+
make -j4
29+
make install
30+
31+
# Delete optional data files.
32+
cd ..
33+
rm -rf Geant4/share/*/data/G4NDL*
34+
rm -rf Geant4/share/*/data/RealSurface*

0 commit comments

Comments
 (0)