Commit 2ac4205a authored by Arnaud Blanchard's avatar Arnaud Blanchard

Clean sh files

parent b1a0eeca
......@@ -9,15 +9,15 @@
#!/usr/bin/env bash #Use your $PATH to find bash
set -o errexit #Exit on first error
set -o nounset #Error if a variable is used but nont defined
set -o nounset #Error if a variable is used but not defined
set -o pipefail #Error if a pipe fail
usage(){
echo "usage: compile.sh [-h] [-q] <project dir> [Release|Debug|RelWithDebugInfo|MinSizeRel] [<target>]"
echo "usage: compile.sh [-h] <project dir> [Release|Debug|RelWithDebugInfo|MinSizeRel] [<target>]"
}
set -- $(getopt hq "$@")
args=$(getopt h $*) || { usage; exit 1; }
set -- $args #update positional parameter
while [ $# -gt 0 ]
do
case "$1" in
......@@ -45,8 +45,8 @@ echo "Compiling **$project_dir**"
if [ $# -gt 1 ]; then
case $2 in
Release|Debug|RelWithDebugInfo|MinSizeRel) build_type="$2";;
*)echo "Unknown build type '$2'">&2; usage;;
Release|Debug|RelWithDebugInfo|MinSizeRel) build_type="$2";;
*)echo "Unknown build type '$2'"; usage;;
esac
else build_type="Release"
fi
......@@ -57,7 +57,7 @@ else
target="$project_name"
fi
build_dir="$blaar_build_dir/${build_type}/cmake_files/$project_name"
build_dir="$blaar_build_dir/cmake_files_${build_type}/$project_name"
mkdir -p "$build_dir"
mkdir -p "$blaar_build_dir/Release"
......@@ -68,8 +68,6 @@ cd $build_dir
#On mac and linux -nt does not return the same if the file does not exist. We have to check the no existance or seniority
[ ! -e build.ninja -o $project_dir/CMakeLists.txt -nt build.ninja ] && {
cmake -GNinja --no-warn-unused-cli $project_dir -DCMAKE_BUILD_TYPE=$build_type -DLIBRARY_OUTPUT_PATH="${blaar_build_dir}/${build_type}" -DEXECUTABLE_OUTPUT_PATH="${blaar_build_dir}/${build_type}" || exit 2;
cmake --no-warn-unused-cli -GNinja $project_dir -DCMAKE_BUILD_TYPE=$build_type -DLIBRARY_OUTPUT_PATH="${blaar_build_dir}/${build_type}" -DEXECUTABLE_OUTPUT_PATH="${blaar_build_dir}/${build_type}"
}
ninja $target
ninja
......@@ -33,6 +33,8 @@ cd $(dirname $0)
blaar_dir="$PWD"
blaar_build_dir="${blaar_dir}_build"
mkdir -p /tmp/blaar
./compile.sh "$project_dir" "Debug" "$project_name" > /tmp/blaar/compile_${project_name}.log || { echo "Fail compiling '$project_dir'"; cat /tmp/blaar/compile_$project_name.log; exit 2; }
bin_dir="$blaar_build_dir/Debug"
......
......@@ -17,16 +17,21 @@ set -o nounset #Error if a variable is used but nont defined
set -o pipefail #Error if a pipe fail
usage(){
echo "Usage: install [-h] [-i diectory] <all>|<project_directory> [Release|Debug|RelWithDebugInfo|MinSizeRel]"
echo
echo "Usage: install [-h] [-v verbose] <all>|<project_directory> [Release|Debug|RelWithDebugInfo|MinSizeRel]"
echo " -h :Display this help."
echo "Default 'Release' version"
echo
}
set -- $(getopt b:hi:q "$@")
VERBOSE=0
args=$(getopt hv $*) || { usage; exit 1; }
set -- $args #update positional parameter
while [ $# -gt 0 ]
do
case "$1" in
(-h) usage; exit 0;;
(-v) echo "Verbose mode"; VERBOSE=1;;
(--) shift; break;;
(-*) echo "$0: error - unrecognized option $1" ; exit 1;;
(*) break;;
......@@ -39,14 +44,13 @@ done
if [ $# -gt 1 ]; then
case "$2" in
Release|Debug|RelWithDebugInfo|MinSizeRel) build_type="$2";;
*)echo "Unknown build type '$2'">&2; usage;;
*)usage; echo "Unknown build type '$2'"; exit 1;;
esac
else
build_type="Release"
fi
#We go to blaar directory save it and go to the previous directory. Usefull if install.sh is not call from blaar directory
cd $(dirname $0)
......@@ -60,12 +64,17 @@ if [ "$1" = "all" ]; then
cat .gitmodules | sed -n 's/.*path = //p' |
while read project_path
do
project_name=`basename $project_path`o
echo "Install **$project_path**"
developer_tools/install_project.sh $project_path $build_type > /tmp/blaar/install_${project_name}.log || { echo; echo "Fail installing '$project_path'"; cat /tmp/blaar/install_${project_name}.log; echo; exit 2; };
project_name=`basename $project_path`
command="developer_tools/install_project.sh $project_path $build_type"
if [ $VERBOSE = 1 ]; then
$command
else
echo "Install **$project_path**"
$command > /tmp/blaar/install_${project_name}.log || { echo; echo "Fail executing '$command'"; cat /tmp/blaar/install_${project_name}.log; echo; exit 2; };
fi
done
echo
else
developer_tools/install_project.sh $1 $build_type || { echo; echo "Fail installing '$1'"; exit 2; }
developer_tools/install_project.sh $1 $build_type
fi
......@@ -35,21 +35,17 @@ usage(){
blaar_dir="$PWD"
blaar_build_dir="${blaar_dir}_build"
mkdir -p /tmp/blaar
cd $blaar_dir
./compile.sh "$project_dir" "Release" "$project_name" > /tmp/blaar/compile_$project_name.log || { echo "Fail compiling '$project_dir'"; cat /tmp/blaar/compile_$project_name.log; exit 2; }
bin_dir="$blaar_build_dir/Release"
shift #remove $0 i.e. run.sh from $@
command_line="$bin_dir/$project_name $@"
echo
echo "Compile and execute: $command_line"
echo
echo "Compile and execute: $bin_dir/$project_name $@"
} 1>&2
#Finaly we launch it
$command_line
#Finaly we launch it. We have to avoid intermediate variable otherwise $@ does not keep " " effect
$bin_dir/$project_name "$@"
#!/bin/sh
#BLARR - Basic Librairies And Applications for Robotics
#Copyright ETIS — ENSEA, Université de Cergy-Pontoise, CNRS (2015 - 2016
#Basic Librairies And Applications for Robotics (BLAAR)
#Copyright ETIS — ENSEA, Université de Cergy-Pontoise, CNRS (2015 - 2017)
#This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
#You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
#As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
#In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
#Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security.
#The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms. *
#
#Author: Arnaud Blanchard
#Date: April 2015
#The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
#!/usr/bin/env bash #Use your $PATH to find bash
set -o errexit #Exit on first error
set -o nounset #Error if a variable is used but nont defined
set -o pipefail #Error if a pipe fail
current_dir=`pwd`
parent_dir=`dirname $current_dir`
build_dir="$parent_dir/`basename $current_dir`_build"
if [[ $# != 1 ]]
#We go to the project directory and get the directory name then we go back to seach for the baar directory
cd $1
project_dir="$PWD"
project_name=$(basename $project_dir)
cd - >/dev/null #Now we have the project directory we go back in current directory without message (/dev/null)
#We go in blaar directory
cd $(dirname $0)
blaar_dir="$PWD"
blaar_build_dir="${blaar_dir}_build"
build_dir="$blaar_build_dir"
if [ $# -ne 1 ]
then
echo "You need a project directory as argument."
echo "Usage : xcode_project <project_directory>"
exit 1
fi
name=`basename $1`
developer_tools/create_project.sh $1 $build_dir xcode
if (( $? == 0 ))
then
open $build_dir/xcode/$1/$name.xcodeproj
fi
open $build_dir/cmake_files_xcode/$project_name/$project_name.xcodeproj
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