build_amdis.sh 2.33 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
        shift 2 ;;
    --config)
        CONFIG="$2" # [Debug|Release]
        shift 2 ;;
    --parallel)
        COMPONENT="PARALLEL" # [SEQUENTIAL|PARALLEL]
        shift ;;
23
24
25
    --png)
        ENABLE_PNG="1"
        shift ;;
Praetorius, Simon's avatar
Praetorius, Simon committed
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    --)
        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"
47
  FLAGS="-DENABLE_UMFPACK:BOOL=ON -DENABLE_HYPRE:BOOL=ON"
Praetorius, Simon's avatar
Praetorius, Simon committed
48
49
else
  POSTFIX="${POSTFIX}_par"
50
  FLAGS="-DENABLE_UMFPACK:BOOL=OFF -DENABLE_PARALLEL_DOMAIN:BOOL=ON -DENABLE_ZOLTAN:BOOL=ON"
51
52
fi

53
54
55
if [ "${ENABLE_PNG}" == "1" ]; then
  FLAGS="${FLAGS} -DENABLE_PNG:BOOL=ON"
fi
Praetorius, Simon's avatar
Praetorius, Simon committed
56

57
if [[ "${STAGE}" == "build" || "${STAGE}" == "all" ]]; then
Praetorius, Simon's avatar
Praetorius, Simon committed
58
59
60
61
62
63
64
65
66
  # 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
67
  cmake --build ${ROOT}/build_${POSTFIX} --target install -- -j2
Praetorius, Simon's avatar
Praetorius, Simon committed
68
69
fi

70
if [[ "${STAGE}" == "demo" || "${STAGE}" == "all" ]]; then
Praetorius, Simon's avatar
Praetorius, Simon committed
71
72
73
74
75
76
77
78
79
80
81
  # now build the demos
  BASEDIR=${ROOT}/demo
  cmake -E make_directory ${BASEDIR}/build_${POSTFIX}
  cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \
        -DAMDIS_DIR=${ROOT}/install/share/amdis \
        -DCMAKE_BUILD_TYPE=${CONFIG} \
        -DCOMPONENT=${COMPONENT} \
        ${BASEDIR}
  cmake --build ${BASEDIR}/build_${POSTFIX}
fi

82
if [[ "${STAGE}" == "test" || "${STAGE}" == "all" ]]; then
Praetorius, Simon's avatar
Praetorius, Simon committed
83
84
85
86
87
88
89
90
91
92
93
  # now build and run the test_suite
  BASEDIR=${ROOT}/test
  cmake -E make_directory ${BASEDIR}/build_${POSTFIX}
  cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \
        -DAMDIS_DIR=${ROOT}/install/share/amdis \
        -DCMAKE_BUILD_TYPE=${CONFIG} \
        -DCOMPONENT=${COMPONENT} \
        ${BASEDIR}
  cmake --build ${BASEDIR}/build_${POSTFIX}
  cmake --build ${BASEDIR}/build_${POSTFIX} --target test
fi