Skip to content

Commit

Permalink
feat: update port template
Browse files Browse the repository at this point in the history
  • Loading branch information
tensorush committed Jul 19, 2024
1 parent 444b2eb commit 94b52ef
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/templates/prt/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,27 @@ pub fn build(b: *std.Build) void {
.version = version,
.optimize = optimize,
});
lib.root_module.addCMacro("VERSION", b.fmt("\"{}\"", .{version}));
lib.addCSourceFiles(.{ .root = ?r_path, .files = &SOURCES, .flags = &FLAGS });
lib.installHeadersDirectory(?r_path, "", .{ .include_extensions = &HEADERS });
lib.addConfigHeader(b.addConfigHeader(.{
.style = .{ .autoconf = b.path("config/config.h.in") },
.include_path = "config/config.h",
.style = .{ .cmake = ?r_path.path(b, "config.h.cmake.in") },
.include_path = "config.h",
}, VALUES));
if (use_z) {
lib.linkSystemLibrary("z");
}
// lib.linkFramework("CoreFoundation");
// lib.linkLibCpp();
// lib.linkLibC();

if (use_z) {
lib.root_module.addCMacro("HAVE_Z", "1");
lib.linkSystemLibrary("z");
}

const lib_install = b.addInstallArtifact(lib, .{});
lib_step.dependOn(&lib_install.step);
b.default_step.dependOn(lib_step);

// Bindings
// Bindings module
const bindings_mod = b.addModule("?r", .{
.target = target,
.optimize = optimize,
Expand Down Expand Up @@ -73,6 +76,7 @@ pub fn build(b: *std.Build) void {

const fmt = b.addFmt(.{
.paths = &.{
"src/",
"build.zig",
},
.check = true,
Expand Down
7 changes: 7 additions & 0 deletions src/templates/prt/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
.name = "?r",
.version = "?v",
.minimum_zig_version = "0.13.0",
.dependencies = .{
.?r = .{
.url = "",
.hash = "",
},
},
.paths = .{
"src/",
"build.zig",
"build.zig.zon",
"LICENSE",
Expand Down

0 comments on commit 94b52ef

Please sign in to comment.