gen_samplelists.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  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. 'tutorial/template' 'tutorial/datagrid' 'tutorial/datagrid_tree' 'tutorial/tutorial_drag'
  11. )
  12. printfiles() {
  13. # Print headers
  14. name=${1//basic\//} #substitute basic/ for nothing
  15. name=${name//tutorial\/} #substitute tutorial/ for nothing
  16. echo ${hdr/sample/$name} >>$file
  17. find $srcpath/$1/src -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; >>$file
  18. find $srcpath/$1/include -maxdepth 1 -iname "*.h" -exec echo ' '$srcdir/{} \; >>$file 2>/dev/null
  19. echo -e ')\n' >>$file
  20. # Print source files
  21. echo ${src/sample/$name} >>$file
  22. find $srcpath/$1/src -maxdepth 1 -iname "*.cpp" -exec echo ' '$srcdir/{} \; >>$file
  23. echo -e ')\n' >>$file
  24. }
  25. pushd $basedir
  26. echo -e "# This file was auto-generated with gen_samplelists.sh\n" >$file
  27. for sample in ${samples[@]}; do
  28. printfiles $sample
  29. done
  30. popd