feat(initial): added portable mfem build system
This commit is contained in:
66
tools/validate_matrix.sh
Executable file
66
tools/validate_matrix.sh
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
project_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
meson_bin=${MESON_BIN:-meson}
|
||||
meson_dir=$(CDPATH= cd -- "$(dirname -- "$meson_bin")" && pwd)
|
||||
profile=${MFEM_MATRIX_PROFILE:-portable}
|
||||
jobs=${MFEM_JOBS:-4}
|
||||
|
||||
compiler_family() {
|
||||
"$1" --version 2>&1 | sed -n '1p'
|
||||
}
|
||||
|
||||
require_clang() {
|
||||
version=$(compiler_family "$1")
|
||||
case "$version" in
|
||||
*clang*|*Clang*) ;;
|
||||
*) echo "error: $1 is not a Clang compiler: $version" >&2; exit 2 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
require_gnu() {
|
||||
version=$(compiler_family "$1")
|
||||
case "$version" in
|
||||
*gcc*|*GCC*|*"Free Software Foundation"*) ;;
|
||||
*) echo "error: $1 is not a GNU compiler: $version" >&2; exit 2 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
run_configuration() {
|
||||
name=$1
|
||||
c_compiler=$2
|
||||
cxx_compiler=$3
|
||||
mode=$4
|
||||
build_dir="$project_root/build-$name"
|
||||
|
||||
if test -f "$build_dir/meson-private/coredata.dat"; then
|
||||
wipe_flag=--wipe
|
||||
else
|
||||
wipe_flag=
|
||||
fi
|
||||
env PATH="$meson_dir:$PATH" CC="$c_compiler" CXX="$cxx_compiler" \
|
||||
"$meson_bin" setup $wipe_flag "$build_dir" "$project_root" \
|
||||
--buildtype="$mode" \
|
||||
-Dallow_preinstalled=false \
|
||||
-Dfeature_profile="$profile" \
|
||||
-Dbuild_examples=true \
|
||||
-Dbuild_tests=true \
|
||||
-Dbuild_python=false \
|
||||
-Djobs="$jobs"
|
||||
env PATH="$meson_dir:$PATH" "$meson_bin" compile -C "$build_dir"
|
||||
env PATH="$meson_dir:$PATH" "$meson_bin" test -C "$build_dir" --print-errorlogs
|
||||
}
|
||||
|
||||
clang_cc=${CLANG_CC:-clang}
|
||||
clang_cxx=${CLANG_CXX:-clang++}
|
||||
gcc_cc=${GNU_CC:-gcc}
|
||||
gcc_cxx=${GNU_CXX:-g++}
|
||||
|
||||
require_clang "$clang_cxx"
|
||||
require_gnu "$gcc_cxx"
|
||||
|
||||
run_configuration clang-debug "$clang_cc" "$clang_cxx" debug
|
||||
run_configuration clang-release "$clang_cc" "$clang_cxx" release
|
||||
run_configuration gcc-debug "$gcc_cc" "$gcc_cxx" debug
|
||||
run_configuration gcc-release "$gcc_cc" "$gcc_cxx" release
|
||||
Reference in New Issue
Block a user