1
Fork 0
blog-zig-postgres/build.zig
Leonardo Devai 0c0079056b Add the devai.io boilerplate library: 42 runnable projects
21 bite-sized beginner tutorials (Web Basics, APIs & Data), the 8-backend blog
engine series, 4 blog frontends, 2 React starters, 3 NixOS desktops and 4 Rust
API/pipeline boilerplates. Every folder is a complete, self-contained project
with its own README.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VGNxPf9PrSG2kzrxSvn45Y
2026-07-19 16:31:48 +02:00

28 lines
984 B
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const pg = b.dependency("pg", .{ .target = target, .optimize = optimize });
const mod = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "pg", .module = pg.module("pg") },
},
});
// Makes `@embedFile("schema.sql")` work from src/ even though the file
// lives at the repository root.
mod.addAnonymousImport("schema.sql", .{ .root_source_file = b.path("schema.sql") });
const exe = b.addExecutable(.{ .name = "blog", .root_module = mod });
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("run", "Run the blog server");
run_step.dependOn(&run_cmd.step);
}