build: don't build bench by default

This commit is contained in:
Mitchell Hashimoto
2023-02-25 13:43:12 -08:00
parent 227f6eb4f1
commit 3dbb7e44bf

View File

@ -99,15 +99,21 @@ pub fn build(b: *std.build.Builder) !void {
const emit_test_exe = b.option( const emit_test_exe = b.option(
bool, bool,
"test-exe", "emit-test-exe",
"Build and install test executables with 'build'", "Build and install test executables with 'build'",
) orelse false; ) orelse false;
const emit_bench = b.option(
bool,
"emit-bench",
"Build and install the benchmark executables.",
) orelse false;
// We can use wasmtime to test wasm // We can use wasmtime to test wasm
b.enable_wasmtime = true; b.enable_wasmtime = true;
// Add our benchmarks // Add our benchmarks
try benchSteps(b, target, optimize); try benchSteps(b, target, optimize, emit_bench);
const exe = b.addExecutable(.{ const exe = b.addExecutable(.{
.name = "ghostty", .name = "ghostty",
@ -589,6 +595,7 @@ fn benchSteps(
b: *std.build.Builder, b: *std.build.Builder,
target: std.zig.CrossTarget, target: std.zig.CrossTarget,
optimize: std.builtin.Mode, optimize: std.builtin.Mode,
install: bool,
) !void { ) !void {
// Open the directory ./src/bench // Open the directory ./src/bench
const c_dir_path = (comptime root()) ++ "/src/bench"; const c_dir_path = (comptime root()) ++ "/src/bench";
@ -621,7 +628,7 @@ fn benchSteps(
.optimize = optimize, .optimize = optimize,
}); });
c_exe.setMainPkgPath("./src"); c_exe.setMainPkgPath("./src");
c_exe.install(); if (install) c_exe.install();
_ = try addDeps(b, c_exe, true); _ = try addDeps(b, c_exe, true);
} }
} }