gen_filelists.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/usr/bin/env bash
  2. basedir=".."
  3. file=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. fontdefaultbegin='if(NOT NO_FONT_INTERFACE_DEFAULT)'
  10. fontdefaultend='endif()'
  11. srcpath=Source
  12. hdrpath=Include/RmlUi
  13. luapath=Lua
  14. fontdefaultpath=FontEngineDefault
  15. printfiles() {
  16. # Print headers
  17. echo ${hdr/lib/$1} >>$file
  18. find $srcpath/$1 -maxdepth 3 -path */$luapath -prune -o -path */$fontdefaultpath -prune -o \( -iname "*.h" -o -iname "*.hpp" \) -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  19. echo -e ')\n' >>$file
  20. # Print master header for library
  21. echo ${masterpubhdr/lib/$1} >>$file
  22. echo ' '$srcdir/Include/RmlUi/$1.h >>$file
  23. echo -e ')\n' >>$file
  24. # Print public headers sub directory
  25. echo ${pubhdr/lib/$1} >>$file
  26. find $hdrpath/$1 -maxdepth 3 -path */$luapath -prune -o -path */$fontdefaultpath -prune -o \( -iname "*.h" -o -iname "*.inl" -o -iname "*.hpp" \) -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  27. echo -e ')\n' >>$file
  28. # Print source files
  29. echo ${src/lib/$1} >>$file
  30. find $srcpath/$1 -maxdepth 3 -path */$luapath -prune -o -path */$fontdefaultpath -prune -o -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  31. echo -e ')\n' >>$file
  32. }
  33. printfontdefaultfiles() {
  34. # Print headers
  35. echo $fontdefaultbegin >>$file
  36. echo ' '${hdr/lib/$1} >>$file
  37. echo ' ${'$1'_HDR_FILES}' >>$file
  38. find $srcpath/$1/$fontdefaultpath -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  39. echo -e ' )\n' >>$file
  40. # Print source files
  41. echo ' '${src/lib/$1} >>$file
  42. echo ' ${'$1'_SRC_FILES}' >>$file
  43. find $srcpath/$1/$fontdefaultpath -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  44. echo -e ' )' >>$file
  45. echo -e $fontdefaultend'\n' >>$file
  46. }
  47. printluafiles() {
  48. # Print headers
  49. echo ${hdr/lib/Lua${1}} >>$file
  50. find $srcpath/$1/$luapath -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  51. echo -e ')\n' >>$file
  52. # Print public headers
  53. echo ${pubhdr/lib/Lua${1}} >>$file
  54. find $hdrpath/$1/$luapath -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file 2>/dev/null
  55. echo -e ')\n' >>$file
  56. # Print source files
  57. echo ${src/lib/Lua${1}} >>$file
  58. find $srcpath/$1/$luapath -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  59. echo -e ')\n' >>$file
  60. }
  61. pushd $basedir
  62. echo -e "# This file was auto-generated with gen_filelists.sh\n" >$file
  63. for lib in "Core" "Controls" "Debugger"; do
  64. printfiles $lib
  65. done
  66. printfontdefaultfiles "Core"
  67. for lib in "Core" "Controls"; do
  68. printluafiles $lib
  69. done
  70. popd