compile.sh 1.32 KB
Newer Older
1 2
#!/usr/bin/env bash
set -e
3 4
export CMAKE_PREFIX_PATH=$AMENT_PREFIX_PATH:$CMAKE_PREFIX_PATH

5 6 7 8

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

# check if needed programs are in PATH
if [[ `command -v cmake` ]]
then
19
    echo "Found cmake"
20
else
21 22 23
    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
24 25 26
fi
if [[ `command -v make` ]]
then
27
    echo "Found make"
28
else
29 30 31
    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
32 33
fi

34 35 36 37 38 39
# source additional environment variables
source "$ROS_HOME"/setup.bash

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

curDir=`dirname "$0"`
48 49 50 51
# configure cmake
cmake -B"$curDir/build/" -H"$curDir/src/" -DCMAKE_INSTALL_PREFIX="$curDir/install"  "$@"
# build
cmake --build "$curDir/build/" --target install --config Release