sokol-d 0.3.4

D bindings for sokol


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

CI Build Latest release Static Badge

Auto-generated D bindings for the sokol headers.

Targets

By default, the backend 3D API will be selected based on the target platform:

  • macOS: Metal
  • Windows: D3D11
  • Linux: GL/Wayland
  • Wasm (LDC2 required) - WebGL3/WebGPU support
Usage - template project
dub init -t sokol-d <project-name>

Build Requirements

  • D Compiler (DMD/LDC2/GDC) v2.111.0 or higher
  • C/C++ compiler (GCC/Clang/MSVC)
  • Linux dependencies: libglu1-mesa-dev, mesa-common-dev, xorg-dev, libasound-dev (for X11/Wayland, GL and ALSA development)

Available Examples

  • blend
  • bufferoffsets
  • clear
  • cube
  • debugtext
  • droptest
  • imgui
  • instancing
  • instancingcompute
  • saudio
  • sglcontext
  • sglpoints
  • triangle

See examples

All Configurations

dub build --print-configs    
Available configurations:
    sokol-static [default]   # Static library build
    sokol-shared             # Shared/dynamic library build
    sokol-wayland-static     # Wayland static build for Linux
    sokol-wayland-shared     # Wayland shared build for Linux
    imgui-static             # Sokol + Dear ImGui static build
    imgui-shared             # Sokol + Dear ImGui shared build  
    imgui-wgles3             # Sokol + Dear ImGui WebGL ES3 build
    imgui-wgpu               # Sokol + Dear ImGui WebGPU build
    sokol-wgles3             # WebGL ES3 build
    sokol-wgpu               # WebGPU build
    genshaders               # [re]Generate shader code

Additional Build Options

Library Types

  • Static library: dub build -c sokol-static
  • Shared library: dub build -c sokol-shared

Linux Display Server

  • X11 (default with static): dub build -c sokol-static
  • Wayland static: dub build -c sokol-wayland-static
  • Wayland shared: dub build -c sokol-wayland-shared

Build Modes

Available for all configurations:

  • Debug: -b debug
  • Release: -b release
  • Release (no bounds checking): -b release-nobounds
  • Release (better C): -b release-betterc

Shaders

Checkout sokol-tools for a sokol shader pipeline! It supports these D bindings and all shaders in the examples folder here have been compiled using it with -f sokol_d!

dub build -c genshaders


License and attributions

This code is released under the zlib license (see LICENSE for info). Parts of gen_d.py have been copied and modified from the zig-bindings[^1] and rust-bindings[^2] for sokol.

The sokol headers are created by Andre Weissflog (floooh) and sokol is released under its own license[^3].

Authors:
  • Matheus França
  • Andre Weissflog
Sub packages:
sokol-d:init-exec
Dependencies:
none
Versions:
0.3.4 2025-Jun-15
0.3.3 2025-Jun-08
0.3.2 2025-Jun-06
0.3.1 2025-Jun-06
0.3.0 2025-Jun-06
Show all 17 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 13 downloads this month

  • 53 downloads total

Score:
1.9
Short URL:
sokol-d.dub.pm