mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-06 07:38:21 +00:00
build: test that ghostty.h compiles during a normal zig build test
This commit is contained in:
22
build.zig
22
build.zig
@@ -54,6 +54,10 @@ pub fn build(b: *std.Build) !void {
|
||||
"update-translations",
|
||||
"Update translation files",
|
||||
);
|
||||
const test_include_ghostty_h_step = b.step(
|
||||
"test-include-ghostty-h",
|
||||
"Test include of ghostty.h",
|
||||
);
|
||||
|
||||
// Ghostty resources like terminfo, shell integration, themes, etc.
|
||||
const resources = try buildpkg.GhosttyResources.init(b, &config, &deps);
|
||||
@@ -298,6 +302,24 @@ pub fn build(b: *std.Build) !void {
|
||||
// Normal tests always test our libghostty modules
|
||||
//test_step.dependOn(test_lib_vt_step);
|
||||
|
||||
const test_include_ghostty_h_exe = b.addTest(.{
|
||||
.name = "ghostty-include-ghostty-h",
|
||||
.filters = test_filters,
|
||||
.root_module = b.createModule(.{
|
||||
.root_source_file = b.path("include/test.zig"),
|
||||
.target = config.baselineTarget(),
|
||||
.optimize = .Debug,
|
||||
.strip = false,
|
||||
.omit_frame_pointer = false,
|
||||
.unwind_tables = .sync,
|
||||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
test_include_ghostty_h_exe.addIncludePath(b.path("include"));
|
||||
const test_include_ghostty_h_run = b.addRunArtifact(test_include_ghostty_h_exe);
|
||||
test_include_ghostty_h_step.dependOn(&test_include_ghostty_h_run.step);
|
||||
test_step.dependOn(test_include_ghostty_h_step);
|
||||
|
||||
// Valgrind test running
|
||||
const valgrind_run = b.addSystemCommand(&.{
|
||||
"valgrind",
|
||||
|
||||
5
include/test.zig
Normal file
5
include/test.zig
Normal file
@@ -0,0 +1,5 @@
|
||||
test "ghostty_h" {
|
||||
_ = @cImport({
|
||||
@cInclude("ghostty.h");
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user