Commit e89967db authored by Arnaud Blanchard's avatar Arnaud Blanchard

Allow to launch run.sh in local directories

parent 5778a75b
......@@ -11,27 +11,38 @@
#Author: Arnaud Blanchard
#Date: April 2015
current_dir=`pwd`
parent_dir=`dirname $current_dir`
./compile.sh $1 Release $1 >&2 #compile only the executable target
fail=$?
cd $current_dir
if [ $fail != 0 ];
then
echo "fail compiling '$1'" >&2
exit 1
fi
bin_dir="$parent_dir/`basename $current_dir`_build/Release/bin"
program=`basename $1`
shift #remove $0 i.e. run.sh
echo "execute:" >&2
set -x
$bin_dir/$program "$@"
usage()
{
echo "usage: run.sh <project dir> [args ...]" >&2
}
{ #Bracket to not change directory
[ $1 ] || { echo "Missing project directory."; usage; exit 1; }
cd $1;
project_dir="$PWD";
project_name=`basename $project_dir`;
cd -
cd `dirname $0`
blaar_dir="$PWD"
blaar_build_dir="${blaar_dir}_build"
echo $blaar_dir $project_dir
./compile.sh "$project_dir" "Release" "$project_name" >&2
[ $? ] || { echo "Fail compiling '$project_dir'" >&2; exit 2; }
bin_dir="$blaar_build_dir/Release/bin"
shift #remove $0 i.e. run.sh
echo >&2
echo "Execute:" >&2
echo "========" >&2
set -x #display command line
$bin_dir/$project_name "$@"
exit $?
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment