Kiibohd Controller
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Este repositório está arquivado. Você pode visualizar os arquivos e realizar clone, mas não poderá realizar push nem abrir issues e pull requests.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/bin/bash
  2. # This is bash lib file for the convenience build scripts
  3. # Don't call this script directly
  4. # Jacob Alexander 2015
  5. # Make sure all of the relevant variables have been set
  6. # NOTE: PartialMaps and DefaultMap do not have to be set
  7. VariablesList=(BuildPath BaseMap ScanModule MacroModule OutputModule DebugModule Chip Compiler)
  8. ExitEarly=false
  9. for var in ${VariablesList[@]}; do
  10. if [ -z ${!var+x} ]; then
  11. echo "ERROR: Unset variable => '${var}'"
  12. ExitEarly=true
  13. fi
  14. done
  15. # Error was detected, exit immediately
  16. if $ExitEarly; then
  17. exit 1
  18. fi
  19. # Prepare PartialMaps
  20. PartialMapsExpanded="${PartialMaps[1]}"
  21. count=2 # Start the loop at index 2
  22. while [ "$count" -le "${#PartialMaps[@]}" ]; do
  23. PartialMapsExpanded="${PartialMapsExpanded};${PartialMaps[count]}"
  24. count=$(($count+1))
  25. done
  26. # Internal Variables
  27. CMakeListsPath="../.."
  28. PROG_NAME=$(basename $0)
  29. # Process the command line arguments (if any)
  30. while (( "$#" >= "1" )); do
  31. # Scan each argument
  32. key="$1"
  33. case $key in
  34. -c|--cmakelists-path)
  35. CMakeListsPath="$2"
  36. shift
  37. ;;
  38. -f|--force-rebuild)
  39. # Remove the old directory first
  40. rm -rf "${BuildPath}"
  41. ;;
  42. -o|--output-path)
  43. BuildPath="$2"
  44. shift
  45. ;;
  46. -h|--help)
  47. echo "Usage: $PROG_NAME [options...]"
  48. echo ""
  49. echo "Convenience script to build the source of a given keyboard."
  50. echo "Edit '$PROG_NAME' to configure the keyboard options such as KLL layouts."
  51. echo ""
  52. echo "Arguments:"
  53. echo " -c, --cmakelists-path PATH Set the path of CMakeLists.txt"
  54. echo " Default: ${CMakeListsPath}"
  55. echo " -f, --force-rebuild Deletes the old build directory and rebuilds from scratch."
  56. echo " -o, --output-path PATH Set the path of the build files."
  57. echo " Default: ${BuildPath}"
  58. echo " -h, --help This message."
  59. exit 1
  60. ;;
  61. *)
  62. echo "INVALID ARG: '$1'"
  63. exit 2
  64. ;;
  65. esac
  66. # Shift to the next argument
  67. shift
  68. done
  69. # Run CMake commands
  70. ## TODO Check for windows and do windows specific things ##
  71. mkdir -p "${BuildPath}"
  72. cd "${BuildPath}"
  73. cmake -DCHIP="${Chip}" -DCOMPILER="${Compiler}" -DScanModule="${ScanModule}" -DMacroModule="${MacroModule}" -DOutputModule="${OutputModule}" -DDebugModule="${DebugModule}" -DBaseMap="${BaseMap}" -DDefaultMap="${DefaultMap}" -DPartialMaps="${PartialMapsExpanded}" "${CMakeListsPath}"
  74. make
  75. echo "Firmware has been compiled into: '${BuildPath}'"