A Gradle plugin to simplify adding LWJGL3 dependencies to your gradle project.
Inspired by the official lwjgl3-gradle, but with more flexibility.
- Easily add LWJGL3 dependencies with a simple DSL.
- Supports specifying LWJGL versions, modules, and native platforms.
- Allows customization of dependency configurations.
- Supports presets for common configurations (like minimal OpenGL or Vulkan setups).
- Supports version catalogs for managing LWJGL version.
- Allows overriding group IDs for LWJGL dependencies, useful for using forked versions.
- Supports adding custom LWJGL modules and platforms.
- Automatically detects the current platform for native dependencies.
To use this plugin, add the following to your build.gradle.kts
file:
plugins {
id("com.stochastictinkr.lwjgl") version "1.0.3"
}
Then, you can add LWJGL3 dependencies using the lwjgl
block inside your dependencies
block:
dependencies {
lwjgl {
/* Specify the LWJGL version. Defaults to 3.3.6 */
version = "3.3.6"
/* Or you can specify the version directly from a version catalog: */
version(libs.versions.lwjgl3)
/* You can override the group ID of the LWJGL dependencies, if you're using a forked version: */
group = "com.example.lwjgl" // Default is "org.lwjgl"
/* You can specify a list of LWJGL modules you want to include: */
modules(
/* `core` is always included.*/
shaderc,
freetype,
)
/* You can also specify a set of modules using presets: */
presets.minimalOpenGL()
/*
You can specify multiple presets:
*/
presets {
minimalOpenGL()
minimalVulkan()
}
/*
By default, presets filter our modules that are not present in the selected version of LWJGL.
You can disable this behavior by setting `presets.filterMinVersion = false`.
*/
presets.filterMinVersion = false
// or
presets {
filterMinVersion = false
}
/* You can override which native platforms (binaries) to include. */
nativePlatforms(linuxArm64, windows)
/* You can also specify all native platforms */
useAllNativePlatforms()
/*
If you don't specify any natives, it will default to auto-detecting the current platform.
You can query the current platform from `runningPlatform`.
*/
println("Current platform: $runningPlatform")
/*
You can update which configurations will get the LWJGL dependencies.
- Java dependencies are added to the configuration specified by `implementationConfiguration`
- Native dependencies are added to the configuration specified by `runtimeConfiguration`.
implementationConfiguration and runtimeConfiguration default to "implementation" and "runtimeOnly" respectively.
*/
// implementationConfiguration = "implementation"
// runtimeConfiguration = "runtimeOnly"
/* You can use modules and platforms that are not included in this plugin. */
modules(
Module(
name = "another-module",
// hasNatives = true, // defaults to true
// artifactId = "lwjgl-another-module" // defaults to "lwjgl-$name"
// minVersion = "3.3.6" // Only used by presets, so not required to set.
),
)
platforms(Platform("another-platform"))
}
}
The plugin supports the following LWJGL modules:
Name | Description | |
---|---|---|
core |
The core LWJGL module, always included. |
Name | Library | Description |
---|---|---|
egl |
EGL | An interface between Khronos rendering APIs such as OpenGL ES or OpenVG and the underlying native platform window system. |
ktx |
KTX (Khronos Texture) | A lightweight container for textures for OpenGL®, Vulkan® and other GPU APIs. |
opencl |
OpenCL | An open, royalty-free standard for cross-platform, parallel programming of diverse processors found in personal computers, servers, mobile devices and embedded platforms. |
opengl |
OpenGL | The most widely adopted 2D and 3D graphics API in the industry, bringing thousands of applications to a wide variety of computer platforms. |
opengles |
OpenGL ES | A royalty-free, cross-platform API for full-function 2D and 3D graphics on embedded systems - including consoles, phones, appliances and vehicles. |
openxr |
OpenXR | A royalty-free, open standard that provides high-performance access to Augmented Reality (AR) and Virtual Reality (VR)—collectively known as XR—platforms and devices. |
vulkan |
Vulkan | A new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs used in a wide variety of devices from PCs and consoles to mobile phones and embedded platforms. |
Name | Library | Description |
---|---|---|
glfw |
GLFW | Create multiple windows, handle user input (keyboard, mouse, gaming peripherals) and manage contexts. Also features multi-monitor support, clipboard access, file drag-n-drop, and much more. |
jawt |
JAWT | The AWT native interface. |
nfd |
Native File Dialog Extended | A small C library that portably invokes native file open, folder select and file save dialogs. |
tinyfd |
tinyfd | A native dialog library. |
Name | Library | Description |
---|---|---|
fmod |
FMOD | An end-to-end solution for adding sound and music to any game. |
openal |
OpenAL | A cross-platform 3D audio API appropriate for use with gaming applications and many other types of audio applications. |
openal |
OpenAL Soft | An LGPL-licensed, cross-platform, software implementation of the OpenAL 3D audio API. |
opus |
Opus | A totally open, royalty-free, highly versatile audio codec. |
Name | Library | Description |
---|---|---|
assimp |
Assimp | A portable Open Source library to import various well-known 3D model formats in a uniform manner. |
bgfx |
bgfx | Cross-platform, graphics API agnostic, “Bring Your Own Engine/Framework” style rendering library, licensed under permissive BSD-2 clause open source license. |
freetype |
FreeType | A freely available software library to render fonts. |
harfbuzz |
HarfBuzz | A text shaping library that allows programs to convert a sequence of Unicode input into properly formatted and positioned glyph output — for any writing system and language. |
meshoptimizer |
meshoptimizer | A mesh optimization library that makes meshes smaller and faster to render. |
msdfgen |
msdfgen | A multi-channel signed distance field generator. |
nanovg |
NanoSVG | A simple stupid SVG parser. |
nanovg |
NanoVG | A small antialiased vector graphics rendering library for OpenGL. |
nuklear |
Nuklear | A minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain. |
par |
par_octasphere | Generates triangle meshes for spheres, rounded boxes, and capsules. |
par |
par_shapes | Generate parametric surfaces and other simple shapes. |
par |
par_streamlines | Triangulate wide lines and curves. |
shaderc |
Shaderc | A collection of libraries for shader compilation. |
spvc |
SPIRV-Cross | A library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages. |
tinyexr |
Tiny OpenEXR | A small, single header-only library to load and save OpenEXR(.exr) images. |
vma |
Vulkan Memory Allocator | An easy to integrate Vulkan memory allocation library. |
yoga |
Yoga | An open-source, cross-platform layout library that implements Flexbox. |
stb - single-file public domain libraries for C/C++
Name | Library | Description |
---|---|---|
stb |
stb_easy_font | Quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc. |
stb |
stb_image | Image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC |
stb |
stb_image_resize | Resize images larger/smaller with good quality. |
stb |
stb_image_write | Image writing to disk: PNG, TGA, BMP |
stb |
stb_perlin | Revised Perlin noise (3D input, 1D output). |
stb |
stb_rect_pack | Simple 2D rectangle packer with decent quality. |
stb |
stb_truetype | Parse, decode, and rasterize characters from truetype fonts. |
stb |
stb_vorbis | Decode ogg vorbis files from file/memory to float/16-bit signed output. |
cuda
hwloc
jemalloc
libdivide
llvm
lmdb
lz4
meow
odbc
openvr
remotery
sse
tootle
xxhash
zstd