Skip to content

Commit 286ff82

Browse files
committed
feat(build): add enable-webui-log build option
- introduce enable-webui-log option to control WebUI log output - update addLinkerFlags to accept enable_webui_log parameter - conditionally define WEBUI_LOG macro based on debug and enable_webui_log
1 parent d687b24 commit 286ff82

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

build.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub fn build(b: *Build) !void {
2323

2424
const is_dynamic = b.option(bool, "dynamic", "build the dynamic library") orelse false;
2525
const enable_tls = b.option(bool, "enable-tls", "enable TLS support") orelse false;
26+
const enable_webui_log = b.option(bool, "enable-webui-log", "Enable WebUI log output") orelse false;
2627
const verbose = b.option(std.log.Level, "verbose", "set verbose output") orelse .warn;
2728
global_log_level = verbose;
2829
// TODO: Support list of dependencies once support is limited to >0.13.0
@@ -52,7 +53,7 @@ pub fn build(b: *Build) !void {
5253
.target = target,
5354
.optimize = optimize,
5455
});
55-
try addLinkerFlags(b, webui, enable_tls, debug_dependencies);
56+
try addLinkerFlags(b, webui, enable_tls, debug_dependencies, enable_webui_log);
5657

5758
b.installArtifact(webui);
5859

@@ -64,6 +65,7 @@ fn addLinkerFlags(
6465
webui: *Compile,
6566
enable_tls: bool,
6667
debug_dependencies: DebugDependencies,
68+
enable_webui_log: bool,
6769
) !void {
6870
const webui_target = webui.rootModuleTarget();
6971
const is_windows = webui_target.os.tag == .windows;
@@ -80,7 +82,7 @@ fn addLinkerFlags(
8082
"-Wno-error=date-time",
8183
};
8284

83-
if (debug) {
85+
if (debug and enable_webui_log) {
8486
webui.root_module.addCMacro("WEBUI_LOG", "");
8587
}
8688
webui.addCSourceFile(.{

0 commit comments

Comments
 (0)