Skip to content

allyourcodebase/fmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fmt-zig

Using build.zig integration for the {fmt} library - a modern formatting library providing a fast and safe alternative to C stdio and C++ iostreams.

Key features of {fmt}:

  • Fast and efficient formatting with type-safe format strings
  • Implements C++20 std::format
  • Supports user-defined types
  • Extensive formatting options and positional arguments
  • Modern clean API design
  • Header-only and compiled versions available

Requirements

  • zig v0.14.0 or master

How to build

Make directory and init

$ zig init
## add in 'build.zig.zon' fmt-zig package
$ zig fetch --save=fmt git+https://github.com/allyourcodebase/fmt-zig

Add in build.zig

const std = @import("std");

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

    const fmt_dep = b.dependency("fmt", .{
        .target = target,
        .optimize = optimize,
    });
    const fmt_artifact = fmt_dep.artifact("fmt");

    for(fmt_artifact.root_module.include_dirs.items) |include_dir| {
        try exe.root_module.include_dirs.append(b.allocator, include_dir);
    }
    exe.linkLibrary(fmt_artifact);
}

Releases

No releases published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy