-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
87 lines (77 loc) · 3.01 KB
/
Copy pathbuild.zig
File metadata and controls
87 lines (77 loc) · 3.01 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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const upstream = b.dependency("upstream", .{});
const mod = b.addModule("screen_capture_lite", .{
.target = target,
.optimize = optimize,
.link_libc = true,
.link_libcpp = true,
});
const lib = b.addLibrary(.{
.name = "screen_capture_lite",
.linkage = .static,
.root_module = mod,
});
lib.installHeader(upstream.path("include/ScreenCapture_C_API.h"), "ScreenCapture_C_API.h");
b.installArtifact(lib);
mod.addIncludePath(upstream.path("include"));
mod.addIncludePath(upstream.path("include/internal"));
mod.addCSourceFiles(.{
.root = upstream.path("src_cpp"),
.files = &.{
"ScreenCapture.c",
"ScreenCapture.cpp",
"SCCommon.cpp",
"ThreadManager.cpp",
},
});
switch (target.result.os.tag) {
else => {},
.linux => {
mod.addIncludePath(upstream.path("include/linux"));
mod.addCSourceFiles(.{
.root = upstream.path("src_cpp/linux"),
.files = &.{
"X11MouseProcessor.cpp",
"X11FrameProcessor.cpp",
"GetMonitors.cpp",
"GetWindows.cpp",
"ThreadRunner.cpp",
},
});
const x11_headers = b.lazyDependency("x11-headers", .{}) orelse return;
mod.addIncludePath(x11_headers.path("."));
const unix_headers = b.lazyDependency("wio-unix-headers", .{}) orelse return;
mod.addIncludePath(unix_headers.path("include"));
mod.linkSystemLibrary("X11", .{});
mod.linkSystemLibrary("Xinerama", .{});
mod.linkSystemLibrary("Xi", .{});
mod.linkSystemLibrary("Xfixes", .{});
mod.linkSystemLibrary("Xext", .{});
// mod.linkSystemLibrary("Xrandr", .{});
// mod.linkSystemLibrary("Xcursor", .{});
},
}
const test_exe = b.addExecutable(.{
.name = "test",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
});
test_exe.root_module.addIncludePath(upstream.path("include"));
// test_exe.root_module.addIncludePath(upstream.path("include/internal"));
test_exe.root_module.addCSourceFile(.{
.file = upstream.path("Example_CPP/Screen_Capture_Example.cpp"),
});
test_exe.root_module.linkLibrary(lib);
// test_exe.root_module.linkSystemLibrary("X11", .{});
// test_exe.root_module.linkSystemLibrary("Xinerama", .{});
// test_exe.root_module.linkSystemLibrary("Xi", .{});
// test_exe.root_module.linkSystemLibrary("Xfixes", .{});
// test_exe.root_module.linkSystemLibrary("Xtst", .{});
const test_step = b.step("test", "build test program");
test_step.dependOn(&b.addRunArtifact(test_exe).step);
}