-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.zig
80 lines (57 loc) · 2.53 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
72
73
74
75
76
77
78
79
80
const std = @import("std");
const pkgs = @import(".zpm/pkgs.zig");
const Sdk = @import("Sdk.zig");
const ZigServe = @import("vendor/serve/build.zig");
pub fn build(b: *std.build.Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const backend = b.option(Sdk.Backend, "backend", "Configures the backend that should be used for webview.");
const wolfssl = ZigServe.createWolfSSL(b, target);
const minimal_exe = b.addExecutable("positron-minimal", "example/minimal.zig");
minimal_exe.setTarget(target);
minimal_exe.setBuildMode(mode);
minimal_exe.linkLibrary(wolfssl);
minimal_exe.addIncludePath("vendor/serve/vendor/wolfssl");
minimal_exe.addPackage(Sdk.getPackage("positron"));
Sdk.linkPositron(minimal_exe, null);
minimal_exe.install();
const exe = b.addExecutable("positron-demo", "example/main.zig");
exe.linkLibrary(wolfssl);
exe.addIncludePath("vendor/serve/vendor/wolfssl");
exe.setTarget(target);
exe.setBuildMode(mode);
Sdk.linkPositron(exe, backend);
exe.addPackage(Sdk.getPackage("positron"));
exe.install();
const positron_test = b.addTest("src/positron.zig");
Sdk.linkPositron(positron_test, null);
positron_test.addPackage(Sdk.getPackage("positron"));
const test_step = b.step("test", "Runs the test suite");
test_step.dependOn(&positron_test.step);
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
// const demo = b.addExecutable("webview-demo", null);
// // make webview library standalone
// demo.addCSourceFile("src/minimal.cpp", &[_][]const u8{
// "-std=c++17",
// "-fno-sanitize=undefined",
// });
// demo.linkLibC();
// demo.linkSystemLibrary("c++");
// demo.install();
// demo.addIncludeDir("vendor/Microsoft.Web.WebView2.1.0.902.49/build/native/include");
// demo.addLibPath("vendor/Microsoft.Web.WebView2.1.0.902.49/build/native/x64");
// demo.linkSystemLibrary("user32");
// demo.linkSystemLibrary("ole32");
// demo.linkSystemLibrary("oleaut32");
// demo.addObjectFile("vendor/Microsoft.Web.WebView2.1.0.902.49/build/native/x64/WebView2Loader.dll.lib");
// const exec = demo.run();
// exec.step.dependOn(b.getInstallStep());
// const demo_run_step = b.step("run.demo", "Run the app");
// demo_run_step.dependOn(&exec.step);
}