aboutsummaryrefslogtreecommitdiff
path: root/test/standalone/config_header/build.zig
blob: 3432685fceda6381ef84cb0e801a368ad2d2fbbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const std = @import("std");

pub fn build(b: *std.Build) void {
    const config_header = b.addConfigHeader(
        .{ .style = .{ .autoconf_undef = b.path("config.h.in") } },
        .{
            .SOME_NO = null,
            .SOME_TRUE = true,
            .SOME_FALSE = false,
            .SOME_ZERO = 0,
            .SOME_ONE = 1,
            .SOME_TEN = 10,
            .SOME_ENUM = @as(enum { foo, bar }, .foo),
            .SOME_ENUM_LITERAL = .@"test",
            .SOME_STRING = "test",

            .PREFIX_SPACE = null,
            .PREFIX_TAB = null,
            .POSTFIX_SPACE = null,
            .POSTFIX_TAB = null,
        },
    );

    const check_config_header = b.addCheckFile(config_header.getOutput(), .{ .expected_exact = @embedFile("config.h") });

    const test_step = b.step("test", "Test it");
    test_step.dependOn(&check_config_header.step);
}