2024-02-23 07:15:32 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Author: Jake Goodwin
|
|
|
|
# Date: 2024
|
|
|
|
# Filename: tdd.sh
|
|
|
|
|
|
|
|
CROSS_TC_WIN="$(pwd)/i686-w64-mingw32_toolchain.cmake"
|
|
|
|
CMAKE_VERBOSE="ON"
|
|
|
|
CROSS_COMPILE=1
|
|
|
|
|
|
|
|
clear_cmake_cache () {
|
|
|
|
cd ./build
|
|
|
|
rm -rf CMakeCache.txt CMakeFiles/
|
|
|
|
}
|
|
|
|
|
2024-03-01 06:35:06 +00:00
|
|
|
add_new_module () {
|
|
|
|
read -p "Enter the name of the module:" modname
|
|
|
|
modsrc_dir="./src/${modname}"
|
|
|
|
modtest_dir="./tests/${modname}"
|
|
|
|
|
|
|
|
echo "creating: ${modsrc_dir}, ${modtest_dir}"
|
|
|
|
mkdir $modsrc_dir
|
|
|
|
mkdir $modtest_dir
|
|
|
|
|
|
|
|
#copy the template files.
|
|
|
|
}
|
|
|
|
|
2024-02-23 07:15:32 +00:00
|
|
|
cross_compile () {
|
|
|
|
echo "ERROR: Currently no toolchain / target!"
|
|
|
|
}
|
|
|
|
|
|
|
|
build_release() {
|
|
|
|
clear_cmake_cache
|
|
|
|
cmake -DCAM_HANDLER_LIB=ON -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE} ../
|
|
|
|
make camera_handler
|
|
|
|
}
|
|
|
|
|
|
|
|
build_main () {
|
|
|
|
clear_cmake_cache
|
|
|
|
|
|
|
|
cmake -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE} ../
|
|
|
|
make main
|
|
|
|
}
|
|
|
|
|
|
|
|
run_c_tests () {
|
|
|
|
cp ./src/camera_handler/testdata.bin /tmp/
|
|
|
|
clear_cmake_cache
|
|
|
|
cmake -DUNIT_TESTING=ON -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE} ../
|
|
|
|
make all && ctest
|
|
|
|
}
|
|
|
|
|
|
|
|
print_menu () {
|
|
|
|
echo "BUILD MENU:"
|
|
|
|
echo "1. Run Tests"
|
|
|
|
echo "2. Build Project"
|
|
|
|
echo "3. Build for release"
|
|
|
|
echo "4. cross compile for XXXXXX"
|
2024-03-01 06:35:06 +00:00
|
|
|
echo "5. Add new module to project"
|
|
|
|
echo "6. Exit"
|
2024-02-23 07:15:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-03-01 06:35:06 +00:00
|
|
|
main() {
|
2024-02-23 07:15:32 +00:00
|
|
|
valid_choice=false
|
|
|
|
|
|
|
|
while [ "$valid_choice" != true ]; do
|
|
|
|
print_menu
|
|
|
|
read -p "Enter your choice: " choice
|
|
|
|
|
|
|
|
case $choice in
|
|
|
|
1)
|
|
|
|
echo "You selected Option 1"
|
|
|
|
valid_choice=true
|
|
|
|
run_c_tests
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
echo "You selected Option 2"
|
|
|
|
valid_choice=true
|
|
|
|
build_main
|
|
|
|
;;
|
|
|
|
3)
|
|
|
|
echo "You selected Option 3"
|
|
|
|
valid_choice=true
|
|
|
|
build_release
|
|
|
|
;;
|
|
|
|
4)
|
|
|
|
echo "You selected Option 4"
|
|
|
|
valid_choice=true
|
|
|
|
cross_compile
|
|
|
|
;;
|
|
|
|
5)
|
2024-03-01 06:35:06 +00:00
|
|
|
echo "You selected Option 5"
|
|
|
|
valid_choice=true
|
|
|
|
add_new_module
|
|
|
|
;;
|
|
|
|
6)
|
2024-02-23 07:15:32 +00:00
|
|
|
echo "Exiting..."
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Invalid choice. Please select a valid option."
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
main
|