forked from 00JCIV00/cova
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
72 lines (61 loc) · 2.4 KB
/
build.zig
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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
//const build_options = b.addOptions();
const bin_name = b.option([]const u8, "name", "A name for the binary being created.");
b.exe_dir = "./bin";
// Static Lib (Unused)
//const lib = b.addStaticLibrary(.{
// .name = "cova",
// .root_source_file = .{ .path = "src/cova.zig" },
// .target = target,
// .optimize = optimize,
//});
//b.installArtifact(lib);
// Tests
const cova_tests = b.addTest(.{
.root_source_file = .{ .path = "src/cova.zig" },
.target = target,
.optimize = optimize,
});
const run_cova_tests = b.addRunArtifact(cova_tests);
const test_step = b.step("test", "Run cova library tests");
test_step.dependOn(&run_cova_tests.step);
// Docs
const cova_docs = cova_tests;
const build_docs = b.addInstallDirectory(.{
.source_dir = cova_docs.getEmittedDocs(),
.install_dir = .prefix,
.install_subdir = "../docs",
});
const build_docs_step = b.step("docs", "Build the cova library docs");
build_docs_step.dependOn(&build_docs.step);
// Lib Module
const cova_mod = b.addModule("cova", .{
.root_source_file = .{ .path = "src/cova.zig" },
});
// Cova Demo Exe
const cova_demo = b.addExecutable(.{
.name = bin_name orelse "covademo",
.root_source_file = .{ .path = "examples/covademo.zig" },
.target = target,
.optimize = optimize,
});
cova_demo.root_module.addImport("cova", cova_mod);
// - Build Exe
const build_cova_demo = b.addInstallArtifact(cova_demo, .{});
const build_cova_demo_step = b.step("cova-demo", "Build the 'covademo' example (default: Debug)");
build_cova_demo_step.dependOn(&build_cova_demo.step);
// Basic App Exe
const basic_app = b.addExecutable(.{
.name = bin_name orelse "basic-app",
.root_source_file = .{ .path = "examples/basic_app.zig" },
.target = target,
.optimize = optimize,
});
basic_app.root_module.addImport("cova", cova_mod);
const build_basic_app = b.addInstallArtifact(basic_app, .{});
const build_basic_app_step = b.step("basic-app", "Build the 'basic-app' example (default: Debug)");
build_basic_app_step.dependOn(&build_basic_app.step);
}