compile.sh 896 Bytes
Newer Older
1 2 3 4 5 6
#!/usr/bin/env bash
set -e

# add *_HOME to PATH temporarily
if [ -n "$cmake_HOME" ]
then
7
	export PATH="$cmake_HOME:$PATH"
8 9 10
fi
if [ -n "$make_HOME" ]
then
11
	export PATH="$make_HOME:$PATH"
12 13 14 15 16
fi

# check if needed programs are in PATH
if [[ `command -v cmake` ]]
then
17
	echo "Found cmake"
18
else
19 20 21
	echo "Can not find cmake in PATH! Aborting."
	echo "Try setting the environment variable cmake_HOME to the base of your installation or adding it to your PATH!"
	exit 1
22 23 24
fi
if [[ `command -v make` ]]
then
25
	echo "Found make"
26
else
27 28 29
	echo "Can not find make in PATH! Aborting."
	echo "Try setting the environment variable make_HOME to the base of your installation or adding it to your PATH!"
	exit 1
30 31
fi

32 33 34 35 36
# source additional environment variables


# Post source check if needed programs are in PATH

37 38 39 40 41 42

# cmake
curDir=`dirname "$0"`
cmake -B"$curDir"/build/ -H"$curDir/src" "$@"

# make
43
make -j4 -C "$curDir/build"