利用者:Jr100/CMake

提供: 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 operating system and the software packages used should work on Mac OSX, Windows, and 99% of Linux distros. 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.

Mac OSX

To install Git on Mac, go to http://www.git-scm.com/download and select the installer for Mac.

Windows

To install Git on Windows, go to http://www.git-scm.com/download and select the installer for Windows.

Linux

To install Git on any Linux distro, 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 (in Mac and Linux) or your git bash (in Windows) 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.

Mac OSX

To install CMake for OSX, go to http://www.cmake.org/download/ and select the package for Mac. Currently, CMake only supports OSX 10.6 and newer. After installing, you should have CMake.app in your applications folder.

Windows

To install CMake go to http://www.cmake.org/download/ and select the Windows installer. After installing you should have Cmake in your start menu with an icon on your desktop if you selected to have it.

Linux

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

The Libs For Linux

A number of other packages are needed to build on Linux, run the auto installer by typing

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

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.

Mac OSX

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 make 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!

The Code

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

The Libs

mkdir lib
cd lib
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/darwin-9.x.universal

Windows and Linux

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 on Linux and cmd.exe on Windows and type in these commands to make 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 on Linux and the git bash on Windows.

The Code

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.

All Systems

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

Mac (For The Libs)

cd ~/blender-git/lib/darwin-9.x.universal
svn update

Building It

To build Blender on all systems, open up the CMake program, cmake-gui on Linux, 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 or 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 one of these commands for your system.

Mac OSX

Go to blender-git/build/bin and open the blender.app that should be there.

Windows

Go to blender-git/build/bin and open the blender.exe that should be there.

Linux

Type

cd ~blender-git/build
./bin/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