How to build Libbulletjme from source

Libbulletjme is free, open-source software.

While pre-built artifacts (including AARs and JARs) can be downloaded from the Maven Central Repository, some people prefer to build them from source.

You can also build a local copy of the documentation (website content). This is useful if you are editing the content, or if your Internet access is limited or unreliable.

JARs and native libraries

Here’s the recommended procedure:

  1. Install build software:

    1. a Java Development Kit (JDK), if you don’t already have one, and

    2. one of the supported C++ compilers:

      1. for Linux: the GNU Compiler Collection or Clang

      2. for Windows: Microsoft Visual Studio

      3. for macOS: Xcode

    3. If you use GCC, you might need to install the "g++-multilib" package:

      1. sudo apt install g++-multilib

  2. Point the JAVA_HOME environment variable to your JDK installation: (The path might be something like "C:\Program Files\Java\jre1.8.0_301" or "/usr/lib/jvm/java-8-openjdk-amd64/" or "/Library/Java/JavaVirtualMachines/liberica-jdk-17-full.jdk/Contents/Home" .)

    1. using Bash or Zsh: export JAVA_HOME=" path to installation "

    2. using Fish: set -g JAVA_HOME " path to installation "

    3. using Windows Command Prompt: set JAVA_HOME=" path to installation "

    4. using PowerShell: $env:JAVA_HOME = ' path to installation '

  3. Download and extract the Libbulletjme source code from GitHub:

    1. using Git:

      1. git clone https://github.com/stephengold/Libbulletjme.git

      2. cd Libbulletjme

      3. git checkout -b latest 22.0.1

    2. using a web browser:

      1. browse to https://github.com/stephengold/Libbulletjme/releases/latest

      2. follow the "Source code (zip)" link

      3. save the ZIP file

      4. extract the contents of the saved ZIP file

      5. cd to the extracted directory

  4. Cross-compilation using GCC requires the g++-multilib package:

    1. sudo apt-get install g++-multilib

  5. (optional) Edit the "gradle.properties" file to configure the build.

  6. Run the Gradle wrapper on the desktop build script:

    1. using Bash or Fish or PowerShell or Zsh: ./gradlew build

    2. using Windows Command Prompt: .\gradlew build

  7. To build Android artifacts, you’ll need to install Android Studio and point the ANDROID_HOME environment variable to that installation.

  8. Run the Gradle wrapper on the Android build script:

    1. using Bash or Fish or PowerShell or Zsh: ./gradlew -b android.gradle build

    2. using Windows Command Prompt: .\gradlew -b android.gradle build

After a successful build, artifacts will be found in "build/libs" (desktop) and "build/outputs/aar" (Android).

Install artifacts

You can install the built artifacts to your local Maven repository:

  • using Bash or Fish or PowerShell or Zsh: ./gradlew install;./gradlew -b android.gradle install

  • using Windows Command Prompt:

    • .\gradlew install

    • .\gradlew -b android.gradle install

Cleanup

After a build, you can restore the project to a pristine state:

  • using Bash or Fish or PowerShell or Zsh: ./gradlew clean;./gradlew -b android.gradle clean

  • using Windows Command Prompt:

    • .\gradlew clean

    • .\gradlew -b android.gradle clean

Website content

  1. Download and extract the source code from GitHub:

  2. Edit "docs/playbook.yml" and replace "/home/sgold/NetBeansProjects/LbjExamples" with an absolute path to your checkout directory (2 places).

  3. Install Node.js

  4. Run Antora:

    1. npx antora docs/playbook.yml

After a successful build, the local copy of the site will be found in the "docs/build/site" directory.