# Installation

> UForm for C

### Building

CMake builds `uform_static` and `uform_shared` from the objects `src/` compiles, and the archive carries the NumKong, StringZilla and yyjson objects it needs, naming only the system codecs to its consumers:

```sh
cmake --preset library
cmake --build --preset library
```

The presets choose the residencies a build carries:

- `library` builds the engine for the host alone.
- `cuda_rocm_library` adds the NVIDIA and AMD residencies, the trainer and the mesh, with Clang hosting both vendors' compilers.
- `linux_cuda_rocm` adds both residencies without the trainer, and launches UForm's own kernels through drivers opened at first use.
- `wasm32_emscripten` and `wasm32_wasi` build for WebAssembly, which takes decoded media only.
- `stub_library` builds `src_stub/`, a stand-in answering the same verbs over the C++ standard library and ForkUnion.

The stand-in's archives carry the engine's file names in a `stub/` directory of their own, so a consumer swaps implementations with one `-L`.
`c/test.c` runs against both, with the tiny checkpoint `test/tiny_checkpoint.cpp` writes when the suites are built.

### Headers

- `uform/uform.h`: the umbrella over the four headers below.
- `uform/types.h`: statuses and outcomes, scalars, rows, tapes, progress, CPU and GPU classes, devices, executors, arenas, the name tables and the version probes.
- `uform/model.h`: loading an encoder into RAM or VRAM, from a file or a buffer, describing it and freeing it.
- `uform/encode.h`: texts, files, pixels, clips and samples to embeddings, states and token vectors, and scored choices.
- `uform/train.h`: the mesh, trainers, their steps and checkpoints, on NVIDIA GPUs alone.

A caller only encoding may include `encode.h` alone, since each header pulls in `types.h`.
Statuses, scalars, rows, tapes, progress, arenas and the executor contract mirror USearch's `types.h` value for value, so embeddings and failures cross between the two libraries unchanged.
`find_package(uform)` reads an install as `uform::static`, `uform::shared` and `uform::header`.
An install or the SDK archive also answers `pkg-config --libs uform` with the shared library, which exports the `uform_*` functions alone.

`uform_version`, `uform_capabilities_compiled` and `uform_capabilities_available` report the library this process linked and the hardware it found.

`#include <uform/types.h>`

## uform_version

Reports the version of the library this process linked, which may differ from the [`UFORM_VERSION_MAJOR`](#UFORM_VERSION_MAJOR) family of macros it was compiled against.

```c
void uform_version(int *major, int *minor, int *patch);
```

- `major` (out): The major version, which changes whenever an argument structure does.
- `minor` (out): The minor version.
- `patch` (out): The patch version.

## uform_version_name

The version of the library as a static null-terminated string.

```c
char const * uform_version_name(void);
```

## UFORM_VERSION_MAJOR

Marks exported functions: exported while building the shared library, imported when consuming it on Windows, and of default visibility on ELF and Mach-O.

```c
#define UFORM_VERSION_MAJOR 4
```

Define it to override. The library's version, which the release tooling rewrites in place.

