Something went wrong. Try again.
A SpaceTraders Agent
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120const std = @import("std");const Build = std.Build;
pub fn build(b: *Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{});
const known_folders = b.dependency("known_folders", .{}).module("known-folders"); const pretty = b.dependency("pretty", .{}).module("pretty"); const zqlite = b.dependency("zqlite", .{}).module("zqlite");
const sqlite3 = b.dependency("sqlite3", .{});
const mod_sqlite3 = b.createModule(.{ .target = target, .optimize = optimize, .link_libc = true, }); mod_sqlite3.addIncludePath(sqlite3.path("")); mod_sqlite3.addCSourceFile(.{ .file = sqlite3.path("sqlite3.c"), .flags = &[_][]const u8{ "-DSQLITE_DQS=0", "-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1", "-DSQLITE_USE_ALLOCA=1", "-DSQLITE_THREADSAFE=1", "-DSQLITE_TEMP_STORE=3", "-DSQLITE_ENABLE_API_ARMOR=1", "-DSQLITE_ENABLE_UNLOCK_NOTIFY", "-DSQLITE_DEFAULT_FILE_PERMISSIONS=0600", "-DSQLITE_OMIT_DECLTYPE=1", "-DSQLITE_OMIT_DEPRECATED=1", "-DSQLITE_OMIT_LOAD_EXTENSION=1", "-DSQLITE_OMIT_PROGRESS_CALLBACK=1", "-DSQLITE_OMIT_SHARED_CACHE", "-DSQLITE_OMIT_TRACE=1", "-DSQLITE_OMIT_UTF16=1", "-DHAVE_USLEEP=0", }, });
const libsqlite = b.addLibrary(.{ .name = "sqlite3", .linkage = .static, .root_module = mod_sqlite3, });
const meta = b.createModule(.{ .root_source_file = b.path("src/meta/root.zig"), .target = target, .optimize = optimize, });
const st = b.addModule("st", .{ .root_source_file = b.path("src/st/root.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "meta", .module = meta }, .{ .name = "pretty", .module = pretty }, }, });
const agent = b.addModule("agent", .{ .root_source_file = b.path("src/agent/root.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "known-folders", .module = known_folders }, .{ .name = "zqlite", .module = zqlite }, // Modules .{ .name = "st", .module = st }, .{ .name = "meta", .module = meta }, }, }); agent.linkLibrary(libsqlite);
const space = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .imports = &.{ .{ .name = "known-folders", .module = known_folders }, // Modules .{ .name = "st", .module = st }, .{ .name = "agent", .module = agent }, .{ .name = "meta", .module = meta }, .{ .name = "pretty", .module = pretty }, }, });
const exe = b.addExecutable(.{ .root_module = space, .name = "space", }); b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| run_cmd.addArgs(args);
const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step);
const test_step = b.step("test", "Run tests"); addTest(b, test_step, "meta", meta); addTest(b, test_step, "st", st); addTest(b, test_step, "agent", agent);}
fn addTest(b: *Build, step: *Build.Step, name: []const u8, root_module: *Build.Module) void { const t = b.addTest(.{ .name = name, .root_module = root_module, }); const run_test = b.addRunArtifact(t); step.dependOn(&run_test.step);}