-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.zig
More file actions
26 lines (20 loc) · 766 Bytes
/
build.zig
File metadata and controls
26 lines (20 loc) · 766 Bytes
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
const std = @import("std");
const cflags = &.{"-fno-sanitize=undefined"};
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const exe = b.addExecutable(.{
.name = "zig_with_cpp",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.link_libc = true,
.link_libcpp = true,
}),
});
exe.root_module.addIncludePath(b.path("cpp-code"));
exe.root_module.addCSourceFile(.{ .file = b.path("cpp-code/codecpp.cpp"), .flags = cflags });
const run_exe = b.addRunArtifact(exe);
const run_step = b.step("run", "Run the application");
run_step.dependOn(&run_exe.step);
b.installArtifact(exe);
}