Skip to main content

Overview

llama.cpp provides extensive CMake options to customize your build. Options are specified with -D flag:

General Options

Build Type

Debug build
Static build

Optimization Options

GGML_NATIVE=ON optimizes for your current CPU but may not work on other systems.
Portable build (no native optimization)

Build Targets

Minimal build (library only)

GPU Backend Options

CUDA (NVIDIA)

GGML_CUDA_FA_ALL_QUANTS=ON significantly increases compilation time and binary size.

HIP (AMD)

Linux HIP build
Windows HIP build

Metal (Apple)

Disable Metal

Vulkan

Vulkan with validation

SYCL (Intel GPU)

CPU Backend Options

BLAS Libraries

CPU Instruction Sets

* Default is ON unless GGML_NATIVE=OFF
These options override automatic detection. Only use if you know your target CPU capabilities.
Enable AVX-512

ARM CPU Options

Arm KleidiAI

Special Purpose Backends

CANN (Ascend NPU)

ZenDNN (AMD EPYC)

OpenCL (Qualcomm Adreno)

RPC Backend

Advanced Options

Threading

Disable OpenMP

Debugging & Diagnostics

Build with sanitizers

Backend Dynamic Loading

GGML_BACKEND_DL requires BUILD_SHARED_LIBS=ON.
Dynamic backend loading

HTTPS/SSL Support

Disable OpenSSL

Common Build Configurations

Development Build

Fast compilation, full debug info:

Production Build

Optimized for performance:

Multi-GPU Build

CUDA + Vulkan for flexibility:

Minimal Binary Size

Library only, static linking:

Portable Build

Runs on any x86_64 system:

Option Discovery

To see all available CMake options:
To see current configuration:
For GUI-based configuration (requires cmake-gui):