gen_filelists.sh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/usr/bin/env bash
  2. basedir="../.."
  3. file=Build/cmake/FileList.cmake
  4. src='set(lib_SRC_FILES'
  5. hdr='set(lib_HDR_FILES'
  6. masterpubhdr='set(MASTER_lib_PUB_HDR_FILES'
  7. pubhdr='set(lib_PUB_HDR_FILES'
  8. srcdir='${PROJECT_SOURCE_DIR}'
  9. srcpath=Source
  10. hdrpath=Include/Rocket
  11. pypath=Python
  12. luapath=Lua
  13. printfiles() {
  14. # Print headers
  15. echo ${hdr/lib/$1} >>$file
  16. find $srcpath/$1 -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  17. echo -e ')\n' >>$file
  18. # Print master header for library
  19. echo ${masterpubhdr/lib/$1} >>$file
  20. echo ' '$srcdir/Include/Rocket/$1.h >>$file
  21. echo -e ')\n' >>$file
  22. # Print public headers sub directory
  23. echo ${pubhdr/lib/$1} >>$file
  24. find $hdrpath/$1 -maxdepth 1 \( -iname "*.h" -o -iname "*.inl" \) -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  25. echo -e ')\n' >>$file
  26. # Print source files
  27. echo ${src/lib/$1} >>$file
  28. find $srcpath/$1 -maxdepth 1 -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  29. echo -e ')\n' >>$file
  30. }
  31. printpyfiles() {
  32. # Print headers
  33. echo ${hdr/lib/Py${1}} | sed 's/PyCo/Pyco/' >>$file
  34. find $srcpath/$1/$pypath -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  35. echo -e ')\n' >>$file
  36. # Print public headers
  37. echo ${pubhdr/lib/Py${1}} | sed 's/PyCo/Pyco/' >>$file
  38. find $hdrpath/$1/$pypath -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file 2>/dev/null
  39. echo -e ')\n' >>$file
  40. # Print source files
  41. echo ${src/lib/Py${1}} | sed 's/PyCo/Pyco/' >>$file
  42. find $srcpath/$1/$pypath -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  43. echo -e ')\n' >>$file
  44. }
  45. printluafiles() {
  46. # Print headers
  47. echo ${hdr/lib/Lua${1}} >>$file
  48. find $srcpath/$1/$luapath -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  49. echo -e ')\n' >>$file
  50. # Print public headers
  51. echo ${pubhdr/lib/Lua${1}} >>$file
  52. find $hdrpath/$1/$luapath -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file 2>/dev/null
  53. echo -e ')\n' >>$file
  54. # Print source files
  55. echo ${src/lib/Lua${1}} >>$file
  56. find $srcpath/$1/$luapath -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  57. echo -e ')\n' >>$file
  58. }
  59. pushd $basedir
  60. echo -e "# This file was auto-generated with gen_filelists.sh\n" >$file
  61. for lib in "Core" "Controls" "Debugger"; do
  62. printfiles $lib
  63. done
  64. for lib in "Core" "Controls"; do
  65. printpyfiles $lib
  66. done
  67. for lib in "Core" "Controls"; do
  68. printluafiles $lib
  69. done
  70. popd