利用者:Jr100/CMake/Linux

提供: wiki
移動先: 案内検索

Introduction

Building Blender on any system is very easy. All you will need are a couple of software tools and of course, a computer! The instructions below apply to any type of Linux distro and all the software packages used should work on all of them. The steps in building Blender are:

  1. Get the software
  2. Get the source
  3. Build it!

Installing The Software

To get and build Blender, you need a number of packages installed on your system. To get them follow these simple instructions.

Git

Git is a version control system that we use to download, list changes to, and update Blender's source. For a more in-depth overview, look at this page. To install Git, go to http://www.git-scm.com/download and select the installer for Linux. You can also install git through your package manager.

Test The Install

Once it has installed, open up your terminal and test it by typing

git --help

If you see output like,

usage: git [--version] [--help] [-C <path>] [-c name=value].....

you will know that it has been installed correctly.

CMake

CMake is a family of tools designed to build, test and package software. We use it to configure our code for building. To install go to http://www.cmake.org/download/ there you can download the package for Linux. If you want, you can install cmake through your distro's package manager. Just make sure that you install

cmake

and

cmake-gui

Getting The Source

Getting the source is as easy as running a few commands. Be warned that Blender's source is over 300 megabytes and it will take a little while to download.

Creating the blender-git folder

To get the source, you first have to have somewhere to put it! So, the first thing you should do, is open up terminal.app and type in these commands to create and go to a new blender folder.

mkdir ~/blender-git
cd ~/blender-git

Checking Out The Source

Now it's time to actually get the source code, just type these commands into the terminal and away you go!

git clone http://git.blender.org/blender.git

Updating

If you ever want to update your code to the latest version, it is suggested that you do this every day, just use these commands.

cd ~/blender-git/blender
git pull --rebase
git submodule foreach git pull --rebase origin master

The Packages For Linux

A number of other packages are needed to build on Linux. Once you have the source downloaded, run the auto installer by typing

cd ~/blender-git
./blender/build_files/build_environment/install_deps.sh

Manual dependencies installation

To manually install Blender's dependancy packages:

git, build-essential, libx11-dev, libxi-dev, libsndfile1-dev, libopenexr-dev, 
libopenjpeg-dev, libpng12-dev, libjpeg-dev libopenal-dev, libalut-dev, python3.4-dev, 
libglu1-mesa-dev, libsdl-dev, libfreetype6-dev, libtiff4-dev, 
libavdevice-dev, libavformat-dev, libavutil-dev, libavcodec-dev, libswscale-dev, 
libx264-dev, libxvidcore4-dev, libmp3lame-dev, libspnav-dev, python3.4

Here are the key libraries that you may want to use with Blender:

Python (3.4)
Needed for interface scripts (building without Python is supported but not meant for general use).
Boost (min 1.49)
Necessary for Cycles, OSL, Audaspace, Internationalization…
OpenColorIO (min 1.0)
Necessary to handle color spaces.
OpenImageIO
Necessary for Cycles and OSL (min 1.1 in this case).
LLVM (min 3.0)
Necessary for OSL.
OpenShadingLanguage
Enable custom shaders under Cycles.
FFMPEG or libav (ffmpeg fork)
For handling most video formats/codecs.

Building It

To build Blender, open up cmake-gui and follow the instructions below.

Configuring The Build

  1. Set the source path to be blender-git/blender
  2. Create a new folder in blender-git called build and set the build directory to blender-git/build
  3. Click the configure button and select Unix Makefiles on the popup. Don't be frightened by the red, that is fine.
  4. After that has finished, click the generate button to generate the makefiles.
  5. When that is finished, close Cmake.

Building The Source

To build the source, follow the steps and wait while it compiles. Warning: on first build, the code takes an average of 2 hours to compile, after that, it will only compile what you have changed.

cd ~/blender-git/build
make
make install

Testing The Build

To test the newly compiled version of Blender, run

cd ~/blender-git/build
./blender

and Blender will open.

Closing Notes

We hope that you have found this helpful and informative. If you have any questions or the build didn't work for some reason, contact a developer on the #blendercoders irc channel. Thanks, The Blender Developer Team