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:
52
build.zig
52
build.zig
@ -430,20 +430,48 @@ 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) {
|
||||||
const lib = b.addSharedLibrary(.{
|
// Shared
|
||||||
.name = "ghostty",
|
{
|
||||||
.root_source_file = .{ .path = "src/main_c.zig" },
|
const lib = b.addSharedLibrary(.{
|
||||||
.optimize = optimize,
|
.name = "ghostty",
|
||||||
.target = target,
|
.root_source_file = .{ .path = "src/main_c.zig" },
|
||||||
});
|
.optimize = optimize,
|
||||||
lib.root_module.addOptions("build_options", exe_options);
|
.target = target,
|
||||||
_ = try addDeps(b, lib, config);
|
});
|
||||||
|
lib.root_module.addOptions("build_options", exe_options);
|
||||||
|
_ = try addDeps(b, lib, config);
|
||||||
|
|
||||||
const lib_install = b.addInstallLibFile(
|
const lib_install = b.addInstallLibFile(
|
||||||
lib.getEmittedBin(),
|
lib.getEmittedBin(),
|
||||||
"libghostty.so",
|
"libghostty.so",
|
||||||
|
);
|
||||||
|
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(&lib_install.step);
|
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.
|
||||||
|
Reference in New Issue
Block a user