Modules, config, and build systems

raylib is configured at compile time through src/config.h and platform defines. Three build paths are maintained: GNU Make, CMake, and Zig.

Source files → library

FileModule flagRole
rcore.cmandatoryCore + included platform
rlgl.hmandatoryGL impl inside rcore
rshapes.cSUPPORT_MODULE_RSHAPES2D draw + collision
rtextures.cSUPPORT_MODULE_RTEXTURESImages & textures
rtext.cSUPPORT_MODULE_RTEXTFonts (needs rtextures)
rmodels.cSUPPORT_MODULE_RMODELS3D models
raudio.cSUPPORT_MODULE_RAUDIOAudio
rglfw.cdesktop GLFWVendored GLFW (separate .o in Make)

src/CMakeLists.txt — raylib_sources

GNU Make (common on Linux)
cd raylib/src
make PLATFORM=PLATFORM_DESKTOP

cd raylib/examples
make core/core_basic_window
./core/core_basic_window

Key flags: PLATFORM, GRAPHICS, RAYLIB_BUILD_MODE=RELEASE, RAYLIB_CONFIG_FLAGS for custom defines.

CMake
cmake -B build -DPLATFORM=Desktop -DBUILD_EXAMPLES=ON
cmake --build build
./build/examples/core/core_basic_window

CUSTOMIZE_BUILD=ON exposes every SUPPORT_* flag. OPENGL_VERSION selects graphics API.

Zig build
zig build
zig build core_basic_window    # run example

Options: -Dplatform=glfw|sdl2|drm|…, -Dopengl_version=gles_2, module toggles -Draudio=false, etc.

Public headers
  • raylib.h — main API
  • raymath.h — math (standalone with RAYMATH_IMPLEMENTATION)
  • rlgl.h — GL layer (standalone with RLGL_IMPLEMENTATION)
  • rcamera.h, rgestures.h — optional helpers
Tooling in repo
  • tools/rlparser — parses raylib.h → JSON/XML for bindings
  • tools/rexm — validates and updates the examples collection

No unit test suite — CI compiles library + examples on Linux, Windows, macOS, Android, Web.

Notable config defaults
  • SUPPORT_CUSTOM_FRAME_CONTROL 0 — EndDrawing owns swap/poll
  • SUPPORT_GPU_SKINNING 0 — CPU bone skinning default
  • SUPPORT_FILEFORMAT_JPG 0 — JPG off unless enabled
  • RL_DEFAULT_BATCH_BUFFER_ELEMENTS 4096 — batch capacity

config.h

Dependency direction

raylib.h (types)
    │
rcore ──► rlgl ◄── rshapes, rtextures, rtext, rmodels
    │              rtext ──► rtextures
    │              rmodels ──► rtextures, raymath
    └──► platform/*.c (included)

raudio ──► miniaudio (independent)