sql-zig

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

build.zig (985B)


      1 const std = @import("std");
      2 
      3 pub fn build(b: *std.Build) void {
      4     const target = b.standardTargetOptions(.{});
      5     const optimize = b.standardOptimizeOption(.{});
      6 
      7     const lib = b.addStaticLibrary(.{
      8         .name = "sql",
      9         .root_source_file = .{ .path = "src/main.zig" },
     10         .target = target,
     11         .optimize = optimize,
     12     });
     13 
     14     b.installArtifact(lib);
     15 
     16     // for the package manager
     17     _ = b.addModule("sql", .{ .source_file = .{ .path = "src/main.zig" } });
     18 
     19     const main_tests = b.addTest(.{
     20         .root_source_file = .{ .path = "src/main.zig" },
     21         .target = target,
     22         .optimize = optimize,
     23     });
     24     main_tests.linkLibC();
     25     main_tests.linkSystemLibrary("libpq");
     26     main_tests.linkSystemLibrary("sqlite3");
     27     main_tests.addIncludePath(.{ .path = "/usr/include" });
     28 
     29     const run_main_tests = b.addRunArtifact(main_tests);
     30 
     31     const test_step = b.step("test", "Run library tests");
     32     test_step.dependOn(&run_main_tests.step);
     33 }