init project

This commit is contained in:
邵静 2024-07-02 15:52:01 +08:00
commit ceaa6e3b1a
4 changed files with 47 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
zig-cache/*
zig-out/*

29
build.zig Normal file
View File

@ -0,0 +1,29 @@
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "nation",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
// command itself, like this: `zig build run -- arg1 arg2 etc`
if (b.args) |args| {
run_cmd.addArgs(args);
}
// This creates a build step. It will be visible in the `zig build --help` menu,
// and can be selected like this: `zig build run`
// This will evaluate the `run` step rather than the default, which is "install".
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
}

10
build.zig.zon Normal file
View File

@ -0,0 +1,10 @@
.{
.name = "nation",
.version = "0.0.0",
.dependencies = .{},
.paths = .{
"",
},
}

6
src/main.zig Normal file
View File

@ -0,0 +1,6 @@
const std = @import("std");
const log = std.log;
pub fn main() !void {
log.info("Hello, {s}\n", .{"World!"});
}