commit 5ae1bffab77060bed9d92076435963aade876157 Author: Madeorsk Date: Sun Dec 8 21:38:51 2024 +0100 Project setup. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2ae369 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# IDEA +*.iml + +# Zig +zig-out/ +.zig-cache/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..329c780 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# pgzql + +PostgreSQL async driver using Tardy runtime. diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..b6d48db --- /dev/null +++ b/build.zig @@ -0,0 +1,33 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + // Initialize pgzql module. + const pgzql = b.addModule("pgzql", .{ + .root_source_file = b.path("src/root.zig"), + .target = target, + .optimize = optimize, + }); + + // Add tardy library. + const tardy = b.dependency("tardy", .{ + .target = target, + .optimize = optimize, + }); + pgzql.addImport("tardy", tardy.module("tardy")); + + const lib_unit_tests = b.addTest(.{ + .root_source_file = b.path("src/root.zig"), + .target = target, + .optimize = optimize, + }); + lib_unit_tests.root_module.addImport("pgzql", pgzql); + lib_unit_tests.root_module.addImport("tardy", tardy.module("tardy")); + const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests); + run_lib_unit_tests.has_side_effects = true; + + const test_step = b.step("test", "Run unit tests"); + test_step.dependOn(&run_lib_unit_tests.step); +} diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 0000000..456ced1 --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,18 @@ +.{ + .name = "pgzql", + .version = "0.1.0", + + .dependencies = .{ + .tardy = .{ + .url = "git+https://github.com/mookums/tardy?ref=v0.1.0#ae0970d6b3fa5b03625b14e142c664efe1fd7789", + .hash = "12207f5afee3b8933c1c32737e8feedc80a2e4feebe058739509094c812e4a8d2cc8", + }, + }, + + .paths = .{ + "build.zig", + "build.zig.zon", + "src", + "README.md", + }, +} diff --git a/src/root.zig b/src/root.zig new file mode 100644 index 0000000..95a0b68 --- /dev/null +++ b/src/root.zig @@ -0,0 +1 @@ +const std = @import("std");