Configuration
Everything about a game that is not code lives in one file at the root of the
project, raylib_multiplatform.toml: its name, its store identities, its window, the
platforms it is built for, and every setting the framework reads. CMake, Gradle, Xcode and CI all
take their answers from it, so they cannot disagree with each other.
This page explains how the file works. Every key, with its default and the values it takes, is listed in the configuration reference.
One file for every build system#
A game is built by four different systems — CMake for the desktops and the web, Gradle for Android, Xcode for iOS, GitHub Actions for all of them — and all four need to agree on the same facts: what the game is called, what its bundle id is, which platforms to build. Left to themselves they disagree, and the failure is always silent: a release that ships under the wrong identity, or an Android build that encrypts its assets with a different password from the desktop one and cannot read them.
So there is one hand-written source and one generator. tools/configure.py reads the
.toml and writes what each system needs:
| It writes | Which is read by |
|---|---|
cmake/generated/ | CMake: the project name, which raylib modules to build, the compiler, linker and sanitizers of debug builds, the web build's memory, the Windows icon. |
rmp/config.h, generated | Your C and C++: the RMP_ values, such as RMP_WINDOW_WIDTH. |
raymob/generated.properties and the manifest | Gradle: the application id, the SDK levels, the permissions, the orientation, the OpenGL ES version the game is compiled for, whether AdMob is in the build. |
ios/project.yml | XcodeGen, which makes the Xcode project: the bundle id, the deployment target, your [ios.settings]. |
the icons and the LICENSES.txt files | The packages the game ships in: the icons go into the Android, iOS and Windows ones, a LICENSES.txt into each. |
the triggers of .github/workflows/ci.yml | GitHub Actions: whether a push and a pull request start a run, from [ci] on_push. |
The build files stay dumb: they read what the generator wrote and never parse the
.toml themselves, because three parsers would be three ways to drift. CI asks the same
generator its questions — which targets are enabled, which jobs to start, where to publish — through
its --print- options. None of the generated files is committed but the triggers in
ci.yml, which GitHub reads from the repository; see
what the build generates.
When it runs#
You never run it by hand to build. Every cmake --preset runs it first, before
anything else is configured, because the project's own name comes out of it — so
rmp run, rmp build release and rmp web all regenerate. CMake also
watches the .toml, so editing it and building again picks the change up. The generator
takes milliseconds and rewrites a file only when its content changed, so a configure that changed
nothing rebuilds nothing.
Gradle and XcodeGen never run CMake, so those two builds run
python3 tools/configure.py as a step of their own; rmp android does it for
you, and so do the CI jobs.
The generator needs Python 3.11 or newer. A machine without one can still build from files that
were generated earlier, with a warning that edits to the .toml will not be seen; with
nothing generated yet, the build stops and says how to get Python.
How a key is read#
The file is TOML. A key lives under a section, and the framework names it the same way
everywhere — in its messages, in its comments and on this site — as [section] key:
[window]
title = "Space Rocks" # this is [window] title
width = 1280 # and this is [window] width
height = 720The file is laid over the defaults. A key you leave out takes its default, a section you leave
out is entirely default, and a game whose .toml is deleted still builds through
cmake --preset debug, with a warning saying it is running on defaults — though not through
rmp, which finds the project by that file and, without it, says it is not inside one. So
a .toml holds only what the game changes:
[project]
name = "space_rocks"
[window]
title = "Space Rocks"
width = 1280
height = 720
[targets]
enabled = ["all"]
disabled = ["ios"]
[android]
application_id = "com.yourname.spacerocks"
[ios]
bundle_id = "com.yourname.spacerocks"The .toml that rmp new gives a game is the framework's own, with every key
written out and a comment over each one saying what it does and why its default is what it is. It
is worth reading once. rmp new writes the game's own values into it — its name, its
placeholder store ids, a password of its own — and turns AdMob off and Android's OpenGL ES version
down to 2.0, the two keys the framework sets the other way so that its CI builds those paths; see
Project layout.
Reading a value in your code#
The values a game needs at run time reach C and C++ as macros, generated into
rmp/config.h, which every framework header includes for you:
const float centre_x = RMP_WINDOW_WIDTH / 2.0f; // [window] width
TraceLog(LOG_INFO, "%s starting", RMP_PROJECT_NAME); // [project] nameThey are macros rather than constants so that a game in plain C can use them too. Not every key has one: only the ones the game itself reads, such as the window, the UI's starting font and scale, the volumes and the save settings. Headers explains the file, and the macros reference lists every one with the key it comes from.
A wrong value stops the build at once#
An invalid .toml fails in configure.py, in about a second, before
anything is compiled — not at the compiler, and not on a CI runner twenty minutes in. The message
names the exact line, says what is wrong with it, and says what to write instead. Every combination
of keys that cannot work is a refusal with a reason, and each refusal has a test in the
framework.
A key the framework does not know is refused, because a misspelt key would otherwise be silently ignored and its default used instead:
[window]
titel = "Space Rocks" raylib_multiplatform.toml:2: titel = "Space Rocks"
^^^^^^^^^^^^^^^^^^^^^
configure: error: unknown key [window.titel] in raylib_multiplatform.tomlEvery value is checked for its type before anything reads it. A list written without its brackets is the commonest slip, and TOML would hand the string over a character at a time:
[targets]
enabled = "all" raylib_multiplatform.toml:2: enabled = "all"
^^^^^^^^^^^^^^^
configure: error: [targets] enabled = 'all' is a string, and this has to be a list.
Write [targets] enabled = ['all'] -- with the brackets. Without them TOML hands over the characters one at a time.
Groups count as names here: ["all"], ["desktop"].A stray pair of brackets the other way round is refused just as plainly:
[window]
orientation = ["landscape"] raylib_multiplatform.toml:2: orientation = ["landscape"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^
configure: error: [window] orientation = ['landscape'] has to be a string, one of landscape, portrait, unspecified.
A TOML array or table here is almost always a stray pair of brackets.An empty value is refused too, wherever empty would mean nothing. A game with no title would have a blank title bar and no name under its icon:
[window]
title = "" raylib_multiplatform.toml:2: title = ""
^^^^^^^^^^
configure: error: [window] title is empty. It is the title bar on desktop and the name under the app's icon on Android and iOS -- give the game a name.Where empty does mean something, the key says what: [linux] glibc = "" builds against
the glibc of the machine doing the build.
And two keys that are each valid can still contradict each other. A frame cap of 15 frames a
second makes every frame a fifteenth of a second long, but [app] max_delta hands the game
at most a twentieth, so the game would run slow forever without anything saying why:
[window]
fps = 15 raylib_multiplatform.toml:2: fps = 15
^^^^^^^^
configure: error: [window] fps = 15 makes every frame 0.06667 s long, but [app]
max_delta = 0.05 hands the game at most that much per frame, so the
game would run at 75% speed forever. Raise fps to 20 or
more, raise max_delta to 0.06667 or more, or set max_delta = 0.The same check runs wherever the .toml is read: cmake --preset debug,
rmp run, the config stage of rmp test, and the first job of every
CI run. python3 tools/configure.py --check runs it on its own and writes nothing.
One check is stricter on a release. A tag build refuses an [android] application_id
or an [ios] bundle_id that is still a placeholder under com.example., for a
target that is enabled, because a Google Play application id can never be changed after the first
upload. A debug build accepts them, so that a game builds the moment it is made.
What is not in it#
No version. A release takes its version from the git tag: v1.2.3
becomes the version name on every platform, and Android's version code is worked out from it as
major × 1000000 + minor × 1000 + patch, so it only ever goes up. A build that is not a
tag is 0.0.0-dev. There is nothing in the file to remember to bump.
No secrets. The .toml is committed, so nothing in it may be secret:
no keystore, no token, no password. Signing keys and publishing credentials are GitHub secrets.
[resources] rres_password is not an exception — it is compiled into the game, which can
therefore read its own pack, and it makes unpacking the assets inconvenient rather than
impossible. [save] encrypt is the same: the key is derived from
[project] name and lives in the binary.
The sections#
Every section, and what it is for. Most games touch the first four and leave the rest at their defaults.
| Section | What it decides |
|---|---|
[project] | The game's name: the executable, the CMake target, the Xcode scheme, the save folder on desktops and the web, and every artifact's name. |
[window] | The title, the size the window opens at — which is also the design resolution — how the world fits a window of another size, the phone orientation, vsync and a frame cap. |
[targets] | Which platforms the game is built for, by group or by exact id. |
[android], [ios] | The store identities, the oldest OS versions supported, the OpenGL ES version Android is compiled for and requires, the Play Store category. [ios.settings] passes raw Xcode build settings through, such as a signing team. |
[android.display], [android.permissions], [android.features] | Screen behaviour on Android (keep the screen on, hide the system bars, draw behind the notch), the permissions the app asks for, and the hardware the Play Store requires. |
[android.admob] | Whether AdMob is in the Android build at all — not unless the game turns it on — and the app and ad unit ids. See rmp::ads. |
[icon] | The picture the Android, iOS and Windows icons are made from, and the colour behind Android's adaptive icon. |
[app] | The longest step the game logic is ever handed, so a stalled frame is a moment of slow motion and not a teleport through a wall. |
[ui] | The theme, font, font size and scale rmp::ui starts with, and the ceiling on its layout tree. |
[input] | The analogue stick's dead zone. See rmp::input. |
[audio] | The volumes the three buses of rmp::audio start at. |
[save] | Where rmp::save puts the saves, whether they are sealed by default, and the version of your save format. |
[resources] | The password the asset pack is encrypted with. |
[raylib] | raylib modules a game does not use, left out to shrink the binary. |
[web] | The browser build's memory, whether it may grow, and which layer raylib talks to. |
[linux], [windows] | The windowing backend on each, native Wayland, and the oldest glibc the linux-x64-glibc and linux-arm64-glibc binaries may need. linux-riscv64-glibc is cross-compiled against Ubuntu 24.04's glibc and needs 2.38, which its CI job holds it to. |
[upx] | Which shipped binaries are compressed with UPX. A target that cannot be compressed is refused by name, with the reason. |
[dev] | Debug builds only: their compiler and linker, whether a framework warning aborts them, and the sanitizers they run under. The debug builds CI runs its checks with read it too; the release and web builds that ship never do. |
[ci] | Whether CI runs on every push and every pull request, or only on a release tag and when you start it by hand. See Continuous integration. |
[deploy], [deploy.itch], [deploy.firebase] | Whether a LICENSES.txt ships with the game, where a release is published on itch.io, and the Firebase project whose Test Lab runs the Android build and taps through it. |
[project] and [window]#
[project] name is the one value that names files. It has to be letters, digits,
_ and -, starting with a letter, because it becomes the executable on every
operating system. Changing it after release changes where the saves are kept on desktops and the web
— Android and iOS keep them in a folder without it, and so does a [save] portable build
that saves next to its executable — and, on every platform, makes sealed saves from the old name
unreadable, since their key is derived from it.
[window] width and height are two things at once. On a desktop they are
the size the window opens at. Everywhere, they are the design resolution: the size
rmp::ui lays a menu out at before scaling it to the real
window, and the area the camera starts centred on. The window
can be resized, and a phone's screen is whatever it is; the design resolution is the fixed size the
game is written against, and [window] stretch says what the world does in a window of
another size: letterboxed, expanded to show more of it, or left at 1:1. See
a window of another size.
[window] title is the title bar on a desktop and the name under the icon on Android
and iOS. orientation — "landscape", "portrait" or
"unspecified" — is applied to Android and iOS at once; on a desktop the window's shape
is its width and height.
vsync, on by default, waits for the screen's refresh before showing each frame: no
tearing, and no frames drawn that nobody sees. fps caps the frame rate, and 0, the
default, is no cap. The web and iOS ignore fps, because the browser and the display
pace the frame there.
[targets]#
enabled lists groups and exact target ids; they are expanded and duplicates
dropped. disabled is then subtracted from the result. There is no precedence to reason
about, because the two never conflict: enabled = ["all"] with
disabled = ["ios"] is every target except iOS, whatever order they are written in.
[targets]
enabled = ["desktop", "web"]
disabled = []A target turned off is out of the build, out of CI and out of the release. Every target, with the groups it belongs to:
| Target | What it is | Family | Groups it is in |
|---|---|---|---|
linux-x64-glibc | Linux x86-64 | linux | all, desktop, linux |
linux-arm64-glibc | Linux ARM64 | linux | all, desktop, linux |
linux-riscv64-glibc | Linux RISC-V | linux | all, desktop, linux |
linux-x64-musl | Linux x86-64 (musl / Alpine) | linux | all, linux |
windows-x64 | Windows x86-64 | windows | all, desktop, windows |
windows-arm64 | Windows ARM64 | windows | all, desktop, windows |
macos | macOS (universal) | apple | all, apple, desktop |
ios | iOS (simulator) | apple | all, apple, mobile |
web | Web (WebAssembly) | web | all, web |
android | Android | android | all, android, mobile |
freebsd-x64 | FreeBSD x86-64 | bsd | all, bsd |
freebsd-arm64 | FreeBSD ARM64 | bsd | all, bsd |
openbsd-x64 | OpenBSD x86-64 | bsd | all, bsd |
openbsd-arm64 | OpenBSD ARM64 | bsd | all, bsd |
netbsd-x64 | NetBSD x86-64 | bsd | all, bsd |
linux-x64-glibc-drm | Linux DRM/KMS (no X11) | linux | all, drm, linux |
linux-arm64-glibc-drm | Linux ARM64 DRM/KMS (no X11) | linux | all, drm, linux |
[android] and [ios]: identities you cannot change#
[android] application_id and [ios] bundle_id are the game's identity on
the stores. A Google Play application id is permanent: once an app is published under one, it can
never be renamed or moved, and getting it wrong means a new listing that starts again from zero
installs and reviews. That is why a release refuses the com.example. placeholders that
rmp new writes. Set both before the first release.
[android] gl_version: what the game is compiled for#
[android] gl_version
decides what raylib and the game are compiled for on Android, and the manifest requires the same
version. "ES20", the default, compiles for OpenGL ES 2.0, which every Android device
has. "ES30" compiles raylib's ES 3.0 path, links libGLESv3 and asks EGL for
a version 3 context, and the Play Store does not offer the game to a device without ES 3.0.
"ES31" and "ES32" are refused, because raylib has no 3.1 or 3.2 path: they
would compile the ES 3.0 one all the same and only hide the game from more devices.
[android]
gl_version = "ES31" raylib_multiplatform.toml:2: gl_version = "ES31"
^^^^^^^^^^^^^^^^^^^
configure: error: [android] gl_version = 'ES31' would compile raylib for ES 3.0 all the same -- it has no 3.1 or 3.2 path -- and only hide the game from devices without 3.1.
Use "ES30" for ES 3.0, or "ES20" to reach every device.[android.admob]: off until the game has an ad#
Ads are opt-in. With [android.admob] enabled = false, the default and what
rmp new writes, the Android build carries no Google Mobile Ads SDK, asks for no
advertising-id permission and owes Play no advertising-id declaration; the
rmp::ads calls still compile and do nothing, as they do on
every other platform. AdMob also stays out of a build whose targets do not include Android.
Turned on, the three ids go into the release build's manifest and SDK as they are written, and
the SDK stops the app at startup over an app id it cannot read. So each one has to be a string, always, and while
AdMob is on it has to have AdMob's shape: ca-app-pub-, sixteen digits, ~ and
ten digits for app_id, and the same with a / for interstitial_id
and rewarded_id. The defaults are Google's test ids, which have that shape. An empty
id, a malformed one, or an app id where a unit id goes, is refused at its line:
[android.admob]
enabled = true
app_id = "" raylib_multiplatform.toml:3: app_id = ""
^^^^^^^^^^^^
configure: error: [android.admob] app_id is empty, and AdMob is on.
Put the app id from the AdMob console here -- or Google's test one while developing -- or set [android.admob] enabled = false.A
debug APK — the one rmp android builds, and the one CI hands to Firebase Test Lab, whose
crawler taps whatever is on the screen — shows Google's test ads whatever ids the
.toml holds, because a tap on a real ad from your
own build is invalid traffic, and invalid traffic is how an AdMob account gets suspended.
[dev]: debug builds, not the build that ships#
[dev] applies to debug builds and to nothing else. The release and web presets never
read it, so nothing in it can change what ships. compiler picks the compiler of a debug
build, when the machine has it, linker a faster linker when one works, and
strict = true turns the first warning the framework prints about a mistake in the game —
an action nobody defined, a pop() with nothing underneath — into an abort, in the
debugger, at the line that caused it. Release builds compile that check out.
Debug builds are not only the ones on your machine. CI checks a game with debug builds too —
the software render check in a game's own CI is one, booting the game for a few frames — and those
read [dev] exactly as yours do. So with strict = true, a warning the game
triggers while CI boots it aborts the game and fails the check.
[dev] c_compiler: the C of a debug build, compiled by tcc#
Most
of what a debug build compiles is not your game. It is raylib and what it bundles — GLFW, miniaudio,
the image and font decoders — and all of it is C. The Tiny C Compiler compiles C many times faster
than GCC or Clang: on x86-64 Linux, a clean debug build of raylib takes a fraction of a second with
it instead of seconds. c_compiler picks the compiler of a debug build's C, while its C++
— your game and the framework — keeps compiler's:
| Value | Means |
|---|---|
"same" | The C compiler that goes with compiler. The framework's own .toml says this. |
"auto" | tcc when it is installed, on x86-64 Linux; the same as "same" anywhere else, saying which it took. What rmp new writes into a game. |
"tcc" | tcc, and configuring fails when it is not installed. |
[dev]
c_compiler = "auto""tcc" is refused anywhere but Linux, and with compiler = "mingw" or
"msvc", by configure.py, with the line. A tcc build links with GNU ld,
whatever linker says, and its C is never sanitized — tcc has no sanitizers; the C++ is,
when sanitize asks. That is why the framework keeps "same": every line of
its debug builds runs under the sanitizers. A tcc that writes no debugging information or unwinding
tables is not enough: the build image carries tcc 0.9.28rc, built from one commit of its
repository; your distribution's tcc may be older.
Every
configure of CMake — rmp run, rmp build, rmp test, and every
CI job that runs CMake itself (Gradle keeps the Android build's to itself) — prints the C compiler, the C++ compiler and the linker it was given, each with its path and
version, at the top of its log: === C compiler:, === C++ compiler: and
=== Linker:. Which one compiled what is never a guess.
[dev] sanitize: a debug build that checks memory#
A test sees what
it asserts, and a read one past the end of an array that happens to find a zero passes every test
there is. [dev] sanitize lists what a debug build is instrumented with to catch that
kind of mistake where it happens instead of where it crashes, and each report stops the game at
the line that did it, with the stack that got there:
"address", AddressSanitizer: a read or a write past a buffer, a use after free or after return, and on Linux, through LeakSanitizer, memory nobody freed, reported when the game exits. About three times as slow — the framework's unit tests take 5.5 seconds, and 18.6 under it — and two to three times the memory."undefined", UndefinedBehaviorSanitizer: a signed overflow, a shift past the width, a float cast to an int it does not fit, a misaligned or null access. Cheap.
[dev]
sanitize = ["address", "undefined"]A
game starts with sanitize = [], none: turning them on is its author's choice. The
framework lists both, so every debug build of its own — the library, the examples and every test —
runs under them. Release, web, Android and iOS builds never read the key.
Whether
the compiler can give a sanitizer is decided when the build is configured, by building a small
program with it and running it, because a compiler can accept the flag and then have no runtime to
link. A sanitizer that does not run is the machine's problem and not the .toml's: the
debug build goes on without it and says so in a warning, naming what brings it — on Linux, clang
needs compiler-rt, libclang-rt-<N>-dev on Debian and Ubuntu, and gcc's runtimes
come with most distributions. With RMP_REQUIRE_SANITIZERS=1 in the environment the
same configure fails instead, and the software-render check of CI's lint job sets it,
so a sanitizer the .toml lists is never quietly missing there. cmake --preset debug -DRMP_SANITIZE=OFF turns them
off for one build folder, to measure what they cost.
A
runtime can also have part of a sanitizer. The probe calls a virtual function, which is what
UndefinedBehaviorSanitizer's check of dynamic types needs, and NetBSD's GCC has no runtime for that
one check: there a debug build keeps every other check of "undefined", and of
"address", leaves out that one, and says so in a warning.
What can never work is
refused in configure.py, with its reason. Every other sanitizer a compiler knows —
thread, memory, leak, hwaddress,
integer, implicit-conversion and fuzzer — is refused by
name, saying why it does not fit a game:
[dev]
sanitize = ["thread"] raylib_multiplatform.toml:2: sanitize = ["thread"]
^^^^^^^^^^^^^^^^^^^^^
configure: error: [dev] sanitize: 'thread' is refused -- ThreadSanitizer has to see every library the game runs, the system's audio and GL drivers included, or it reports races that are not there -- and it cannot be combined with address.
Use "address" and "undefined", or [] for none.So is a pair that cannot work together: "undefined" with
[dev] compiler = "msvc", whose /fsanitize has address only; any
sanitizer with "mingw", whose GCC ships no runtime; and "address" on
OpenBSD, whose clang has no AddressSanitizer.
A
report fails the checks that boot the game in debug. rmp test smoke, rmp test
render and the software-render check in CI read the game's output for one and its exit
status as well, because a leak is reported after the game has printed everything else; they stop
with a sanitizer reported the run above (exit …) and the first forty lines of the
report. Code that has to know — a timing test that allows for the slowdown — can ask
#if defined(RMP_SANITIZE), and RMP_SANITIZE_ADDRESS or
RMP_SANITIZE_UNDEFINED for one of them; the build defines each for what it
applied.