@@ -20,27 +20,31 @@ comptime {
2020const log = std .log .scoped (.WebUI );
2121const default_isStatic = true ;
2222const default_enableTLS = false ;
23+ const default_enableWebUILog = false ;
2324
2425pub fn build (b : * Build ) ! void {
25- const isStatic = b .option (bool , "is_static" , "whether lib is static" ) orelse default_isStatic ;
26- const enableTLS = b .option (bool , "enable_tls" , "whether lib enable tls" ) orelse default_enableTLS ;
27- const enableWebUILog = b .option (bool , "enable_webui_log" , "whether lib enable tls" ) orelse default_enableTLS ;
28-
2926 const target = b .standardTargetOptions (.{});
3027 const optimize = b .standardOptimizeOption (.{});
3128
32- // TLS does not support cross compilation
29+ const isStatic = b .option (bool , "is_static" , "whether lib is static" ) orelse default_isStatic ;
30+ const enableTLS = b .option (bool , "enable_tls" , "whether lib enable tls" ) orelse default_enableTLS ;
31+ const enableWebUILog = b .option (bool , "enable_webui_log" , "whether lib enable webui log" ) orelse default_enableWebUILog ;
32+
3333 if (enableTLS ) {
3434 log .info ("enable TLS support" , .{});
35- if (! target .query .isNative ()) {
36- log .info ("when enable tls, not support cross compile" , .{});
37- std .process .exit (1 );
38- }
35+ }
36+
37+ // TLS does not support cross compilation
38+ if (enableTLS and ! target .query .isNative ()) {
39+ log .err ("TLS support is only available for native builds" , .{});
40+ std .process .exit (1 );
3941 }
4042
4143 const flags_options = b .addOptions ();
4244 flags_options .addOption (bool , "enableTLS" , enableTLS );
45+
4346 const flags_module = flags_options .createModule ();
47+
4448 const webui = b .dependency ("webui" , .{
4549 .target = target ,
4650 .optimize = optimize ,
@@ -51,12 +55,10 @@ pub fn build(b: *Build) !void {
5155 });
5256 const webui_module = b .addModule ("webui" , .{
5357 .root_source_file = b .path (b .pathJoin (&.{ "src" , "webui.zig" })),
54- .imports = &.{
55- .{
56- .name = "flags" ,
57- .module = flags_module ,
58- },
59- },
58+ .imports = &.{ .{
59+ .name = "flags" ,
60+ .module = flags_module ,
61+ } },
6062 });
6163 webui_module .linkLibrary (webui .artifact ("webui" ));
6264 if (! isStatic ) {
0 commit comments