Kiibohd Controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

buildall.bash 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/env bash
  2. ###| Builder Script |###
  3. #
  4. # Builds all permutations of modules
  5. # This script is an attempt to maintain module sanity as new ones are added
  6. #
  7. # Fortunately, sweeping API changes don't happen much anymore...but just in case...
  8. #
  9. # Written by Jacob Alexander 2013 for the Kiibohd Controller
  10. # Released into the Public Domain
  11. #
  12. ###
  13. ## TODO List ##
  14. # - Complete non-Scan module permutations (will take extra work)
  15. # - Add command line arguments
  16. # - Add help flag for usage
  17. # - Make sure the script is being run from the correct directory
  18. main() {
  19. ERROR="\e[5;1;31mERROR\e[0m:"
  20. failCount=0
  21. # Scan for list of Scan Modules
  22. scanModules=$(ls Scan)
  23. # Prune out "invalid" modules (parent modules)
  24. scanModules=${scanModules[@]//matrix/}
  25. # Create permutation directories
  26. # Then run cmake, and run each build permutation
  27. # Keeping track of how many builds failed/passed
  28. for mod in $scanModules; do
  29. module=$(tr -dc "[:print:]" <<< "$mod")
  30. # Create directory, but do not error if it exists already
  31. mkdir -p build/$module
  32. cd build/$module
  33. # Make sure CMake has been run, and attempt to build
  34. cmake -DScanModuleOverride=$module ../.. && make || let failCount++
  35. # Cleanup, for the next build
  36. cd - > /dev/null
  37. done
  38. totalModules=$(echo $scanModules | wc -w)
  39. if (( failCount > 0 )); then
  40. echo -e "$ERROR $failCount/$totalModules failed"
  41. else
  42. echo -e "Build Success!"
  43. fi
  44. }
  45. #| Main Script Entry
  46. main "$@"
  47. exit 0