Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Cubitect/cubiomes/llms.txt

Use this file to discover all available pages before exploring further.

cubiomes ships as source code — you build it into a static archive (libcubiomes.a) or a shared library (libcubiomes.so) and then link your own programs against it. The repository includes both a makefile and a CMakeLists.txt, so you can use whichever build system fits your project.

Prerequisites

  • GCC or a compatible C compiler
  • make (for the makefile build) or CMake ≥ 2.8 (for the CMake build)
  • git to clone the repository

Build with make

1

Clone the repository

git clone https://github.com/Cubitect/cubiomes.git
cd cubiomes
2

Build the static library

Running make (which defaults to make release) compiles all source files with -O3 -fwrapv and bundles them into libcubiomes.a:
make
Three build targets are available:
TargetFlags added
make release (default)-O3
make debug-O0 -ggdb3 -DDEBUG
make native-O3 -march=native -ffast-math
On Linux and macOS, the makefile automatically adds -pthread to the linker flags and -fPIC to the release build, producing position-independent code suitable for shared libraries.

Build with CMake

1

Clone the repository

git clone https://github.com/Cubitect/cubiomes.git
cd cubiomes
2

Configure and build

cmake -B build
cmake --build build
CMake defaults to a Release build. To build a debug configuration:
cmake -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build
3

Install headers and libraries (optional)

cmake --install build
This installs the shared library (cubiomes), the static library (cubiomes_static), and all public headers to your system’s default prefix.
CMake builds both a shared library and a static library from the same object files. Position-independent code (-fPIC) is set on the object target automatically. Once you have built libcubiomes.a or libcubiomes.so, compile and link your program from inside the cubiomes directory:
gcc your_program.c libcubiomes.a -fwrapv -lm
Always include -fwrapv. cubiomes emulates Java’s RNG, which relies on two’s complement signed integer wraparound. Without -fwrapv, signed integer overflow is undefined behavior in C, and the compiler may produce incorrect results or eliminate the overflow entirely.
If your makefile enables pthreads (the default on Linux and macOS), add -lpthread when linking:
gcc your_program.c libcubiomes.a -fwrapv -lm -lpthread

What gets built

The library is composed of the following translation units, each with a corresponding public header:
Source fileHeaderPurpose
generator.cgenerator.hBiome generator setup and query
biomes.cbiomes.hBiome IDs, versions, dimensions
finders.cfinders.hStructure position and viability
layers.clayers.hLayered generation (≤ 1.17)
biomenoise.cbiomenoise.hNoise-based generation (1.18+)
noise.cnoise.hPerlin/simplex noise primitives
quadbase.cquadbase.hQuad-structure seed bases
util.cutil.hImage output and utility helpers
rng.crng.hJava-compatible RNG

Build docs developers (and LLMs) love