added template building code into the script
This commit is contained in:
parent
afd2bca9b3
commit
ed5a879a4e
28
tdd.sh
28
tdd.sh
|
@ -6,6 +6,8 @@
|
|||
CROSS_TC_WIN="$(pwd)/i686-w64-mingw32_toolchain.cmake"
|
||||
CMAKE_VERBOSE="ON"
|
||||
CROSS_COMPILE=1
|
||||
TEMPLATE_FILES=".template_files"
|
||||
MODULE_DIR="${TEMPLATE_FILES}/modules"
|
||||
|
||||
clear_cmake_cache () {
|
||||
cd ./build
|
||||
|
@ -14,6 +16,8 @@ clear_cmake_cache () {
|
|||
|
||||
add_new_module () {
|
||||
read -p "Enter the name of the module:" modname
|
||||
|
||||
modname_cap=$(echo $modname | sed 's/[a-z]/\U&/g')
|
||||
modsrc_dir="./src/${modname}"
|
||||
modtest_dir="./tests/${modname}"
|
||||
|
||||
|
@ -22,6 +26,30 @@ add_new_module () {
|
|||
mkdir $modtest_dir
|
||||
|
||||
#copy the template files.
|
||||
echo "copying & customizing template files..."
|
||||
|
||||
sed "s/module_name/${modname}/" $MODULE_DIR/module_name.c > $modsrc_dir/${modname}.c
|
||||
sed "s/module_name/${modname_cap}/" $MODULE_DIR/module_name.h > $modsrc_dir/${modname}.h
|
||||
sed "s/module_name/${modname}/" $MODULE_DIR/CMakeLists.txt > $modsrc_dir/CMakeLists.txt
|
||||
|
||||
sed "s/module_name/${modname}/" $MODULE_DIR/test_module_name.c > $modsrc_dir/test_${modname}.c
|
||||
sed "s/module_name/${modname}/" $MODULE_DIR/TestCMakeLists.txt > $modsrc_dir/CMakeLists.txt
|
||||
|
||||
echo "Resulting files/dirs:"
|
||||
tree -L 2 $modsrc_dir
|
||||
tree -L 2 $modtest_dir
|
||||
|
||||
# Now we add the new files to the git tracked files
|
||||
|
||||
|
||||
del_module
|
||||
}
|
||||
|
||||
del_module () {
|
||||
read -p "Enter the name of the module:" modname
|
||||
|
||||
rm -r ./tests/${modname}
|
||||
rm -r ./src/${modname}
|
||||
}
|
||||
|
||||
cross_compile () {
|
||||
|
|
Loading…
Reference in New Issue