davidpci

Blender Ubuntu Compile / Bench Script

Nov 9th, 2011
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.16 KB | None | 0 0
  1. #! /bin/bash
  2.  
  3. ### Blender compile & bench for Ubuntu
  4. ### Author : LEGRAND David - PC INpact
  5. ###
  6. ### http://www.pcinpact.com
  7. ###
  8. ### test.blend is needed for benchmark
  9. ### http://www.eofw.org/bench/
  10.  
  11. ### On installe les composants requis
  12. sudo apt-get install subversion build-essential gettext libxi-dev libsndfile1-dev libpng12-dev libfftw3-dev libopenexr-dev libopenjpeg-dev libopenal-dev libalut-dev libvorbis-dev libglu1-mesa-dev libsdl1.2-dev libfreetype6-dev libtiff4-dev libavdevice-dev libavformat-dev libavutil-dev libavcodec-dev libjack-dev libswscale-dev libx264-dev libmp3lame-dev python3.2-dev libspnav-dev scons
  13.  
  14. ### ffmpeg nécessite un dépôt à part
  15. sudo add-apt-repository ppa:jon-severinsson/ffmpeg
  16. sudo apt-get update
  17. sudo apt-get install ffmpeg
  18.  
  19. ### On Créé le répertoire utilisé pour le dépôt SVN
  20. cd ~
  21. mkdir blender-svn
  22.  
  23. ### On y copie le fichier de test
  24. cp test.blend blender-svn/
  25. cd blender-svn
  26.  
  27. ### On récupère les données depuis le dépôt SVN
  28. svn co https://svn.blender.org/svnroot/bf-blender/tags/blender-2.60-release/blender/
  29. cd ~/blender-svn/blender
  30.  
  31. ### On créé les fichiers de config, de compilation et de bench
  32. echo "### OPTIMISATIONS ###
  33. CCFLAGS.extend( [ '-march=native', '-O2','-fomit-frame-pointer','-pipe' ] )
  34. CXXFLAGS.extend( [ '-march=native', '-O2','-fomit-frame-pointer','-pipe' ] )
  35. REL_CFLAGS = ['-O2']
  36. REL_CCFLAGS = ['-O2']
  37.  
  38. ### OPTIONS ###
  39. WITH_BF_FFTW3 = True
  40. WITHOUT_BF_PYTHON_INSTALL = True
  41. WITH_BF_RAYOPTIMIZATION = True
  42. WITH_BF_VERSE = False
  43.  
  44. BF_PYTHON_VERSION = '3.2'
  45. SUFFIX = 'mu'
  46. BF_PYTHON_INC = '/usr/include/python' + BF_PYTHON_VERSION + SUFFIX
  47. BF_PYTHON_LIB = 'python' + BF_PYTHON_VERSION + SUFFIX
  48. " > user-config.py
  49.  
  50. cd ~/blender-svn
  51.  
  52. echo "#! /bin/bash
  53.  
  54. cd ~/blender-svn/
  55. rm -r build/
  56. rm -r install/
  57. cd blender/
  58.  
  59. clear
  60. echo -e \"\n Combien de coeurs voulez-vous utiliser ? \c\"
  61. read CORES
  62.  
  63. if [[ \$CORES -eq \$CORES && \$CORES != \"\" ]] 2> /dev/null; then
  64.     /usr/bin/time -f \"Total : %e secondes\nUtilisation CPU moyenne : %P\" -o ~/blender-svn/compile_result.txt scons -j \$CORES
  65. else
  66.     echo -e \" *** Le nombre indiqué n'est pas correct. Fin du script. *** \n\"
  67. fi" > compile.sh
  68.  
  69. echo "#! /bin/bash
  70.  
  71. THREADS=1
  72.  
  73. ### On passe le nombre de Threads à 1, et on demande une valeur
  74. ### Si la valeur est correcte, on l'applique, sinon, on utilise 1
  75.  
  76. clear
  77. echo -e \"\n Combien de coeurs voulez-vous utiliser ? \c\"
  78. read CORES
  79.  
  80. if [[ \$CORES -eq \$CORES && \$CORES != \"\" ]] 2> /dev/null; then
  81. THREADS=\$CORES
  82. fi
  83.  
  84. FILE=~/blender-svn/test.blend
  85. RESULT_F=~/blender-svn/result.txt
  86. LOG_F=~/blender-svn/log.txt
  87. BLENDER_EXE=~/blender-svn/install/linux/blender
  88.  
  89. clear
  90. echo -e \"\n Rendu de l'image en cours...\c\"
  91.  
  92. /usr/bin/time -f \"Total : %e secondes\nUtilisation CPU moyenne : %P\" -o \$RESULT_F \$BLENDER_EXE -b \$FILE -o result -F PNG -x 1 -t \$THREADS -f 1 -noaudio > \$LOG_F
  93.  
  94. RESULT=\$(awk -F'Time: ' '{print \$2}' log.txt)
  95. echo -e \"\nRésultat récupéré :\" \$RESULT >> \$RESULT_F
  96.  
  97. gedit \$RESULT_F" > bench.sh
  98.  
  99. ### On rend exécutable les différents fichiers
  100. chmod +x compile.sh bench.sh
  101.  
  102. ### On ouvre Nautilus
  103. nautilus ~/blender-svn
Advertisement
Add Comment
Please, Sign In to add comment