mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
build: copy header files, build static lib too
This commit is contained in:
28
build.zig
28
build.zig
@ -430,6 +430,8 @@ pub fn build(b: *std.Build) !void {
|
|||||||
|
|
||||||
// libghostty (non-Darwin)
|
// libghostty (non-Darwin)
|
||||||
if (!builtin.target.isDarwin() and config.app_runtime == .none) {
|
if (!builtin.target.isDarwin() and config.app_runtime == .none) {
|
||||||
|
// Shared
|
||||||
|
{
|
||||||
const lib = b.addSharedLibrary(.{
|
const lib = b.addSharedLibrary(.{
|
||||||
.name = "ghostty",
|
.name = "ghostty",
|
||||||
.root_source_file = .{ .path = "src/main_c.zig" },
|
.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);
|
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.
|
// On Mac we can build the embedding library. This only handles the macOS lib.
|
||||||
if (builtin.target.isDarwin() and target.result.os.tag == .macos) {
|
if (builtin.target.isDarwin() and target.result.os.tag == .macos) {
|
||||||
// Create the universal macOS lib.
|
// Create the universal macOS lib.
|
||||||
|
Reference in New Issue
Block a user