Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Fix lib release
Browse files Browse the repository at this point in the history
  • Loading branch information
gatesn committed Mar 5, 2024
1 parent 0793608 commit a5002e7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,13 @@ pub fn build(b: *std.Build) void {
.version = version,
.root_source_file = .{ .path = "src/lib.zig" },
});
_ = lib.getEmittedH(); // Needed to trigger header generation
lib.bundle_compiler_rt = true;
lib.pie = true;
const lib_install = b.addInstallArtifact(lib, .{});

// Ideally we would use dlib.getEmittedH(), but https://github.com/ziglang/zig/issues/18497
_ = lib.getEmittedH(); // Needed to trigger header generation
const lib_header = b.addInstallFile(.{ .path = "zig-cache/fastlanez.h" }, "include/fastlanez.h");

const lib_step = b.step("lib", "Build static C library");
lib_step.dependOn(&lib_header.step);
lib_step.dependOn(&lib_install.step);
lib_header.step.dependOn(&lib.step);

// Dynamic Library
const dylib = b.addSharedLibrary(.{
Expand All @@ -61,8 +57,15 @@ pub fn build(b: *std.Build) void {
.version = version,
.root_source_file = .{ .path = "src/lib.zig" },
});
_ = lib.getEmittedH(); // Needed to trigger header generation
dylib.bundle_compiler_rt = true;
const dylib_install = b.addInstallArtifact(dylib, .{});
const dylib_header = b.addInstallFile(.{ .path = "zig-cache/fastlanez.h" }, "include/fastlanez.h");
dylib_header.step.dependOn(&dylib.step);

const lib_step = b.step("lib", "Build static C library");
lib_step.dependOn(&lib_header.step);
lib_step.dependOn(&lib_install.step);

const dylib_step = b.step("dylib", "Build dynamic C library");
dylib_step.dependOn(&lib_header.step);
Expand Down

0 comments on commit a5002e7

Please sign in to comment.