Subversion Repositories tpanel

Rev

Rev 383 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
363 andreas 1
#!/bin/bash
2
# errors are propagated when using the pipe to concatenate commands 
3
set -o pipefail
4
# determine script directory
5
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6
ROOT_DIR="${SCRIPT_DIR}/.."
7
LOG_FILE="${ROOT_DIR}/workflow.log"
8
export QT_DIR="/opt/Qt/6.5.2/gcc_64"
9
export CMAKE_PREFIX_PATH="${QT_DIR}/lib/cmake"
10
 
11
# the first parameter is the branch, that is currently being built
12
BRANCH="$1"
13
 
14
# Log the message.
15
# parameters:
16
#    message ... the message to log
17
log() {
18
  local message="$1"
19
  local currentTime=$(date +"%y-%m-%d %H:%M:%S")
20
  echo "${currentTime}: ${message}" | tee -a ${LOG_FILE}
21
}
22
 
23
CPUS=2
24
type nproc > /dev/null 2>&1
25
 
26
if [ $? -eq 0 ]
27
then
28
    CPUS=`nproc`
29
fi
30
 
31
rm -rf "${ROOT_DIR}/build" > /dev/null 2>&1
32
mkdir "${ROOT_DIR}/build"
33
 
34
log "Changing to directory $ROOT_DIR"
35
cd ${ROOT_DIR}
36
log "Creating the Makefile"
37
cmake -B build -S . >> ${LOG_FILE} 2>&1
38
 
39
if [ $? -ne 0 ]
40
then
41
    log "ERROR: Could not create Makefile!"
42
    exit 1
43
fi
44
 
45
log "Changing to build directory"
46
cd build
47
log "Building the application ..."
48
exec make -j${CPUS} >> ${LOG_FILE} 2>&1