Skip to content

zig_configure

Once-native configured Zig library target.

Description

Compiles a Zig library with configuration declared directly on the target. Set output = "static" for zig build-lib, or output = "shared" for zig build-lib -dynamic.

The root can be set with main, or omitted when deps contains exactly one Zig module dependency. C provider deps contribute headers, definitions, include directories, library inputs, and linker flags.

Canonical module names are generated from target labels with collision-safe escaping. import_names keys must match exactly one Zig module dependency by full label, short label name, import name, or canonical name; ambiguous or unknown keys fail validation.

Attributes

This target accepts the complete build configuration attribute set documented by zig_static_library, including import_name, import_names, strip, translate_c_identity, csrcs, linker settings, and auxiliary output settings. It also accepts:

AttributeTypeRequiredDefaultDescription
outputstringnostaticstatic or shared
emit_binboolnotrueEmit the static library when output is static
shared_lib_namestringnoplatform nameExact shared library output file name when output is shared
android_abistringnoemptyAndroid Application Binary Interface directory for shared library packaging

Dependency Edges

EdgeAcceptsDescription
depszig_module, c_providerZig modules and C provider dependencies consumed by the library

Providers

The target emits the same native provider fields as zig_static_library or zig_shared_library, depending on output.

Capabilities

CapabilityOutput groups
buildstatic_library, shared_library, asm, llvm_ir, llvm_bc, zig_docs

Example

toml
[[target]]
name = "math_release"
kind = "zig_configure"
deps = ["./math"]

[target.attrs]
mode = "release_fast"
threaded = "single"
output = "static"

Released under an open-source license.