利用者:Kdawg/Building Blender/Prepare the build system
目次
Prepare the build system
Cmake
Installing CMake
Cmake is a cross-platform tool for generating make files and configuring numerous popular IDE's. You can download it here:
Note to Linux users: | |
You can also download and install CMake directly through your distribution's package manager. For example, on Ubuntu or Mint you would type: sudo apt-get install cmake
|
Quick build (Linux & Mac only)
From the command line, you can now enter:
cd ~/blender-dev/blender
make
this will create the program binary in the directory ~/blender-dev/{build-platform}/blender, where {build-platform} is either:
- build_linux for Linux
- build_darwin for Mac
Configuring project with CMake
Note: This guide will only discuss the cmake-gui graphical interface for configuring the project. Command line configuration works just fine, but is not supported in this doc.
Windows
You will find the CMake App in your Start Menu under CMake 2.8. Select CMake (cmake-gui). When it loads, the CMake window appears: As you can see all you have to enter is the location of the sources in C:\blender-dev\blender and a destination directory which is C:\blender-dev\cmake in this example, but any location outside of the source directory is allowed. Now Press the Configure button. You may be prompted that the directory doesn't exist. If so, select yes to create the directory. You will then get another Popup: Here you can select which Generator you want to use (Visual Studio, Unix Makefiles, etc...). Visual Studio 12 Win64 is selected currently in this example. Note that you also can select which compiler you want to use. If you are unsure about what that means, don't worry and use the default native compilers. Now press the Finish button. You'll go back to the previous screen but now you will see a big red list of options. You can scroll through the option list and set parameters to your needs. Please ensure that the settings are correct for your build. You can find the settings and what they mean in the table below. Click Configure again and the red highlighting should disappear. Then click Generate and your build environment will be created into the build folder. If you selected a Visual Studio project, this is where the blender.sln file, which is the solution file to load the project in Visual Studio. Likewise, if you created another type of configuration (QTCreator, Code::Blocks, etc...), the main project file will be located here. |
Mac
Note: For CMake to determine the proper location of your Xcode build, it's important that your active version of Xcode be located at /Applications/Xcode.app. You will find the CMake App in your Application folder. Double click on it to start it. The CMake Window shows up: As you can see all you have to enter is the location of the sources in ~/blender-dev/blender and a destination directory which is ~/blender-dev/cmake in this example, but any location outside of the source directory is allowed. Now Press the "Configure" Button. You get another Popup: Here you can select which Generator you want to use (Unix Makefiles or CMake in our case). Xcode is selected currently in this example. Note that you also can select which compiler you want to use. If you are unsure about what that means, don't worry and use the default native compilers. Now press the "Done" Button. You get back to the previous screen but now you will see a big red list of options. You can scroll through the option list and set parameters to your needs. Please ensure that the settings are correct for your build. You can find the settings and what they mean in the table below. Note: 'gcc' is a symbolic link to the default compiler used by the desired Xcode version. Since XCode5 this means CLANG, formerly it was llvm-gcc Click Configure again and the red highlighting should disappear. Then click Generate and your build environment will be created into the build folder. |
Cmake Options
parameter | value |
---|---|
CMAKE_BUILD_TYPE | "Release" (for release build with optimizations) or "Debug" (to get debug info for gdb) |
CMAKE_OSX_ARCHITECTURES | ppc, i386, x86_64 (x86_64 for all recent OS X versions)
Note: x86_64 (64 bits) is default, only newer hardware support it. If your build stops with error "Bad CPU type in executable" you have to switch cpu type to i386 or ppc (32 bits). |
CMAKE_OSX_DEPLOYMENT_TARGET | You can restrict the OSX version you want to build for (10.5, 10.6, 10.7, 10.8, 10.9), but a nice default is 10.6. |
CMAKE_OSX_SYSROOT | It is recommended to always use the highest sdk available. |
WITH_CODEC_QUICKTIME | must be set to ON if you want to use Apple media services ( actual QTKit, AVKit soon ) |
WITH_CODEC_FFMPEG | set to ON if you want FFMPEG support. |
CMAKE_CXX_FLAGS_DEBUG, CMAKE_C_FLAGS_DEBUG | (advanced mode) set to "-g3 -O0 -fno-inline" for best gdb code stepping |
Scons
No information is available here yet.