diff options
Diffstat (limited to 'private/build.zig')
| -rw-r--r-- | private/build.zig | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/private/build.zig b/private/build.zig new file mode 100644 index 0000000..eae283b --- /dev/null +++ b/private/build.zig @@ -0,0 +1,40 @@ +const z = @import( "std" ); + +var b: *z.Build = undefined; +var target: z.Build.ResolvedTarget = undefined; +var optimize: z.builtin.OptimizeMode = undefined; + +fn import( name: []const u8 ) z.Build.Module.Import { + const i = b.dependency( name, .{ .target = target, .optimize = optimize } ); + return .{ .name = name, .module = i.module( name ) }; +} + +pub fn build( _b: *z.Build ) void { + b = _b; + target = b.standardTargetOptions( .{} ); + optimize = b.standardOptimizeOption( .{} ); + + const exe = b.addExecutable( .{ + .name = "moneyboard-backend", + .root_module = b.createModule( .{ + .root_source_file = b.path( "src/main.zig" ), + .target = target, + .optimize = optimize, + .imports = &.{ + import( "sqlite" ), + }, + } ), + } ); + + b.installArtifact( exe ); + + const run_step = b.step( "run", "Run the app" ); + const run_cmd = b.addRunArtifact( exe ); + run_step.dependOn( &run_cmd.step ); + + run_cmd.step.dependOn( b.getInstallStep() ); + + if( b.args ) |args| { + run_cmd.addArgs( args ); + } +} |
