Platform: win7,vs2010
1. Organization of the Bullet library
is in the bullet_user_manual:
The Bullet Linearmath (linear math module), which is the bulletcollision (Collision detection module), The Bulletdynamics (rigid body simulation module) and the Bulletsoftbody (deformable analog module) are then built on the bulletcollision, plus an optional import and export plugin and multithreaded modules. Linearmath, Bulletcollision, Bulletdynamics, Bulletsoftbody are core modules, others are optional (when you need a plugin or use multi-threading). we only compile the core module here , in fact Linearmath, Bulletcollision, Bulletdynamics, Bulletsoftbody corresponds to 4. lib Files (library files).
Given Bullet's modular organization, users can use bullet in a hierarchical format:
- Collision detection, this time only contains Linearmath, Bulletcollision library;
- Rigid body dynamics, need to include Linearmath, bulletcollision, Bulletdynamics Library;
- Soft body Dynamics, contains all 4 Linearmath, bulletcollision, Bulletdynamics, and bulletsoftbody libraries.
For us, it is possible to use a variable shape, so all 4 modules are compiled.
2. Bullet Installation Instructions
This is a top-level guide:
- Download bullet-2.82-r2704.zip, unzip (the number after r may be different);
- Run the. /build/vs2010.bat", Generate VS2010 project;
- Open With VS2010 ". /vs2010/0BulletSolution.sln";
- For Linearmath,bulletcollision,bulletdynamics,bulletsoftbody, respectively, in the Debug and release configuration (more versions and explanations see here );
- Set the ".. /lib "8 . lib files , and". /src "all . h files are copied out to form the installation package.
The next 4th section will explain the process with step by step. How the bullet project will be configured in the next section.
3. Bullet Engineering configuration (using Bullet library)
To use bullet, you need:
- Add a directory containing the. h files copied from the previous section to the project's include directory (under All configurations);
- Add the Library directory and add the directory where the. lib file you copied from the previous section to the catalog directory (under all configurations);
- Reference Library , add a reference to the. lib file (add the required. lib file according to the usage hierarchy, Debug and release are set separately);
- Contains the header file , which contains "btBulletDynamicsCommon.h" in the code.
Note:
Add two methods that include a directory:
- "Project Properties >> Configuration Properties >> VC + + directories >> include Directories"
- "Project Properties >> Configuration Properties >> C + + >> General >> additional include directories".
There are two ways to add a library directory:
- "Project Properties >> Configuration Properties >> VC + + directory >> Library Directory"
- Project Properties >> Configuration Properties >> linker >> General >> Additional Library directories.
Two ways to reference a library:
- Code #pragma comment (lib, "Xxx.lib") (with #ifdef _dll and #ifdef _DEBUG);
- Project Properties >> Configuration Properties >> linker >> input >> additional dependencies.
. lib file version issues see my other article: Configuring your own OpenGL library, Glew, Freeglut Library compilation, library conflict resolution.
4. Step by step
Let's start with the generated. sln file:
Open 0BulletSolution.sln:
The 4 items above are generated in debug and Release configurations, respectively. See more versions: Configure your own OpenGL library, Glew, Freeglut Library compilation, library conflict resolution. Note that both debug and release in the bullet Project use static CRT(we typically use a DLL CRT), so it is necessary to compile 2 more versions. After compiling, get the. lib file, you can change the file name according to the compiled version:
Build the installation package as follows:
Windows Bullet 2.82 Compilation installation (Bullet Physics development environment configuration)