A Zig build wrapper for the ZFP C compression library
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-03-30 23:16:11 -05:00
.github/workflows should check copy/paste when working with other repos 2026-03-29 19:41:23 -05:00
.gitignore initial commit that builds ZFP. Want to add tests and cfp build target. 2025-04-18 22:49:47 -05:00
build.zig made linkage configurable 2026-03-30 23:16:11 -05:00
build.zig.zon update .zon 2026-03-29 19:36:43 -05:00
LICENSE Adding license and README 2025-04-18 22:54:10 -05:00
README.md Merge branch 'main' of github.com:keltonhalbert/zfp 2026-03-29 19:30:39 -05:00

Build

zfp-zig: zfp packaged for the Zig programming language

This is the ZFP C compression library for the Zig programming language. Currently does not wrap the C++ compressed array classes.

How do I include it in my Zig program?

If you are starting a new package:


mkdir my_project; cd my_project
zig init
## add the package to 'build.zig.zon'
zig fetch --save=zfp git+https://github.com/allyourcodebase/zfp.git

This will add the zig C library as a dependency to your project. Next, if you are linking it to a library or executable, add the following to build.zig:

pub fn build(b: *std.Build) !void {
    const target = b.standardTargetOptions(.{});

    const optimize = b.standardOptimizeOption(.{});

    const zfp_dep = b.dependency("zfp", .{
        .target = target,
        .optimize = optimize,
    });

    // if you are linking it to a library...
    const lib_mod = b.createModule(.{
        .root_source_file = b.path("src/root.zig"),
        .target = target,
        .optimize = optimize,
    });

    lib_mod.linkLibrary(zfp_dep.artifact("zfp"));
        
    // or, if you are linking it to an executable...
    const exe_mod = b.createModule(.{
        .root_source_file = b.path("src/main.zig"),
        .target = target,
        .optimize = optimize,
    });

    exe_mod.linkLibrary(zfp_dep.artifact("zfp"));
}

Requirements

The target version of Zig is 0.15.2. It may work with earlier versions, but has not been tested.