From 3d2354ae28ab95e9c46b1f5dab72a87be3821c2c Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Tue, 28 Feb 2017 10:09:01 +0100 Subject: [PATCH] [insitu] Added instr. how to build with PVs Catalyst lib. --- scripts/catalyst/Editions/ogs/manifest.json | 32 ++++ scripts/catalyst/README.md | 38 +++++ scripts/catalyst/generate-ogs-edition.sh | 16 ++ scripts/catalyst/generate-tarballs.sh | 71 +++++++++ scripts/catalyst/test-catalyst.sh | 163 ++++++++++++++++++++ 5 files changed, 320 insertions(+) create mode 100644 scripts/catalyst/Editions/ogs/manifest.json create mode 100644 scripts/catalyst/README.md create mode 100755 scripts/catalyst/generate-ogs-edition.sh create mode 100755 scripts/catalyst/generate-tarballs.sh create mode 100755 scripts/catalyst/test-catalyst.sh diff --git a/scripts/catalyst/Editions/ogs/manifest.json b/scripts/catalyst/Editions/ogs/manifest.json new file mode 100644 index 00000000000..e5516d44208 --- /dev/null +++ b/scripts/catalyst/Editions/ogs/manifest.json @@ -0,0 +1,32 @@ +{ + "edition": "ogs", + "requires": [ + "Extras" + ], + "after": [ + "Enable-Python", + "Extras" + ], + "cmake":{ + "cache":[ + { "name":"Module_vtkIOXML", + "type":"BOOL", + "value":"ON" + } + ] + }, + "modules":[ + { "name": "vtkIOXML", + "path": "VTK/IO/XML", + "include": [ + { "class": "vtkXMLUnstructuredGridReader" }, + { "class": "vtkXMLReader" }, + { "class": "vtkXMLUnstructuredDataReader" }, + { "class": "vtkXMLFileReadTester" }, + { "class": "vtkXMLDataReader" } + ], + "cswrap": true, + "pythonwrap": true + } + ] +} diff --git a/scripts/catalyst/README.md b/scripts/catalyst/README.md new file mode 100644 index 00000000000..68b3ff3eb6e --- /dev/null +++ b/scripts/catalyst/README.md @@ -0,0 +1,38 @@ +# Generate OGS Catalyst edition + +Clone ParaView: + +```bash +git clone https://gitlab.kitware.com/paraview/paraview.git +cd paraview +git submodule init +git submodule update +``` + +Go to ogs source directoy and run script `generate-ogs-edition.sh` with the path to the cloned ParaView directory as an argument: + +```bash +cd ogs/scripts/catalyst +./generate-ogs-edition.sh ~/code/catalyst/paraview +``` + +This will generate the file `Catalyst-ogs-Base-Enable-Python-Essentials-Extras-ogs-Rendering-Base.tar.gz` in `[paraview-dir]/Catalyst/` + +# Build the OGS Catalyst edition + +- Untar the edition +- `cd` into it and create a `build`-directory +- Build with `cmake.sh`: + +```bash +../cmake.sh .. [Optional CMake parameter] +make +``` + +# Use the OGS Catalyst edition + +Enable `OGS_INSITU` and point to build directory where the edition was built: + +```bash +cmake ../ogs -DOGS_INSITU=ON -DParaView_DIR=[path to edition build dir] +``` diff --git a/scripts/catalyst/generate-ogs-edition.sh b/scripts/catalyst/generate-ogs-edition.sh new file mode 100755 index 00000000000..33f22a0df12 --- /dev/null +++ b/scripts/catalyst/generate-ogs-edition.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# A quick script to generate source tarball for the ogs edition. + +usage="$0 <ParaView source dir>" +# A handy function for handling errors. +die () { + echo >&2 "$@" + exit 1 +} + +pv_dir="$1" + +cp * $pv_dir/Catalyst +cd $pv_dir/Catalyst +./generate-tarballs.sh ogs diff --git a/scripts/catalyst/generate-tarballs.sh b/scripts/catalyst/generate-tarballs.sh new file mode 100755 index 00000000000..07f3425df67 --- /dev/null +++ b/scripts/catalyst/generate-tarballs.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +# A quick script to generate source tarball for all editions. + +usage="$0 <suffix>" +# A handy function for handling errors. +die () { + echo >&2 "$@" + exit 1 +} + + +TARGET_FILE=$0 + +cd `dirname $TARGET_FILE` +TARGET_FILE=`basename $TARGET_FILE` + +# Iterate down a (possible) chain of symlinks +while [ -L "$TARGET_FILE" ] +do + TARGET_FILE=`readlink $TARGET_FILE` + cd `dirname $TARGET_FILE` + TARGET_FILE=`basename $TARGET_FILE` +done + +# Compute the canonicalized name by finding the physical path +# for the directory we're in and appending the target file. +PHYS_DIR=`pwd -P` +RESULT=$PHYS_DIR/$TARGET_FILE +echo $RESULT + +[ "$#" -lt 1 ] && \ + die "$usage" + +scriptdir="$RESULT" +scriptdir="$( dirname "$scriptdir" )" + +suffix="$1" +src_output="$( pwd )" + +generate_edition () { + local parts="$@" + cmd="" + editionsuffix="" + for part in $parts; do + cmd="$cmd --input $part" + editionsuffix="$editionsuffix-$part" + done + $scriptdir/test-catalyst.sh $(pwd)/Catalyst-$suffix$editionsuffix \ + $scriptdir/tmp \ + --no-configure --no-build --no-test --remove-dirs $cmd + tar zcf Catalyst-$suffix$editionsuffix.tar.gz Catalyst-$suffix$editionsuffix + mv Catalyst-$suffix$editionsuffix.tar.gz ../ +} + +rm -rf $src_output/__tmp__ +mkdir -p $src_output/__tmp__ +cd $src_output/__tmp__ +# generate_edition "HostTools" +# generate_edition "Base" +# generate_edition "Base" "Essentials" +# generate_edition "Base" "Essentials" "Extras" +# generate_edition "Base" "Essentials" "Extras" "Rendering-Base" +# +# generate_edition "Base" "Enable-Python" +# generate_edition "Base" "Enable-Python" "Essentials" +# generate_edition "Base" "Enable-Python" "Essentials" "Extras" +# generate_edition "Base" "Enable-Python" "Essentials" "Extras" "Rendering-Base" +generate_edition "Base" "Enable-Python" "Essentials" "Extras" "ogs" "Rendering-Base" +cd ../ +rm -rf $src_output/__tmp__ diff --git a/scripts/catalyst/test-catalyst.sh b/scripts/catalyst/test-catalyst.sh new file mode 100755 index 00000000000..c25632fcb8f --- /dev/null +++ b/scripts/catalyst/test-catalyst.sh @@ -0,0 +1,163 @@ +#!/bin/sh + +usage="$0 <catalyst srcdir> <catalyst builddir> [--install] [--no-configure] [--no-build] [--no-test] [--remove-dirs] --input <edition> [--input <edition>]... [--] [<cmake arguments>...]" + +# A handy function for handling errors. +die () { + echo >&2 "$@" + exit 1 +} + +[ "$#" -lt 3 ] && \ + die "$usage" + +TARGET_FILE=$0 + +cd `dirname $TARGET_FILE` +TARGET_FILE=`basename $TARGET_FILE` + +# Iterate down a (possible) chain of symlinks +while [ -L "$TARGET_FILE" ] +do + TARGET_FILE=`readlink $TARGET_FILE` + cd `dirname $TARGET_FILE` + TARGET_FILE=`basename $TARGET_FILE` +done + +# Compute the canonicalized name by finding the physical path +# for the directory we're in and appending the target file. +PHYS_DIR=`pwd -P` +RESULT=$PHYS_DIR/$TARGET_FILE +echo $RESULT + +curscript="$RESULT" +scriptdir="$( dirname "$curscript" )" + +# Where the edition directories live. +editiondir="$scriptdir/Editions" + +# The output directory to catalyze into. +src_output="$1" +shift + +[ -d "$src_output/.git" ] && \ + die "Refusing to use a git repository as the source output directory" + +# The output directory to build into. +bin_output="$1" +shift + +# Parse out --input parameters. +editions= +args= +remove= +no_configure= +no_build= +no_test= +install= +while [ "$#" -gt 0 ]; do + case "$1" in + --input) + shift + edition="$1" + + # Fail on non-existent editions. + [ -d "$editiondir/$edition" ] || \ + die "The $edition edition does not exist" + + editions="$editions $edition" + args="$args -i $editiondir/$edition" + ;; + --remove-dirs) + remove=y + ;; + --no-configure) + no_configure=y + ;; + --no-build) + no_build=y + ;; + --no-test) + no_test=y + ;; + --install) + install=y + ;; + --) + break + ;; + *) + break + ;; + esac + shift +done + +# We need at least one edition to catalyze. +[ -z "$editions" ] && \ + die "Need at least one input" + +if [ -n "$no_build" ] && [ -n "$install" ]; then + die "--install requires a build" +fi + +# Remove directories if requested +[ -n "$remove" ] && \ + rm -rf "$src_output" "$bin_output" + +# Catalyze. +mkdir -v -p "$src_output" +python "$scriptdir/catalyze.py" -r "$scriptdir/.." $args -o "$src_output" || \ + die "Failed to catalyze" + +[ -n "$no_configure" ] && exit 0 + +# Configure the catalyzed tree. +mkdir -v -p "$bin_output" +cd "$bin_output" +"$src_output/cmake.sh" "$@" "$src_output" || \ + die "Failed to configure the tree" + +if [ -z "$no_build" ]; then + cd "$bin_output" + cmake --build . || \ + die "Failed to build" +fi + +# Test if wanted. +if [ -z "$no_test" ]; then + # Create the testing directory. + mkdir -v "$src_output/Testing" + for edition in $editions; do + [ -d "$editiondir/$edition/Testing" ] || continue + + cp -rv "$editiondir/$edition/Testing/"* "$src_output/Testing" || \ + die "Failed to copy tests for edition $edition" + done + + # Configure the testing tree. + mkdir -v -p "$bin_output/Testing" + cd "$bin_output/Testing" + cmake "$@" \ + "-DPVPYTHON_EXE=$bin_output/bin/pvpython" \ + "-DParaView_DIR=$bin_output" \ + "$src_output/Testing" || \ + die "Failed to configure tests" + + if [ -z "$no_build" ]; then + # Build the testing tree. + cd "$bin_output/Testing" + cmake --build . || \ + die "Failed to build tests" + + # Run the tests. + ctest -VV || \ + die "Tests failed" + fi +fi + +if [ -n "$install" ]; then + cd "$bin_output" + cmake --build . --target install || \ + die "Failed to install" +fi -- GitLab