From 2cc3dcc983bd426d4f44e2415da28098a7cbc19c Mon Sep 17 00:00:00 2001
From: Christoph Lehmann <christoph.lehmann@ufz.de>
Date: Thu, 10 Aug 2017 11:42:34 +0200
Subject: [PATCH] added build info script

---
 dev/build-info/README.md       |  5 ++++
 dev/build-info/ogs6-build-info | 50 ++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
 create mode 100644 dev/build-info/README.md
 create mode 100755 dev/build-info/ogs6-build-info

diff --git a/dev/build-info/README.md b/dev/build-info/README.md
new file mode 100644
index 0000000..f3b6f2b
--- /dev/null
+++ b/dev/build-info/README.md
@@ -0,0 +1,5 @@
+# Script providing some info about a specific OGS build
+
+The script has to be run from an OGS build directory, i.e., where the
+`CMakeCache.txt` file is. It works on Linux/Unix only.
+
diff --git a/dev/build-info/ogs6-build-info b/dev/build-info/ogs6-build-info
new file mode 100755
index 0000000..d035021
--- /dev/null
+++ b/dev/build-info/ogs6-build-info
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+if [ ! -f "CMakeCache.txt" ]; then
+    echo "Error: you are not in a build directory. Aborting." >&2
+    exit 1
+fi
+
+echo "== info from CMakeCache.txt =="
+(grep -E -f - CMakeCache.txt | sort ) <<EOF
+^CMAKE_BUILD_TYPE:
+^CMAKE_CXX_COMPILER:
+^OGS_EIGEN_DYNAMIC_SHAPE_MATRICES:
+^OGS_CPU_ARCHITECTURE:
+^(OGS|CMAKE)[^:]*_CXX_FLAGS[^-:]*:
+^[^:]*EIGEN[^-:]*:
+^FIND_PACKAGE_MESSAGE_DETAILS_Eigen3:
+EOF
+
+echo
+echo "== ogs info =="
+
+if [ -x bin/ogs ]; then
+    cat <<"EOF"
+$ bin/ogs --version
+EOF
+    bin/ogs --version
+else
+    echo "WARNING: bin/ogs is not executable or does not exist."
+fi
+
+echo "== compiler info =="
+compiler="`sed -ne 's/^CMAKE_CXX_COMPILER:STRING=\(.*\)$/\1/p' CMakeCache.txt`"
+arch="`sed -ne 's/^OGS_CPU_ARCHITECTURE:STRING=\(.*\)$/\1/p' CMakeCache.txt`"
+
+cat <<EOF
+$ LANG=C "$compiler" "-march=$arch" -E -v - </dev/null 2>&1
+EOF
+LANG=C "$compiler" "-march=$arch" -E -v - </dev/null 2>&1
+
+echo
+echo "== last ten git commits =="
+
+srcdir="`sed -ne 's/^CMAKE_HOME_DIRECTORY:INTERNAL=\(.*\)$/\1/p' CMakeCache.txt`"
+cat <<"EOF"
+$ git -C "$srcdir" log --oneline --decorate -n 10
+EOF
+git -C "$srcdir" log --oneline --decorate -n 10
+
+
+
-- 
GitLab