format_source.sh 495 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. files=(`find ./src ./tests ./sandbox ./tools ./shaders ./samples -name '*.h' -o -name '*.hpp' -o -name '*.c' -o -name '*.cpp' -o -name '*.glsl'`)
  3. filecount=${#files[@]}
  4. count=0
  5. for f in ${files[@]}
  6. do
  7. # Run it in parallel
  8. echo -ne Formatting ${count}/${filecount}\\r
  9. ./thirdparty/bin/clang-format -sort-includes=false -i ${f} &
  10. count=$((${count}+1))
  11. # Throttle the parallel commands
  12. if !((count % 16)); then
  13. wait
  14. fi
  15. done
  16. wait
  17. echo Done! Formatted ${filecount} files