gen_samplelists.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. basedir=".."
  3. file=CMake/SampleFileList.cmake
  4. src='set(sample_SRC_FILES'
  5. hdr='set(sample_HDR_FILES'
  6. srcdir='${PROJECT_SOURCE_DIR}'
  7. srcpath=Samples
  8. samples=( 'shell'
  9. 'basic/animation' 'basic/benchmark' 'basic/bitmapfont' 'basic/customlog' 'basic/databinding' 'basic/demo' 'basic/drag' 'basic/loaddocument' 'basic/treeview' 'basic/transform'
  10. 'basic/lottie' 'basic/svg'
  11. 'tutorial/template' 'tutorial/datagrid' 'tutorial/datagrid_tree' 'tutorial/drag'
  12. 'invaders' 'luainvaders'
  13. )
  14. printfiles() {
  15. # Print headers
  16. name=${1//basic\//} #substitute basic/ for nothing
  17. name=${name//tutorial\//tutorial_} #substitute 'tutorial/' for 'tutorial_'
  18. echo ${hdr/sample/$name} >>$file
  19. find $srcpath/$1/src -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  20. find $srcpath/$1/include -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file 2>/dev/null
  21. echo -e ')\n' >>$file
  22. # Print source files
  23. echo ${src/sample/$name} >>$file
  24. find $srcpath/$1/src -maxdepth 1 -iname "*.cpp" -exec echo ' '$srcdir/{} \; 2>/dev/null | sort -f >>$file
  25. echo -e ')\n' >>$file
  26. }
  27. pushd $basedir
  28. echo -e "# This file was auto-generated with gen_samplelists.sh\n" >$file
  29. for sample in ${samples[@]}; do
  30. printfiles $sample
  31. done