***********************************
* Build info for bulletjme       *
* (c) 2011 Normen Hansen          *
***********************************

This document outlines the process of building bullet-jme on different platforms.
Since bullet-jme is a native java library and bullet gets included statically,
building requires you to download and build the bullet source first.



***********************************
* Building bullet                 *
***********************************

-----------------------------------
General info
-----------------------------------
Note that the compilation of bullet should not produce dll / so / dylib files
but static *.a libraries which can later be compiled into the binary of bullet-jme.

-----------------------------------
Downloading and extracting bullet
-----------------------------------
Requirements:
- Bullet source: http://bullet.googlecode.com/

Extract bullet source and build bullet (see below)

-----------------------------------
Building on Mac OSX
-----------------------------------
Requirements:
- Apple Developer tools: http://developer.apple.com/
- CMake: http://www.cmake.org/ (or via http://www.macports.org)

Commands:
> cd bullet-trunk
> cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON \
              -DCMAKE_OSX_ARCHITECTURES='ppc;i386;x86_64' \
              -DBUILD_EXTRAS=off -DBUILD_DEMOS=off -DCMAKE_BUILD_TYPE=Release
> make

-----------------------------------
Building on WINDOWS (MinGW/GCC, Recommended)
-----------------------------------
Requirements:
- GNU C++ Compiler: http://www.mingw.org/
                    http://mingw-w64.sourceforge.net/
- CMake: http://www.cmake.org/

Commands:
> cd bullet-trunk
> cmake . -DBUILD_SHARED_LIBS=OFF -DBUILD_DEMOS:BOOL=OFF -DBUILD_EXTRAS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release . -G "MinGW Makefiles"
> mingw32-make

-----------------------------------
Building on WINDOWS (VisualStudio, untested)
-----------------------------------
Requirements:
- Microsoft Visual Studio http://msdn.microsoft.com/

Bullet comes with autogenerated Project Files for Microsoft Visual Studio 6, 7, 7.1 and 8.
The main Workspace/Solution is located in Bullet/msvc/8/wksbullet.sln (replace 8 with your version).

Build the project to create static libraries.


-----------------------------------
Building bullet on LINUX
-----------------------------------
Requirements:
- Gnu C++ Compiler: http://gcc.gnu.org/
- CMake: http://www.cmake.org/ (or via your package manager of choice)

Commands:
> cd bullet-trunk
> cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC"\
              -DBUILD_EXTRAS=off -DBUILD_DEMOS=off -DCMAKE_BUILD_TYPE=Release
> make

-----------------------------------
More info on building bullet
-----------------------------------
http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Installation



***********************************
* Building bulletjme             *
***********************************

-----------------------------------
Requirements
-----------------------------------
- Java SDK 1.5+: http://java.sun.com
- Apache ANT: http://ant.apache.org
- C++ Compiler: (see below)
- jme3 Source: http://jmonkeyengine.googlecode.com/
- Statically compiled bullet source (see above)

-----------------------------------
Preparation
-----------------------------------
- copy/link bullet-trunk folder into the same folder where the bullet-jme folder is:

disk
 |
 +-root folder
    |
    +-engine
    |
    +-sdk
    |
    +-bullet-trunk

- You can alter options in the "src/bullet/native/bullet.properties" file, such as the used bullet
  version, native compilation options etc. (see below)

-----------------------------------
Building bulletjme native
-----------------------------------
Commands:
> cd engine
> ant jar
> ant build-bullet-natives

Thats all. ANT takes care building native binaries and copies them to th elib directory.

If you get compilation errors, try setting "native.java.include" in the build.properties file to your
JDK include directory, e.g. /opt/java/include or "c:\Program Files\Java\jdk1.6.0_20\include".

-----------------------------------
Altering the native build process
-----------------------------------
bullet-jme uses cpptasks to compile native code.

To change the used compiler, edit the "native.platform.compiler" entry in the
"build.properties" file. The following c++ compilers work with cpptasks:

gcc     GCC C++ compiler
g++     GCC C++ compiler
c++     GCC C++ compiler
msvc    Microsoft Visual C++
bcc     Borland C++ Compiler
icl     Intel C++ compiler for Windows (IA-32)
ecl     Intel C++ compiler for Windows (IA-64)
icc     Intel C++ compiler for Linux (IA-32)
ecc     Intel C++ compiler for Linux (IA-64)
CC      Sun ONE C++ compiler
aCC     HP aC++ C++ Compiler
wcl     OpenWatcom C/C++ compiler

In the "nbproject" folder you can find "build-native-platform.xml" files containing the commands
to compile bullet-jme on different platforms. If you want to alter the process,
you can copy and modify one of the files and import it in the "build.xml" file instead
of the old one.

-----------------------------------
Netbeans Project
-----------------------------------
The project also includes a Netbeans project to edit and build
the source in the Netbeans IDE.

To have correct syntax highlighting in .cpp/.h files:

- in Netbeans Settings -> C/C++ -> Code Assistance -> C++
  - add bullet-2.77/src as include directories for c++
  - add JAVA_HOME/include as include directories for c++
