gen_samplelists.sh 1007 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/bash
  2. basedir="../.."
  3. file=Build/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=('basic/customlog' 'basic/directx' 'basic/drag' 'basic/loaddocument'
  9. 'basic/ogre3d' 'basic/treeview' 'invaders' 'pyinvaders' 'shell'
  10. )
  11. printfiles() {
  12. # Print headers
  13. name=${1/'basic/'/} #substitute basic/ for nothing
  14. echo ${hdr/sample/$name} >>$file
  15. find $srcpath/$1/src -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; >>$file
  16. find $srcpath/$1/include -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; >>$file 2>/dev/null
  17. echo -e ')\n' >>$file
  18. # Print source files
  19. echo ${src/sample/$name} >>$file
  20. find $srcpath/$1/src -maxdepth 1 -iname "*.cpp" -exec echo ' '$srcdir/{} \; >>$file
  21. echo -e ')\n' >>$file
  22. }
  23. pushd $basedir
  24. echo -e "# This file was auto-generated with gen_samplelists.sh\n" >$file
  25. for sample in ${samples[@]}; do
  26. printfiles $sample
  27. done
  28. popd