Skip to content
Snippets Groups Projects
Commit be4c683c authored by Andrea Michelotti's avatar Andrea Michelotti
Browse files

supporting different build dir in generate_us

parent 9d9b95fb
No related branches found
No related tags found
No related merge requests found
......@@ -253,9 +253,9 @@ execute_process(
if( EXISTS "${CHAOS_BUNDLE}/driver")
IF(NOT EXISTS "${TOP_DIRECTORY}/UnitServer" )
MESG("Generating UnitServer, looking for CUs in ${CHAOS_BUNDLE}/driver, please wait...")
MESG("Generating UnitServer, looking for CUs in ${CHAOS_BUNDLE}/driver, build dir:${CMAKE_BINARY_DIR} please wait...")
execute_process(
COMMAND chaosframework/tools/chaos_generate_us.sh -i driver -o ${TOP_DIRECTORY}
COMMAND chaosframework/tools/chaos_generate_us.sh -i driver -o ${TOP_DIRECTORY} -b ${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CHAOS_BUNDLE}
RESULT_VARIABLE err
OUTPUT_VARIABLE out
......
......@@ -16,9 +16,15 @@ skipdir=();
TEMP_DIR="/tmp/$USER/"
TEMP_CMAKE="$TEMP_DIR/cmakelist.txt"
mkdir -p $TEMP_DIR
while getopts i:o:n:hs: opt; do
builddir="$curr"
while getopts i:o:n:hs:b: opt; do
case $opt in
b) if [[ "$OPTARG" = /* ]]; then
builddir="$OPTARG"
else
builddir="$curr/$OPTARG"
fi
;;
i) startdir=$OPTARG
;;
o) outdir=$OPTARG
......@@ -27,12 +33,14 @@ while getopts i:o:n:hs: opt; do
;;
s) skipdir+=($OPTARG)
;;
h) echo -e "Usage : $exename [-i <input directory>] [-o <output directory>] [-n <project name>] [-s <directory to skip>]\n-i <input direcory>: directory that contains CUs\n-o <output directory>: Unit Server project dir\n-n <project name>: name of the unit server project\n-s <directory>: skip the specified directory"
h) echo -e "Usage : $exename [-i <input directory>] [-o <output directory>] [-n <project name>] [-s <directory to skip>]\n-i <input direcory>: directory that contains CUs\n-o <output directory>: Unit Server project dir\n-n <project name>: name of the unit server project\n-s <directory>: skip the specified directory\n[-b <specify build dir>]"
exit 0
;;
esac
done
echo "* assuming build directory:$builddir"
OS=`uname -s`
if [ $OS == "Darwin" ];then
if gsed --v >& /dev/null;then
......@@ -57,7 +65,7 @@ fi
pushd $startdir > /dev/null
curr=`pwd -P`
findopt=""
echo "startdir $curr"
echo "* startdir $curr"
lista_ignore=`find . -name UnitServerIgnore`
for m in $lista_ignore;do
......@@ -73,10 +81,10 @@ listcmake=$(eval $cmd);
for m in $listcmake;do
dir=`dirname $m`
if [ ! -d $dir/CMakeFiles ] && [ "$dir" != "." ];then
if [ ! -d $builddir/$startdir/$dir/CMakeFiles ] && [ "$builddir/$startdir/$dir" != "." ];then
p=`echo "$dir"|sed 's/\./\*/g'`
findopt="$findopt -not -path \"$p*\""
echo "* skipping directory not configured $dir"
echo "* skipping directory not configured $builddir/$stardir/$dir"
fi
done
......@@ -190,10 +198,10 @@ for c in $listcmake;do
continue;
fi
testmake=`dirname $c`
if [ ! -d "$testmake/CMakeFiles" ];then
echo "* skipping $c not compiled"
continue
fi
# if [ ! -d "$testmake/CMakeFiles" ];then
# echo "* skipping $c not compiled"
# continue
# fi
CL=$c
dir=`dirname $c`
......@@ -278,8 +286,11 @@ for c in $listcmake;do
done;
echo -e "// Project $pname" > $project_dir/main.cpp
dat=`date`
echo -e "// includes the available CU in \"$prefix\"" >> $project_dir/main.cpp
echo -e "// generated by \"$exename\" at $dat \n\n" >> $project_dir/main.cpp
echo -e "// generated by \"$exename\"\n\n" >> $project_dir/main.cpp
echo -e "#include <chaos/common/chaos_constants.h>\n#include <chaos/cu_toolkit/ChaosCUToolkit.h>\n#include <chaos/common/exception/CException.h>\n" >> $project_dir/main.cpp
echo -e "/*** CU Types ****/\n">>$project_dir/main.cpp
......@@ -309,7 +320,7 @@ for c in $lista_driver; do
echo -e "\t\t$c; /* file: ${lista_hd[$arr]} */" >> $project_dir/main.cpp
((arr++))
done
echo -e "\t\tchaos::cu::ChaosCUToolkit::getInstance()->start();" >> $project_dir/main.cpp
echo -e "\t\tLDBG_<<\"UnitServer created automatically at $dat\"; chaos::cu::ChaosCUToolkit::getInstance()->start();" >> $project_dir/main.cpp
echo -e "\t} catch (chaos::CException& e) {\n\t\tstd::cerr<<\"Exception:\"<<std::endl;\n\t\tstd::cerr<< \"domain :\"<<e.errorDomain << std::endl;\n\t\tstd::cerr<< \"cause :\"<<e.errorMessage << std::endl;return -1;\n\t} catch (program_options::error &e){\n\t\tstd::cerr << "\"Unable to parse command line: \"" << e.what() << std::endl;return -2;\n\t} catch (...){\n\t\tstd::cerr << \"unexpected exception caught.. \" << std::endl;return -3;\n\t}return 0;\n}\n" >> $project_dir/main.cpp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment