Installation
From Physics Simulation Wiki
Contents |
Installation
Download
You can download the Bullet Physics Library from the Bullet GoogleCode page:
Building
Bullet can be built using CMake on all platforms. CMake can generate projectfiles for example for Visual Studio, Apple XCode, Linux KDevelop, but also regular Unix Makefiles. CMake can be downloaded from http://cmake.org or on UNIX systems installed with many package managers, such as apt-get, yum, or port.
For Microsoft Visual Studio or Mac OS X please visit Creating a project from scratch after bullet is compiled.
The easiest way to use CMake is through the graphical user interface, but on all platforms you can also use cmake command-line (in a terminal/console). See the “recipes” below for some sample command-line usage.
Options of Interest
These options can be passed to cmake to control build configuration. See recipes below for examples of usage.
- Disable building extras and/or demos: -DBUILD_EXTRAS=off -DBUILD_DEMOS=off
- Enable frameworks, shared/dynamic libraries, and ability to install: -DINSTALL_LIBS=on
- Build shared libraries: -DINSTALL_LIBS=on -DBUILD_SHARED_LIBS=on
- Build as an OS X Framework: -DINSTALL_LIBS=on -DBUILD_SHARED_LIBS=on -DFRAMEWORK=on
- Produce OS X universal binary: -DCMAKE_OSX_ARCHITECTURES='ppc;i386;x86_64'
- Change the optimization level and debugging symbols: -DCMAKE_BUILD_TYPE=RelWithDebInfo
(can also choose one of Debug, Release, or MinSizeRel, see cmake --help-variable CMAKE_BUILD_TYPE)
Run cmake --help-variable-list to see (many) more options, or use the CMake GUI to interactively investigate.
Recipes
Visual Studio Recipe
cmake ../path/to/bullet -G "Visual Studio 9 2008" start BULLET_PHYSICS.sln
Generic Make Recipe
mkdir bullet-build cd bullet-build cmake ../path/to/bullet -G "Unix Makefiles" -DINSTALL_LIBS=ON make -j4 sudo make install
Notes:
- in 2.77+ onward, -DINSTALL_LIBS=ON won't be necessary.
- To control installation path (default /usr/local), tell cmake
-DCMAKE_INSTALL_PREFIX=your/custom/path -DCMAKE_INSTALL_RPATH=your/custom/path - Only static libraries (.a) are installed, for dynamic libraries see below
Generic Dynamic Library Recipe
cd path/to/bullet mkdir bullet-build cd bullet-build cmake .. -G "Unix Makefiles" -DINSTALL_LIBS=ON -DBUILD_SHARED_LIBS=ON make -j4 sudo make install
Mac OS X Framework Recipe
On Mac OS X CMake can produce the libraries as Framework directories. For "naked" dynamic libraries, see previous.
cd path/to/bullet mkdir bullet-build cd bullet-build cmake .. -G "Unix Makefiles" -DINSTALL_LIBS=ON -DBUILD_SHARED_LIBS=ON -DFRAMEWORK=ON \ -DCMAKE_OSX_ARCHITECTURES='i386;x86_64' -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_INSTALL_PREFIX=/Library/Frameworks -DCMAKE_INSTALL_NAME_DIR=/Library/Frameworks \ -DBUILD_DEMOS:BOOL=OFF make -j4 sudo make install
Note that Mac users can also use -G Xcode instead of -G "Unix Makefiles" if you wish to produce Xcode project files to control the build.
