|
ObjectivelyGPU
Object oriented graphics framework for SDL3 and C
|
Dependencies, building, and linking against ObjectivelyGPU.
Tagged releases are published on the GitHub releases page. To build the latest from source, follow the steps below.
ObjectivelyGPU consumes compiled shader blobs, not GLSL source: SPIR-V for Vulkan, MSL for Metal, and DXIL for D3D12. The toolchain is:
glslc (from shaderc).shadercross (from SDL_shadercross).glslc ships with Homebrew's shaderc. shadercross must be built from source.
Building shadercross requires the SDL3 development headers and libraries — the same SDL3 that ObjectivelyGPU depends on.
The two CMAKE_INSTALL_RPATH options are essential. Without them the installed shadercross has no LC_RPATH and fails at runtime with Library not loaded: @rpath/libSDL3_shadercross.0.dylib. Setting the install rpath to @loader_path/../lib (relocatable) lets the installed binary in bin/ find libSDL3_shadercross in the sibling lib/. On Linux, use $ORIGIN/../lib in place of @loader_path/../lib.
If you do not need HLSL input or DXIL output (for example, Metal and Vulkan only), pass -DSDLSHADERCROSS_DXC=OFF and skip the DirectXShaderCompiler submodule. This avoids the enormous LLVM build entirely and is the recommended lighter-weight path when D3D12 support is not required.
The installed command-line tool is named shadercross (not sdl-shadercross).
Compile GLSL to SPIR-V, then cross-compile SPIR-V to the target language:
Pass --msl-version 2.1.0 for shaders that use features such as invariant gl_Position; older MSL versions reject them.
Compile and link against ObjectivelyGPU with pkg-config: