Skip to content

Commit 8329605

Browse files
committed
- Remove usingnamespace usage
- Update build.zig
1 parent be3d003 commit 8329605

File tree

4 files changed

+701
-642
lines changed

4 files changed

+701
-642
lines changed

build.zig

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ pub fn build(b: *std.Build) void {
5151
if (options.callstack > 0) {
5252
translate_c.defineCMacro("TRACY_USE_CALLSTACK", "");
5353
var callstack_buffer: [64]u8 = undefined;
54-
const callstack = std.fmt.bufPrintIntToSlice(&callstack_buffer, @as(u32, options.callstack), 10, .lower, .{});
55-
translate_c.defineCMacro("TRACY_CALLSTACK", callstack);
54+
const callstack_str_len = std.fmt.printInt(&callstack_buffer, @as(u32, options.callstack), 10, .lower, .{});
55+
translate_c.defineCMacro("TRACY_CALLSTACK", callstack_buffer[0..callstack_str_len]);
5656
}
5757

5858
const ztracy = b.addModule("root", .{
@@ -63,20 +63,19 @@ pub fn build(b: *std.Build) void {
6363
});
6464
ztracy.addImport("c", translate_c.createModule());
6565

66-
const tracy = if (options.shared) blk: {
67-
const lib = b.addSharedLibrary(.{
68-
.name = "tracy",
66+
const tracy = b.addLibrary(.{
67+
.name = "tracy",
68+
.linkage = if (options.shared) .dynamic else .static,
69+
.root_module = b.createModule(.{
6970
.target = target,
7071
.optimize = optimize,
71-
});
72-
lib.root_module.addCMacro("TRACY_EXPORTS", "");
73-
break :blk lib;
74-
} else b.addStaticLibrary(.{
75-
.name = "tracy",
76-
.target = target,
77-
.optimize = optimize,
72+
}),
7873
});
7974

75+
if (options.shared) {
76+
tracy.root_module.addCMacro("TRACY_EXPORTS", "");
77+
}
78+
8079
tracy.addIncludePath(b.path("libs/tracy/tracy"));
8180
tracy.addCSourceFile(.{
8281
.file = b.path("libs/tracy/TracyClient.cpp"),
@@ -115,9 +114,11 @@ pub fn build(b: *std.Build) void {
115114

116115
const tests = b.addTest(.{
117116
.name = "ztracy-tests",
118-
.root_source_file = b.path("src/ztracy.zig"),
119-
.target = target,
120-
.optimize = optimize,
117+
.root_module = b.createModule(.{
118+
.root_source_file = b.path("src/ztracy.zig"),
119+
.target = target,
120+
.optimize = optimize,
121+
}),
121122
});
122123
tests.linkLibrary(tracy);
123124
b.installArtifact(tests);

0 commit comments

Comments
 (0)