Installation

From Physics Simulation Wiki

Jump to: navigation, search

Contents

Installation

Download

You can download the Bullet Physics Library from the Bullet GoogleCode page:

http://bullet.googlecode.com


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

2.76 has a few minor issues in its build files which prevent shared libraries from building cleanly. The below will download and apply a patch (see issue 357) to resolve this. Alternatively, you can get a current version of bullet from svn, and skip the 'wget' and 'patch' steps:
svn checkout http://bullet.googlecode.com/svn/trunk/ bullet-svn

 cd path/to/bullet
 # next two lines acquire and apply a patch, unless you pulled Bullet from svn (see above)
 wget 'http://bullet.googlecode.com/issues/attachment?aid=594791322885410537&name=framework-2.76.diff&token=3c3e690811bf907331dd7483629091e1' -O framework-2.76.diff
 patch -p1 < framework-2.76.diff
 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.

2.76 has a few minor issues in its build files which prevent shared libraries from building cleanly. The below will download and apply a patch (see issue 357) to resolve this. Alternatively, you can get a current version of bullet from svn, and skip the 'wget' and 'patch' steps:
svn checkout http://bullet.googlecode.com/svn/trunk/ bullet-svn

 cd path/to/bullet
 # next two lines acquire and apply a patch, unless you pulled Bullet from svn (see above)
 wget 'http://bullet.googlecode.com/issues/attachment?aid=594791322885410537&name=framework-2.76.diff&token=3c3e690811bf907331dd7483629091e1' -O framework-2.76.diff
 patch -p1 < framework-2.76.diff
 mkdir bullet-build
 cd bullet-build
 cmake .. -G "Unix Makefiles" -DINSTALL_LIBS=ON -DBUILD_SHARED_LIBS=ON -DFRAMEWORK=ON \
   -DCMAKE_OSX_ARCHITECTURES='ppc;i386;x86_64' -DCMAKE_BUILD_TYPE=RelWithDebInfo \
   -DCMAKE_INSTALL_PREFIX=/Library/Frameworks -DCMAKE_INSTALL_NAME_DIR=/Library/Frameworks
 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.

Personal tools