-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
92 lines (83 loc) · 2.55 KB
/
build.zig
File metadata and controls
92 lines (83 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
const std = @import("std");
const fetch_archive = @import("fetch-archive/Archive.zig");
const git_repo = @import("git-repo/GitRepo.zig");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const clap_dep = b.dependency("clap", .{});
const mbedz_module = b.createModule(.{
.root_source_file = b.path("mbedz/main.zig"),
.target = target,
.optimize = optimize,
});
mbedz_module.addImport("clap", clap_dep.module("clap"));
const mbedz = b.addExecutable(.{
.name = "mbedz",
.root_module = mbedz_module,
});
b.installArtifact(mbedz);
const run_cmd = b.addRunArtifact(mbedz);
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run mbedz");
run_step.dependOn(&run_cmd.step);
}
pub const Archive = fetch_archive.Archive;
pub const GitCheckout = git_repo.Repo;
pub fn addFetchArchive(
b: *std.Build,
opts: struct {
url: []const u8,
version_key: []const u8,
cache_namespace: []const u8 = "opus-upstream",
step_name: []const u8 = "opus.fetch-archive.ensure",
},
) fetch_archive.Archive {
return fetch_archive.addArchiveZig(b, .{
.url = opts.url,
.version_key = opts.version_key,
.cache_namespace = opts.cache_namespace,
.step_name = opts.step_name,
});
}
pub fn addGitRepo(
b: *std.Build,
opts: struct {
remote_url: []const u8,
revision: []const u8,
cache_namespace: []const u8 = "opus-upstream",
step_name: []const u8 = "opus.git-repo.ensure",
},
) git_repo.Repo {
return git_repo.addRepoZig(b, .{
.remote_url = opts.remote_url,
.revision = opts.revision,
.cache_namespace = opts.cache_namespace,
.step_name = opts.step_name,
});
}
/// Deprecated name; use `addFetchArchive`.
pub fn addCodeArchive(
b: *std.Build,
opts: struct {
url: []const u8,
version_key: []const u8,
cache_namespace: []const u8 = "opus-upstream",
step_name: []const u8 = "opus.fetch-archive.ensure",
},
) fetch_archive.Archive {
return addFetchArchive(b, opts);
}
/// Deprecated name; use `addFetchArchive`.
pub fn addCodeloadArchive(
b: *std.Build,
opts: struct {
url: []const u8,
version_key: []const u8,
cache_namespace: []const u8 = "opus-upstream",
step_name: []const u8 = "opus.fetch-archive.ensure",
},
) fetch_archive.Archive {
return addFetchArchive(b, opts);
}