fi
}
+copy_native_core()
+{
+ if [ "$3" == "utc" ]; then
+ if [[ $2 =~ "dali-" ]]; then
+ cp $2/*core.cpp $1/src/.
+ else
+ cp $2/*core.c $1/src/.
+ fi
+ else
+ if [[ $2 =~ "dali-" ]]; then
+ cp $2/*native.cpp $1/src/.
+ else
+ cp $2/*native.c $1/src/.
+ fi
+
+ fi
+}
+
deploySourceFile() {
rm -rf $1/src/*.c
rm -rf $1/inc/*.h
#copying common source and header files
cp $2/../../common/*.c $1/src/.
cp $2/../../common/*.h $1/inc/.
+ if [[ $2 =~ "dali-" ]]; then
+ cp $2/../../common/*.cpp $1/src/.
+ fi
#copying module specific header files
find $2 -name "*.h" | xargs cp -t $1/inc/
elif [ "$3" == "wearable" ]; then
macro="WEARABLE"
fi
-
- CmakeFlag=0
+
+
while read line
- do
- if [[ $line =~ $macro ]]
- then
- flag=1
- if [ 1 == "$flag" ]; then
+
+ #Copy c/cpp files as per entry in CMakeFile for common files
+ do
+ if ! [[ $lastline =~ $macro ]]; then
+ if [[ $line =~ "SET(TC_SOURCES" || $line =~ "GLOB TC_SOURCES" ]]; then
while true
do
read srcFile
substring=$(echo $srcFile | tail -c 3)
if [ "$substring" == ".c" ]; then
- CmakeFlag=1
cp $2/$srcFile $1/src/.
fi
- if [[ $srcFile == *"ENDIF"* ]]; then
- flag=0
- if [ "$5" == "utc" ]; then
- cp $2/*core.c $1/src/.
- else
- cp $2/*native.c $1/src/.
- fi
+ substring=$(echo $srcFile | tail -c 5)
+ if [ "$substring" == ".cpp" ]; then
+ cp $2/$srcFile $1/src/.
+ fi
+
+ substring=$(echo $srcFile | tail -c 2)
+ if [ "$substring" == ")" ]; then
+ chCount=${#srcFile}
+ chCount=$((chCount-1))
+ substring=$(echo $srcFile | head -c $chCount)
+ cp $2/$substring $1/src/.
+ copy_native_core $1 $2 $5
+ break
+ elif [[ $srcFile == ")" ]]; then
+ copy_native_core $1 $2 $5
break
fi
done
+
fi
fi
+ lastline=$line
done < $2/CMakeLists.txt
-
- #copying module source files not having device specific macros in CMakeLists.txt
- if [ $CmakeFlag -eq 0 ]; then
- if [[ $2 =~ "dali-" ]]; then
- find $2 -name "*.cpp" | xargs cp -t $1/src/
- else
- find $2 -name "*.c" | xargs cp -t $1/src/
+
+ #Copy profile specific (mobile/wearable) c/cpp files as per entry in CMakeFile
+ while read line
+ do
+ if [[ $line =~ $macro ]]
+ then
+
+ while true
+ do
+ read srcFile
+ substring=$(echo $srcFile | tail -c 3)
+ if [ "$substring" == ".c" ]; then
+ cp $2/$srcFile $1/src/.
+ fi
+ if [[ $srcFile == *"ENDIF"* ]]; then
+ if [ "$5" == "utc" ]; then
+ cp $2/*core.c $1/src/.
+ else
+ cp $2/*native.c $1/src/.
+ fi
+ break
+ fi
+ done
fi
- fi
+ done < $2/CMakeLists.txt
# copying data and shared data
find $2/. -type f ! -iname "*.c" ! -iname "*.h" ! -iname "*.tpk" ! -iname "CMakeLists.txt" -exec cp {} $1/shared/res \;
sed -i -f scripts_tpk/$3.sed $1/inc/tct_common.h
# include tct_common.h in utc source files
- if [ "$5" == "utc" ]; then
+ if [[ $2 =~ "dali-" ]]; then
+ for srcFile in `ls $1/src/`
+ do
+ sed -i '1i\#include <tct_common.h>' $1/src/$srcFile
+ done
+ elif [ "$5" == "utc" ]; then
for srcFile in `ls $1/src/ | grep -v core | grep -v common`
do
sed -i '1i\#include <tct_common.h>' $1/src/$srcFile
done
fi
+
cd $1
if [[ $2 =~ "dali-" ]]; then
find ./src -iname *.cpp -print0 | tr '\0' ' ' > test.files
+ find ./src -iname *.c -print0 | tr '\0' ' ' >> test.files
else
find ./src -iname *.c -print0 | tr '\0' ' ' > test.files
fi