summaryrefslogtreecommitdiff
path: root/vere/ext/natpmp/build.zig
blob: 2a44dee9ffa0060ee56470022428ef6fb0ff688d (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
29
30
31
32
33
34
35
36
37
const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const lib = b.addStaticLibrary(.{
        .name = "natpmp",
        .target = target,
        .optimize = optimize,
    });

    const dep_c = b.dependency("natpmp", .{
        .target = target,
        .optimize = optimize,
    });

    lib.addIncludePath(dep_c.path("include"));

    lib.addCSourceFiles(.{
        .root = dep_c.path(""),
        .files = &.{
            "natpmp.c",
            "getgateway.c",
        },
        .flags = &.{
            "-fno-sanitize=all",
        },
    });

    lib.installHeader(dep_c.path("natpmp.h"), "natpmp.h");
    lib.installHeader(dep_c.path("getgateway.h"), "getgateway.h");
    lib.installHeader(dep_c.path("natpmp_declspec.h"), "natpmp_declspec.h");

    lib.linkLibC();
    b.installArtifact(lib);
}