diff --git a/README.md b/README.md index fc39afc..dfb3b8d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # spdlog -zig build for spdlog +This is [spdlog](https://github.com/gabime/spdlog), packaged for [Zig](https://ziglang.org/). + +Usage instructions to be added. Hopefully this things works. :) diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..f29f4cf --- /dev/null +++ b/build.zig @@ -0,0 +1,29 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) void { + const upstream = b.dependency("spdlog", .{}); + const lib = b.addStaticLibrary(.{ + .name = "spdlog", + .target = b.standardTargetOptions(.{}), + .optimize = b.standardOptimizeOption(.{}), + }); + lib.linkLibCpp(); + lib.addIncludePath(upstream.path("include")); + lib.addCSourceFiles(.{ + .root = upstream.path("src"), + .files = &.{ + "async.cpp", + "bundled_fmtlib_format.cpp", + "cfg.cpp", + "color_sinks.cpp", + "file_sinks.cpp", + "spdlog.cpp", + "stdout_sinks.cpp", + }, + .flags = &.{ + "-DSPDLOG_COMPILED_LIB", + }, + }); + lib.installHeadersDirectory(upstream.path("include/spdlog"), "spdlog", .{}); + b.installArtifact(lib); +} diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 0000000..749d032 --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,18 @@ +.{ + .name = .spdlog, + .version = "1.15.1", + .minimum_zig_version = "0.14.0", + .fingerprint = 0x19cef80094ea6f4, + .dependencies = .{ + .spdlog = .{ + .url = "https://github.com/gabime/spdlog/archive/refs/tags/v1.15.1.tar.gz", + .hash = "N-V-__8AACsfEgCkfDtpMeuVL-wCnzLvznKU7UuYFhH2Daz8", + }, + }, + .paths = .{ + "LICENSE", + "README.md", + "build.zig", + "build.zig.zon", + }, +}