How to build Libbulletjme from source

Libbulletjme is free, open-source software.

While pre-built artifacts (including JARs and native libraries) can be downloaded from GitHub and 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 21.2.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. 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

  6. Building Android native libraries requires additional software:

    1. the Android SDK Tools

    2. version 23.1.7779620 of the Android Native Development Kit (NDK)

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

    1. using Bash or Fish or PowerShell or Zsh: ./gradlew copyToDist --build-file=android.gradle

    2. using Windows Command Prompt: .\gradlew copyToDist --build-file=android.gradle

After a successful build, artifacts and native libraries will be found in the "dist" directory.

Install artifacts

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

  • using Bash or Fish or PowerShell or Zsh: ./gradlew install

  • using Windows Command Prompt: .\gradlew install

Cleanup

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

  • using Bash or Fish or PowerShell or Zsh: ./gradlew clean

  • using Windows Command Prompt: .\gradlew 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.