2 Blender CMake build system
3 ============================
10 3. Obtaining Dependencies
11 4. Deciding on a Build Environment
12 5. Configuring the build for the first time
13 6. Configuring the build after SVN updates
14 7. Specify alternate Python library versions and locations
20 This document describes general usage of the new CMake scripts. The
21 inner workings will be described in blender-cmake-dev.txt (TODO).
26 CMake for can either be downloaded using your favorite package manager
27 or is also available from the CMake website at http://www.cmake.org
28 The website also contains some documentation on CMake usage but I found
29 the man page alone pretty helpful.
31 3. Obtaining Dependencies
32 -------------------------
35 http://www.blender.org/cms/Getting_Dependencies.135.0.html that you
36 have all dependencies needed for building Blender. Note that for
37 windows many of these dependencies already come in the lib/windows
40 4. Deciding on a Build Environment
41 ----------------------------------
43 To build Blender with the CMake scripts you first need to decide which
44 build environment you feel comfortable with. This decision will also be
45 influenced by the platform you are developing on. The current implementation
46 have been successfully used to generate build files for the following
49 1. Microsoft Visual Studio 2008. There is a free version available
50 at http://http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express
54 3. Unix Makefiles (On Linux and Mac OSX): CMake actually creates make
55 files which generates nicely color coded output and a percentage
59 5. Configuring the build for the first time
60 -------------------------------------------
62 CMake allows one to generate the build project files and binary objects
63 outside the source tree which can be pretty handy in working and experimenting
64 with different Blender configurations (Audio/NoAudio, GameEngine/NoGameEngine etc.)
65 while maintaining a clean source tree. It also makes it possible to generate files
66 for different build systems on the same source tree. This also has benefits for
67 general SVN management for the developer as patches and submit logs are much cleaner.
69 Create a directory outside the blender source tree where you would like to build
70 Blender (from now on called $BLENDERBUILD). On the commandline you can then run
71 the cmake command to generate your initial build files. First just run 'cmake' which
72 will inform you what the available generators are. Thn you can run
73 'cmake -G generator $BLENDERSOURCE' to generate the build files. Here is an example
74 of all this for Xcode:
82 --version [file] = Show program name/version banner and exit.
86 The following generators are available on this platform:
87 KDevelop3 = Generates KDevelop 3 project files.
88 Unix Makefiles = Generates standard UNIX makefiles.
89 Xcode = Generate XCode project files.
93 % cmake -G Xcode $BLENDERSOURCE
96 -- Configuring blender
97 -- Configuring blenderplayer
100 -- Build files have been written to: $BLENDERBUILD
102 This will generate the build files with default values. Specific features can
103 be enabled or disabled by running the ccmake "GUI" from $BLENDERBUILD as follows:
105 % ccmake $BLENDERSOURCE
107 A number of options appear which can be changed depending on your needs and
108 available dependencies (e.g. setting WITH_OPENEXR to OFF will disable support
109 for OpenEXR). It will also allow you to override default and detected paths
110 (e.g. Python directories) and compile and link flags. When you are satisfied
111 used ccmake to re-configure the build files and exit.
113 It is also possible to use the commandline of 'cmake' to override certain
116 6. Configuring the build after SVN updates
117 ------------------------------------------
119 The $BLENDERBUILD directory maintains a file called CMakeCache.txt which
120 remembers the initial run's settings for subsequent generation runs. After
121 every SVN update it may be a good idea to rerun the generation before building
122 Blender again. Just rerun the original 'cmake' run to do this, the settings
123 will be remembered. For the example above the following will do after every
126 % cmake -G Xcode $BLENDERSOURCE
128 7. Specify alternate Python library versions and locations
129 ----------------------------------------------------------
131 The commandline can be used to override detected/default settings, e.g:
134 cmake -D PYTHON_LIBRARY=/usr/local/lib/python3.2/config/libpython3.2.so -D PYTHON_INCLUDE_DIR=/usr/local/include/python3.2 ../blender
136 cmake -D PYTHON_INCLUDE_DIRS=/System/Library/Frameworks/Python.framework/Versions/3.2/include/python3.2 -G Xcode ../blender
138 Mote that this should only be needed once per build directory generation because it will keep the overrides in CMakeCache.txt for subsequent runs.
147 1. Get CMake to create proper distribution directories for the various platforms
149 2. Investigate the viability of using CPack to package installs automatically.
150 3. Refine this document and write detailed developer's document.
151 4. Make sure all options (ffmpeg, openexr, quicktime) has proper CMake support
152 on the various platforms.
154 /Jacques Beaurain (jbinto)