compile.sh 1.13 KB
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 37
# source additional environment variables
source "$ROS2_HOME"/setup.bash

# Post source check if needed programs are in PATH
if [[ `command -v ros2` ]]
then
38
	echo "Found ros2"
39
else
40 41 42
	echo "Can not find ros2 in PATH! Aborting."
	echo "Try setting the environment variable ROS2_HOME to the base of your installation or adding it to your PATH!"
	exit 1
43
fi
44 45 46 47 48 49

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

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