gen_filelists.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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/RmlUi
  11. luapath=Lua
  12. printfiles() {
  13. # Print headers
  14. echo ${hdr/lib/$1} >>$file
  15. find $srcpath/$1 -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  16. echo -e ')\n' >>$file
  17. # Print master header for library
  18. echo ${masterpubhdr/lib/$1} >>$file
  19. echo ' '$srcdir/Include/RmlUi/$1.h >>$file
  20. echo -e ')\n' >>$file
  21. # Print public headers sub directory
  22. echo ${pubhdr/lib/$1} >>$file
  23. find $hdrpath/$1 -maxdepth 1 \( -iname "*.h" -o -iname "*.inl" \) -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  24. echo -e ')\n' >>$file
  25. # Print source files
  26. echo ${src/lib/$1} >>$file
  27. find $srcpath/$1 -maxdepth 1 -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  28. echo -e ')\n' >>$file
  29. }
  30. printluafiles() {
  31. # Print headers
  32. echo ${hdr/lib/Lua${1}} >>$file
  33. find $srcpath/$1/$luapath -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  34. echo -e ')\n' >>$file
  35. # Print public headers
  36. echo ${pubhdr/lib/Lua${1}} >>$file
  37. find $hdrpath/$1/$luapath -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file 2>/dev/null
  38. echo -e ')\n' >>$file
  39. # Print source files
  40. echo ${src/lib/Lua${1}} >>$file
  41. find $srcpath/$1/$luapath -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  42. echo -e ')\n' >>$file
  43. }
  44. pushd $basedir
  45. echo -e "# This file was auto-generated with gen_filelists.sh\n" >$file
  46. for lib in "Core" "Controls" "Debugger"; do
  47. printfiles $lib
  48. done
  49. for lib in "Core" "Controls"; do
  50. printluafiles $lib
  51. done
  52. popd