\chapter{Building the Bullet SDK and demos}
Windows developers can download the zipped sources of Bullet from \url{http://bullet.googlecode.com}. Mac OS X, Linux and other developers should download the gzipped tar archive.
Bullet provides several build systems.

\section{Microsoft Visual Studio}
After unzipping the source code you can open the \path{Bullet/build/vs2010/0BulletSolution.sln}, hit F5 and your first Bullet demo will run. Note that by default Visual Studio uses an unoptimized Debug configuration that is very slow. It is best to enable the Release configuration.

\section{Using Premake}
\index{premake}\href{http://industriousone.com/premake}{Premake} is a meta build system based on the Lua scripting language that can generate project files for Microsoft Visual Studio, Apple Xcode as well as Makefiles for GNU make and other build systems. Bullet comes with Premake executables for Windows, Mac OSX and Linux.
\subsection{Premake Visual Studio project generation}
You can double-click on \path{Bullet/build/vs2010.bat} to generate Visual Studio 2010 project files and solution. This batch file calls Premake. Just open \path{Bullet/build/vs2010/0BulletSolution.sln}
\subsection{Premake Mac OSX Xcode project generation}
On Mac OSX it is easiest to open a Terminal window and switch current directory to Bullet/build and use the following command to generate XCode projects:
 \begin{lstlisting}[caption=Premake for Mac OSX, label=premake_osx]
cd Bullet/build
./premake_osx xcode4
open xcode4/0BulletSolution.xcworkspace
\end{lstlisting}

\subsection{Premake iOS Xcode project generation}
XCode project generation for iOS, such as iPhone and iPad, is similar to Mac OSX. Just provide the --ios option to premake and premake will automatically customize the project and append ios to the directory:
 \begin{lstlisting}[caption=Premake for iOS, label=premake_ios]
cd Bullet/build
./premake_osx --ios xcode4
open xcode4ios/0BulletSolution.xcworkspace
\end{lstlisting}
Note that Bullet comes with a modified version of \path{premake_osx} that enables the iOS specific customizations that are required by XCode.
\subsection{Premake GNU Makefile generation}
You can also generate GNU Makefiles for Mac OSX or Linux using premake:
\begin{lstlisting}[caption=Premake to GNU Makefile, label=premake_make]
cd Bullet/build
./premake_osx gmake
cd gmake
make config=release64
\end{lstlisting}
\section{Using cmake}
Similar to premake, CMake adds support for many other build environments and platforms, including Microsoft Visual Studio, XCode for Mac OSX, KDevelop for Linux and Unix Makefiles. Download and install \index{CMake}CMake from \url{http://cmake.org} and use the CMake cmake-gui tool.
\section{Using autotools}
Open a shell terminal and go to the Bullet root directory. Then execute
\begin{lstlisting}[caption=autotools to Makefile, label=autotools_make]
./autogen.sh
./configure
make
\end{lstlisting}
The \path{autogen.sh} step is optional and not needed for downloaded packages.
