build: copy header files, build static lib too

This commit is contained in:
Mitchell Hashimoto
2024-01-18 08:59:07 -08:00
parent 01afa293c8
commit d1ad8e4740

View File

@ -430,6 +430,8 @@ pub fn build(b: *std.Build) !void {
// libghostty (non-Darwin)
if (!builtin.target.isDarwin() and config.app_runtime == .none) {
// Shared
{
const lib = b.addSharedLibrary(.{
.name = "ghostty",
.root_source_file = .{ .path = "src/main_c.zig" },
@ -446,6 +448,32 @@ pub fn build(b: *std.Build) !void {
b.getInstallStep().dependOn(&lib_install.step);
}
// Static
{
const lib = b.addStaticLibrary(.{
.name = "ghostty",
.root_source_file = .{ .path = "src/main_c.zig" },
.optimize = optimize,
.target = target,
});
lib.root_module.addOptions("build_options", exe_options);
_ = try addDeps(b, lib, config);
const lib_install = b.addInstallLibFile(
lib.getEmittedBin(),
"libghostty.a",
);
b.getInstallStep().dependOn(&lib_install.step);
}
// Copy our ghostty.h to include.
const header_install = b.addInstallHeaderFile(
"include/ghostty.h",
"ghostty.h",
);
b.getInstallStep().dependOn(&header_install.step);
}
// On Mac we can build the embedding library. This only handles the macOS lib.
if (builtin.target.isDarwin() and target.result.os.tag == .macos) {
// Create the universal macOS lib.