add app runtime option, add gtk backend

This commit is contained in:
Mitchell Hashimoto
2023-02-20 15:13:06 -08:00
parent 35cb9d20b1
commit 48c9c65915
7 changed files with 128 additions and 18 deletions

View File

@@ -1,5 +1,6 @@
const std = @import("std");
const builtin = @import("builtin");
const build_config = @import("build_config.zig");
const options = @import("build_options");
const glfw = @import("glfw");
const macos = @import("macos");
@@ -88,12 +89,19 @@ pub fn main() !void {
try config.finalize();
std.log.debug("config={}", .{config});
// We want to log all our errors
glfw.setErrorCallback(glfwErrorCallback);
switch (build_config.app_runtime) {
.none => {},
.glfw => {
// We want to log all our errors
glfw.setErrorCallback(glfwErrorCallback);
},
.gtk => {},
}
// Run our app with a single initial window to start.
var app = try App.create(alloc, .{}, &config);
defer app.destroy();
if (build_config.app_runtime == .gtk) return;
_ = try app.newWindow(.{});
try app.run();
}