Is there way to tell zig, code should only specific builds, say i only want something in a dedug build, or a windows build
Say this function here, on a release build this would call the log function, but will the call still be there or is optimise out completely.
I can not make the if comptime if as log function prints to console and does file io, so can not be called at comptine it self
pub fn trace(comptime message: []const u8, args: anytype) void {
if (debugBuild) {
log(LogLevel.TRACE, message, args);
}
}
For platform I am guessing if i do something like this, only one file is being imported, there for only on of them is being built as this should run at comptime
const platformType = switch (builtin.os.tag) {
.linux => @import("linux.zig").PlatformLinux,
.windows => @import("windows.zig").PlatformWindow,
.macos => @import("glfw.zig").PlatformGLFW,
else => @compileError("Unsupported platform"),
};