summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/build.zig b/build.zig
index aeae7443..6734d9b0 100644
--- a/build.zig
+++ b/build.zig
@@ -104,6 +104,7 @@ pub fn build(b: *std.Build) void {
ninep_options.addOption(bool, "quic", enable_quic);
const enable_mupdf = b.option(bool, "mupdf", "native PDF rendering with MuPDF (AGPL/commercial; native default on, web/esp32p4 off; -Dmupdf=false disables)") orelse !freestanding_core;
const enable_jpx = b.option(bool, "jpx", "JPEG 2000 in PDFs, for scanned documents (default on; -Djpx=false drops openjpeg)") orelse true;
+ const embed_sources = b.option(bool, "embed-sources", "serve the editor's own sources under /src of its 9P tree (default off; on for -Dplatform=esp32p4, whose only source is the device)") orelse is_esp32p4;
const is_web_target = target.result.cpu.arch == .wasm32 and target.result.os.tag == .freestanding;
const is_esp32p4_target = target.result.cpu.arch == .riscv32 and target.result.os.tag == .freestanding;
const optimize = if (is_web)
@@ -309,6 +310,7 @@ pub fn build(b: *std.Build) void {
.esp32p4_rows = esp32p4_rows,
.theme_animation = theme_animation,
.prebuilt_shaders = prebuilt_shaders,
+ .embed_sources = embed_sources,
.zig_lib_dir = b.graph.zig_lib_directory.path orelse "",
.commit = gitCommit(b),
};
@@ -600,8 +602,6 @@ pub fn build(b: *std.Build) void {
if (shell == .macos) mod.addAnonymousImport("effect-source-crt.ci.metal", .{
.root_source_file = b.path("shaders/crt.ci.metal"),
});
- mod.addAnonymousImport("root-build.zig", .{ .root_source_file = b.path("build.zig") });
- mod.addAnonymousImport("root-build.zig.zon", .{ .root_source_file = b.path("build.zig.zon") });
}
const gui_shell_mod: ?*std.Build.Module = gui_mod orelse
@@ -1435,6 +1435,7 @@ const ShellConfig = struct {
/// the default is off for the board and on everywhere else.
theme_animation: ?bool,
prebuilt_shaders: bool,
+ embed_sources: bool,
zig_lib_dir: []const u8,
commit: ?[]const u8,
};
@@ -1456,6 +1457,7 @@ fn shellOptions(b: *std.Build, cfg: ShellConfig, platform: Platform) *std.Build.
// prevents Config/EffectCode from describing tty/macOS/web as "prebuilt".
o.addOption(bool, "gui_shader_sources_prebuilt", platform == .gui and cfg.prebuilt_shaders);
o.addOption([]const u8, "zls_version", if (cfg.zls_backend) zls_version else "none");
+ o.addOption(bool, "embed_sources", cfg.embed_sources);
o.addOption([]const u8, "version", zon.version);
// ...and the commit it was built from, when there is one. See `gitCommit`
// for why this is optional and why it is read at configure time.