gen_filelists.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. basedir="../.."
  3. file=Build/cmake/FileList.cmake
  4. src='set(lib_SRC_FILES'
  5. hdr='set(lib_HDR_FILES'
  6. pubhdr='set(lib_PUB_HDR_FILES'
  7. srcdir='${PROJECT_SOURCE_DIR}'
  8. srcpath=Source
  9. hdrpath=Include/Rocket
  10. pypath=Python
  11. printfiles() {
  12. # Print headers
  13. echo ${hdr/lib/$1} >>$file
  14. find $srcpath/$1/ -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; >>$file
  15. echo -e ')\n' >>$file
  16. # Print public headers
  17. echo ${pubhdr/lib/$1} >>$file
  18. find $hdrpath/$1/ -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; >>$file
  19. # Print main public header
  20. echo ' '$srcdir/Include/Rocket/$1.h >>$file
  21. echo -e ')\n' >>$file
  22. # Print source files
  23. echo ${src/lib/$1} >>$file
  24. find $srcpath/$1/ -maxdepth 1 -iname "*.cpp" -exec echo ' '$srcdir/{} \; >>$file
  25. echo -e ')\n' >>$file
  26. }
  27. printpyfiles() {
  28. # Print headers
  29. echo ${hdr/lib/Py${1,}} >>$file
  30. find $srcpath/$1/$pypath -iname "*.h" -exec echo ' '$srcdir/{} \; >>$file
  31. echo -e ')\n' >>$file
  32. # Print public headers
  33. echo ${pubhdr/lib/Py${1,}} >>$file
  34. find $hdrpath/$1/$pypath -iname "*.h" -exec echo ' '$srcdir/{} \; >>$file 2>/dev/null
  35. echo -e ')\n' >>$file
  36. # Print source files
  37. echo ${src/lib/Py${1,}} >>$file
  38. find $srcpath/$1/$pypath -iname "*.cpp" -exec echo ' '$srcdir/{} \; >>$file
  39. echo -e ')\n' >>$file
  40. }
  41. pushd $basedir
  42. echo -e "# This file was auto-generated with gen_filelists.sh\n" >$file
  43. for lib in "Core" "Controls" "Debugger"; do
  44. printfiles $lib
  45. done
  46. for lib in "Core" "Controls"; do
  47. printpyfiles $lib
  48. done
  49. popd