#!/bin/sh SCRIPT=$(readlink -f "$0") SCRIPTDIR=$(dirname "$SCRIPT") usage=" \n ### Deploy AMDA Kernel ### \n \n Usage : $0 -b -c -d -p \n \n $0 -b Debug -c /opt -d amdadev.fr -p 5000 \n \n \n ###" while getopts "b:c:d:p:h" options; do case $options in b ) KERNEL_BUILD_TYPE=`echo $OPTARG`;; c ) COTS_DIR=`echo $OPTARG`;; d ) DDSERVER_HOST_NAME=`echo $OPTARG`;; p ) DDSERVER_PORT=`echo $OPTARG`;; h ) echo -e $usage exit 1;; \? ) echo -e $usage exit 1;; * ) echo -e $usage exit 1;; esac done if [ "$COTS_DIR" = "" ] then echo -e $usage exit 1 fi if [ -d "$COTS_DIR/tools/gcc" ]; then GCC_ROOT="$COTS_DIR/tools/gcc/4.7.2/rtf" else GCC_ROOT="/usr" fi if [ -d "$COTS_DIR/tools/gcc/4.7.2/boost" ]; then BOOST_ROOT="$COTS_DIR/tools/gcc/4.7.2/boost" else BOOST_ROOT="/usr" fi if [ ! -d "$COTS_DIR/local/lib" ]; then echo -e $usage echo "[ERROR] Cannot find lib directory $COTS_DIR/local/lib" exit 1 fi if [ "$DDSERVER_HOST_NAME" = "" ] then echo -e $usage exit 1 fi if [ "$DDSERVER_PORT" = "" ] then echo -e $usage exit 1 fi if [ "$KERNEL_BUILD_TYPE" = "Debug" ] then echo "[INFO] Install AMDA Kernel in Debug mode" elif [ "$KERNEL_BUILD_TYPE" = "Release" ] then echo "[INFO] Install AMDA Kernel in Release mode" else echo -e $usage exit 1 fi export AMDA_COTS_DIR="$COTS_DIR" export DDSERVER_HOST_NAME="$DDSERVER_HOST_NAME" export DDSERVER_PORT="$DDSERVER_PORT" export GCC_ROOT="$GCC_ROOT" export BOOST_ROOT="$BOOST_ROOT" export LD_LIBRARY_PATH="$COTS_DIR/local/lib:$GCC_ROOT/lib64:$GCC_ROOT/lib:$LD_LIBRARY_PATH" export PATH="$COTS_DIR/local/bin:$GCC_ROOT/bin:$PATH" cmake -E make_directory "$SCRIPTDIR/../build" cmake -E make_directory "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE" cmake -E chdir "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE" cmake -DCMAKE_C_COMPILER="$GCC_ROOT/bin/gcc" -DCMAKE_CXX_COMPILER="$GCC_ROOT/bin/g++" -DCMAKE_BUILD_TYPE=$KERNEL_BUILD_TYPE ../.. cmake --build "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE" make -C "$SCRIPTDIR/../build/$KERNEL_BUILD_TYPE" install VERBOSE=1