build_amdis.sh 2.21 KB
Newer Older
1
2
3
4
#! /bin/bash

ROOT=${PWD}

Praetorius, Simon's avatar
Praetorius, Simon committed
5
6
7
STAGE="build"
CONFIG="Release"
COMPONENT="SEQUENTIAL"
8
ENABLE_PNG="0"
Praetorius, Simon's avatar
Praetorius, Simon committed
9
10
11
12
13
14

# parse command line
if [ $# -gt 0 ]; then
  while [[ $1 = -* ]]; do
  case "$1" in
    --stage)
15
        STAGE="$2" # [build|demo|test|all]
Praetorius, Simon's avatar
Praetorius, Simon committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
        shift 2 ;;
    --config)
        CONFIG="$2" # [Debug|Release]
        shift 2 ;;
    --parallel)
        COMPONENT="PARALLEL" # [SEQUENTIAL|PARALLEL]
        shift ;;
    --)
        shift
        break ;;
    -?*)
        printf 'WARNING: Unknown option (ignored): %s\n' "$1" >&2
        shift ;;
    *)
        break
  esac

  done
fi

if [ "${CONFIG}" == "Debug" ]; then
  POSTFIX="deb"
else
  POSTFIX="rel"
fi

if [ "${COMPONENT}" == "SEQUENTIAL" ]; then
  POSTFIX="${POSTFIX}_seq"
44
  FLAGS="-DENABLE_UMFPACK:BOOL=ON -DENABLE_HYPRE:BOOL=ON"
Praetorius, Simon's avatar
Praetorius, Simon committed
45
46
else
  POSTFIX="${POSTFIX}_par"
47
  FLAGS="-DENABLE_UMFPACK:BOOL=OFF -DENABLE_PARALLEL_DOMAIN:BOOL=ON -DENABLE_ZOLTAN:BOOL=ON"
48
49
fi

50
if [[ "${STAGE}" == "build" || "${STAGE}" == "all" ]]; then
Praetorius, Simon's avatar
Praetorius, Simon committed
51
52
53
54
55
56
57
58
59
  # at first build AMDiS
  cmake -E make_directory ${ROOT}/build_${POSTFIX}
  cmake -E chdir ${ROOT}/build_${POSTFIX} cmake \
        -DCMAKE_INSTALL_PREFIX=${ROOT}/install \
        -DCMAKE_BUILD_TYPE=${CONFIG} \
        -DENABLE_COMPRESSION:BOOL=OFF \
        -DENABLE_EXTENSIONS:BOOL=ON \
        ${FLAGS} \
        ${ROOT}/AMDiS
60
  cmake --build ${ROOT}/build_${POSTFIX} --target install -- -j2
Praetorius, Simon's avatar
Praetorius, Simon committed
61
62
fi

63
if [[ "${STAGE}" == "demo" || "${STAGE}" == "all" ]]; then
Praetorius, Simon's avatar
Praetorius, Simon committed
64
65
66
67
  # now build the demos
  BASEDIR=${ROOT}/demo
  cmake -E make_directory ${BASEDIR}/build_${POSTFIX}
  cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \
68
        -DAMDiS_DIR=${ROOT}/install/lib/amdis/cmake \
Praetorius, Simon's avatar
Praetorius, Simon committed
69
70
71
72
73
74
        -DCMAKE_BUILD_TYPE=${CONFIG} \
        -DCOMPONENT=${COMPONENT} \
        ${BASEDIR}
  cmake --build ${BASEDIR}/build_${POSTFIX}
fi

75
if [[ "${STAGE}" == "test" || "${STAGE}" == "all" ]]; then
Praetorius, Simon's avatar
Praetorius, Simon committed
76
77
78
79
  # now build and run the test_suite
  BASEDIR=${ROOT}/test
  cmake -E make_directory ${BASEDIR}/build_${POSTFIX}
  cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \
80
        -DAMDiS_DIR=${ROOT}/install/lib/amdis/cmake \
Praetorius, Simon's avatar
Praetorius, Simon committed
81
82
83
84
85
86
        -DCMAKE_BUILD_TYPE=${CONFIG} \
        -DCOMPONENT=${COMPONENT} \
        ${BASEDIR}
  cmake --build ${BASEDIR}/build_${POSTFIX}
  cmake --build ${BASEDIR}/build_${POSTFIX} --target test
fi