ghostty/src/build_config.zig
Mitchell Hashimoto 7ccf86b175 remove imgui and devmode
imgui has been a source of compilation challenges (our fault not theirs)
and devmode hasn't worked in awhile, so drop it.
2023-08-20 08:50:24 -07:00

62 lines
1.8 KiB
Zig

//! Build options, available at comptime. Used to configure features. This
//! will reproduce some of the fields from builtin and build_options just
//! so we can limit the amount of imports we need AND give us the ability
//! to shim logic and values into them later.
const std = @import("std");
const builtin = @import("builtin");
const options = @import("build_options");
const assert = std.debug.assert;
const apprt = @import("apprt.zig");
const font = @import("font/main.zig");
/// The semantic version of this build.
pub const version = options.app_version;
pub const version_string = options.app_version_string;
/// The artifact we're producing. This can be used to determine if we're
/// building a standalone exe, an embedded lib, etc.
pub const artifact = Artifact.detect();
/// The runtime to back exe artifacts with.
pub const app_runtime: apprt.Runtime = switch (artifact) {
.lib => .none,
else => std.meta.stringToEnum(apprt.Runtime, @tagName(options.app_runtime)).?,
};
/// The font backend desired for the build.
pub const font_backend: font.Backend = std.meta.stringToEnum(
font.Backend,
@tagName(options.font_backend),
).?;
/// We want to integrate with Flatpak APIs.
pub const flatpak = options.flatpak;
pub const Artifact = enum {
/// Standalone executable
exe,
/// Embeddable library
lib,
/// The WASM-targeted module.
wasm_module,
pub fn detect() Artifact {
if (builtin.target.isWasm()) {
assert(builtin.output_mode == .Obj);
assert(builtin.link_mode == .Static);
return .wasm_module;
}
return switch (builtin.output_mode) {
.Exe => .exe,
.Lib => .lib,
else => {
@compileLog(builtin.output_mode);
@compileError("unsupported artifact output mode");
},
};
}
};