Created
May 11, 2012 17:39
-
-
Save davlgd/2661247 to your computer and use it in GitHub Desktop.
Blender Ubuntu Compile / Bench Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
### Blender compile & bench for Ubuntu | |
### Author : LEGRAND David - PC INpact | |
### | |
### [email protected] | |
### http://www.pcinpact.com | |
### | |
### test.blend is needed for benchmark | |
### http://www.eofw.org/bench/ | |
### On installe les composants requis | |
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 | |
### ffmpeg nécessite un dépôt à part | |
sudo add-apt-repository ppa:jon-severinsson/ffmpeg | |
sudo apt-get update | |
sudo apt-get install ffmpeg | |
### On Créé le répertoire utilisé pour le dépôt SVN | |
cd ~ | |
mkdir blender-svn | |
### On y copie le fichier de test | |
cp test.blend blender-svn/ | |
cd blender-svn | |
### On récupère les données depuis le dépôt SVN | |
svn co https://svn.blender.org/svnroot/bf-blender/tags/blender-2.60-release/blender/ | |
cd ~/blender-svn/blender | |
### On créé les fichiers de config, de compilation et de bench | |
echo "### OPTIMISATIONS ### | |
CCFLAGS.extend( [ '-march=native', '-O2','-fomit-frame-pointer','-pipe' ] ) | |
CXXFLAGS.extend( [ '-march=native', '-O2','-fomit-frame-pointer','-pipe' ] ) | |
REL_CFLAGS = ['-O2'] | |
REL_CCFLAGS = ['-O2'] | |
### OPTIONS ### | |
WITH_BF_FFTW3 = True | |
WITHOUT_BF_PYTHON_INSTALL = True | |
WITH_BF_RAYOPTIMIZATION = True | |
WITH_BF_VERSE = False | |
BF_PYTHON_VERSION = '3.2' | |
SUFFIX = 'mu' | |
BF_PYTHON_INC = '/usr/include/python' + BF_PYTHON_VERSION + SUFFIX | |
BF_PYTHON_LIB = 'python' + BF_PYTHON_VERSION + SUFFIX | |
" > user-config.py | |
cd ~/blender-svn | |
echo "#! /bin/bash | |
cd ~/blender-svn/ | |
rm -r build/ | |
rm -r install/ | |
cd blender/ | |
clear | |
echo -e \"\n Combien de coeurs voulez-vous utiliser ? \c\" | |
read CORES | |
if [[ \$CORES -eq \$CORES && \$CORES != \"\" ]] 2> /dev/null; then | |
/usr/bin/time -f \"Total : %e secondes\nUtilisation CPU moyenne : %P\" -o ~/blender-svn/compile_result.txt scons -j \$CORES | |
else | |
echo -e \" *** Le nombre indiqué n'est pas correct. Fin du script. *** \n\" | |
fi" > compile.sh | |
echo "#! /bin/bash | |
THREADS=1 | |
### On passe le nombre de Threads à 1, et on demande une valeur | |
### Si la valeur est correcte, on l'applique, sinon, on utilise 1 | |
clear | |
echo -e \"\n Combien de coeurs voulez-vous utiliser ? \c\" | |
read CORES | |
if [[ \$CORES -eq \$CORES && \$CORES != \"\" ]] 2> /dev/null; then | |
THREADS=\$CORES | |
fi | |
FILE=~/blender-svn/test.blend | |
RESULT_F=~/blender-svn/result.txt | |
LOG_F=~/blender-svn/log.txt | |
BLENDER_EXE=~/blender-svn/install/linux/blender | |
clear | |
echo -e \"\n Rendu de l'image en cours...\c\" | |
/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 | |
RESULT=\$(awk -F'Time: ' '{print \$2}' log.txt) | |
echo -e \"\nRésultat récupéré :\" \$RESULT >> \$RESULT_F | |
gedit \$RESULT_F" > bench.sh | |
### On rend exécutable les différents fichiers | |
chmod +x compile.sh bench.sh | |
### On ouvre Nautilus | |
nautilus ~/blender-svn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment