Advertisement
davidpci

Blender Ubuntu Compile / Bench Script

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