-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
55 lines (46 loc) · 1.49 KB
/
build.zig
File metadata and controls
55 lines (46 loc) · 1.49 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
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const mod = b.createModule(.{
.root_source_file = b.path("src/CompileFlags.zig"),
.target = target,
.optimize = optimize,
});
const lib = b.addLibrary(.{
.name = "compile_flagz",
.root_module = mod,
});
b.installArtifact(lib);
const docs = buildDocs(b, lib);
const docs_step = b.step("docs", "Generate documentation");
docs_step.dependOn(docs.step);
docs.step.dependOn(&lib.step);
}
fn buildDocs(
b: *Build,
lib: *Step.Compile,
) struct {
step: *Step,
} {
const install = b.addInstallDirectory(.{
.source_dir = lib.getEmittedDocs(),
.install_dir = .prefix,
.install_subdir = "docs",
});
return .{
.step = &install.step,
};
}
/// Create a new CompileFlags build step for generating compile_flags.txt files.
/// This is the main entry point for using the compile_flagz library.
/// The returned CompileFlags instance can be used to add include paths and
/// generate a compile_flags.txt file for C/C++ language server integration
/// when developing C/C++ code in projects that use Zig as their build system.
pub fn addCompileFlags(b: *Build) *CompileFlags {
return .init(b);
}
const std = @import("std");
const Build = std.Build;
const LazyPath = Build.LazyPath;
const Step = Build.Step;
const CompileFlags = @import("src/CompileFlags.zig");