gen_filelists.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. fontdefaultpath=FontEngineDefault
  14. printfiles() {
  15. # Print headers
  16. echo ${hdr/lib/$1} >>$file
  17. find $srcpath/$1 -maxdepth 3 -path */$fontdefaultpath -prune -o \( -iname "*.h" -o -iname "*.hpp" \) -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  18. echo -e ')\n' >>$file
  19. # Print master header for library
  20. echo ${masterpubhdr/lib/$1} >>$file
  21. echo ' '$srcdir/Include/RmlUi/$1.h >>$file
  22. echo -e ')\n' >>$file
  23. # Print public headers sub directory
  24. echo ${pubhdr/lib/$1} >>$file
  25. if [[ "$1" == "Core" ]]; then echo ' '$srcdir/Include/RmlUi/Config/Config.h >>$file; fi
  26. find $hdrpath/$1 -maxdepth 3 -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 */$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. printpluginfiles() {
  48. # Print headers
  49. echo ${hdr/lib/$1} >>$file
  50. find $srcpath/$1 -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  51. echo -e ')\n' >>$file
  52. # Print public headers
  53. echo ${pubhdr/lib/$1} >>$file
  54. find $hdrpath/$1 -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/$1} >>$file
  58. find $srcpath/$1 -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" "Debugger"; do
  64. printfiles $lib
  65. done
  66. printfontdefaultfiles "Core"
  67. printpluginfiles "Lua"
  68. printpluginfiles "Lottie"
  69. printpluginfiles "SVG"
  70. popd