Skip to content

kassane/sokol-d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI Build Latest release Static Badge Ask DeepWiki

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) - WebGL2/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
    nuklear-static           # Sokol + Nuklear static build
    nuklear-shared           # Sokol + Nuklear shared build  
    nuklear-wgles3           # Sokol + Nuklear WebGL ES3 build
    nuklear-wgpu             # Sokol + Nuklear 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-bindings1 and rust-bindings2 for sokol.

The sokol headers are created by Andre Weissflog (floooh) and sokol is released under its own license3.

Footnotes

  1. https://github.com/floooh/sokol-zig/

  2. https://github.com/floooh/sokol-rust/

  3. https://github.com/floooh/sokol/blob/master/LICENSE

Contributors 4

  •  
  •  
  •  
  •