Skip to content

Commit 66c64d1

Browse files
committed
Provide a setup script for MercuryDPM
1 parent b32f5a3 commit 66c64d1

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# ---- Config (you can override via env vars) ----
5+
REPO_HTTPS_DEFAULT="https://bitbucket.org/davidscn/mercurydpm.git"
6+
REPO_URL="${REPO_URL:-$REPO_HTTPS_DEFAULT}" # or git@bitbucket.org:davidscn/mercurydpm.git
7+
BRANCH="${BRANCH:-channel-transport-tutorial}"
8+
SRC_DIR="${SRC_DIR:-$PWD/mercurydpm}"
9+
BUILD_DIR="${BUILD_DIR:-$SRC_DIR/build}"
10+
11+
# ---- Clone (if needed) and checkout branch ----
12+
if [[ ! -d "$SRC_DIR/.git" ]]; then
13+
echo "Cloning repo into: $SRC_DIR"
14+
git clone "$REPO_URL" "$SRC_DIR"
15+
else
16+
echo "Repo already exists at: $SRC_DIR"
17+
fi
18+
19+
cd "$SRC_DIR"
20+
git fetch --all --prune
21+
git checkout "$BRANCH"
22+
git pull --ff-only || true
23+
24+
# ---- Configure with CMake in build directory ----
25+
mkdir -p "$BUILD_DIR"
26+
cd "$BUILD_DIR"
27+
28+
echo "Configuring in: $BUILD_DIR"
29+
cmake -D MercuryDPM_PreCICE_COUPLING="ON" ..
30+
31+
# ---- Build only the requested target ----
32+
echo "Building target: ChannelTransport"
33+
make -j "$(nproc)" ChannelTransport
34+
35+
export MERCURYDPM_BUILD_DIR="$BUILD_DIR"
36+
echo "Exported MERCURYDPM_BUILD_DIR=$MERCURYDPM_BUILD_DIR"
37+
echo "Done."
38+

0 commit comments

Comments
 (0)