What building the renderer needs on this machine, and the build configuration
mix cauldron_gpu.setup writes.
Each platform module (CauldronGPU.Setup.MacOS, CauldronGPU.Setup.Linux,
CauldronGPU.Setup.Windows) implements CauldronGPU.Setup.Platform: it looks for each
thing the build needs in that platform's usual places, installs what it can, and turns
what it found into configuration.
The configuration is build.config in :filename.basedir(:user_config, "cauldron_gpu"),
Erlang terms read with :file.consult/1. mix.exs passes it to make or nmake:
{choice, card | software}:softwarebuilds no renderer{pkg_config, Path}:PKG_CONFIG, thepkg-configprogram{pkg_config_path, Path}: added toPKG_CONFIG_PATH{sdl3_dir, Path}:SDL3_DIR, an SDL3 development folder (Windows){vulkan_include, Path}:VULKAN_INCLUDE, the folder holdingvulkan/vulkan.hpp{msvc_env, [{Name, Value}]}: the environment MSVC'svcvars64.batsets, used whenclis not already onPATH{nmake, Path}: MSVC'snmake.exe, used whennmakeis not onPATH
Other variables already set in the environment take precedence over the file.
Summary
Functions
The environment variables config sets for the build, as mix.exs passes them; set in
this process before rebuilding, so the build that follows uses them.
The folder downloads and builds go into.
Whether games can draw on the graphics card: {:ok, device, backends} when the renderer
loads and opens an offscreen device, else {:error, text} saying why. Loads the
renderer again first, so a build made since this process started is the one checked.
The configuration file's path.
The platform module for the machine this runs on.
The configuration written last, or %{}.
The SDL3 release downloaded when SDL3 is fetched rather than installed.
The Vulkan-Headers release downloaded when Vulkan's headers are missing.
Writes config as the configuration, replacing the file.
Types
@type item() :: %{ key: atom(), name: String.t(), required?: boolean(), found: String.t() | nil, install: String.t() | nil, manual: String.t() }
One thing the build needs:
key: the platform's name for itname: what to call it when talking to a personrequired?: whether the renderer can be built without itfound: where it is, ornilinstall: what the automatic install does, ornilwhen it cannot be automatedmanual: how a person installs it themselves
Functions
The environment variables config sets for the build, as mix.exs passes them; set in
this process before rebuilding, so the build that follows uses them.
@spec cache_dir() :: Path.t()
The folder downloads and builds go into.
Whether games can draw on the graphics card: {:ok, device, backends} when the renderer
loads and opens an offscreen device, else {:error, text} saying why. Loads the
renderer again first, so a build made since this process started is the one checked.
@spec config_path() :: Path.t()
The configuration file's path.
@spec platform() :: module()
The platform module for the machine this runs on.
@spec read_config() :: map()
The configuration written last, or %{}.
@spec sdl3_version() :: String.t()
The SDL3 release downloaded when SDL3 is fetched rather than installed.
@spec vulkan_headers_version() :: String.t()
The Vulkan-Headers release downloaded when Vulkan's headers are missing.
@spec write_config(map()) :: :ok
Writes config as the configuration, replacing the file.