Skip to content

Commit

Permalink
build: Use ConfigHeader to generate config_types.h
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Gutekanst <[email protected]>
  • Loading branch information
slimsag committed Oct 18, 2023
1 parent e0aa268 commit a55253b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
29 changes: 28 additions & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,42 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

const config_header = b.addConfigHeader(
.{
.style = .{ .cmake = .{ .path = "include/ogg/config_types.h.in" } },
.include_path = "ogg/config_types.h",
},
.{
.INCLUDE_INTTYPES_H = 0,
.INCLUDE_STDINT_H = 1,
.INCLUDE_SYS_TYPES_H = 0,
.SIZE16 = .int16_t,
.USIZE16 = .uint16_t,
.SIZE32 = .int32_t,
.USIZE32 = .uint32_t,
.SIZE64 = .int64_t,
.USIZE64 = .uint64_t,
},
);

const lib = b.addStaticLibrary(.{
.name = "ogg",
.target = target,
.optimize = optimize,
});
lib.linkLibC();
lib.addConfigHeader(config_header);
lib.addIncludePath(.{ .path = "include" });
lib.addCSourceFiles(.{ .files = &sources, .flags = &.{"-fno-sanitize=undefined"} });
lib.installHeadersDirectory("include/ogg", "ogg");
lib.installHeadersDirectoryOptions(.{
.source_dir = .{ .path = "include/ogg" },
.install_dir = .header,
.install_subdir = "ogg",
.exclude_extensions = &.{".in"},
});
lib.installConfigHeader(config_header, .{
.dest_rel_path = "ogg/config_types.h",
});
b.installArtifact(lib);
}

Expand Down
26 changes: 0 additions & 26 deletions include/ogg/config_types.h

This file was deleted.

1 change: 0 additions & 1 deletion verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ git diff $(git merge-base master upstream/master)..master \
':(exclude)verify.sh' \
':(exclude).github' \
':(exclude).gitignore'
':(exclude)include/ogg/config_types.h' # TODO: remove this

0 comments on commit a55253b

Please sign in to comment.