aboutsummaryrefslogtreecommitdiff
path: root/src/javascript/jsc/bindings/bindings-generator.zig
blob: 4fbfd413ad89bd85d818e01863bf88a72490e355 (plain) (blame)
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
const Bindings = @import("bindings.zig");
const Exports = @import("exports.zig");
const HeaderGen = @import("./header-gen.zig").HeaderGen;
const std = @import("std");
const builtin = @import("builtin");
const io = std.io;
const fs = std.fs;
const process = std.process;
const ChildProcess = std.ChildProcess;
const Progress = std.Progress;
const print = std.debug.print;
const mem = std.mem;
const testing = std.testing;
const Allocator = std.mem.Allocator;

pub const bindgen = true;

pub fn main() anyerror!void {
    var allocator = std.heap.c_allocator;
    const src: std.builtin.SourceLocation = @src();
    const paths = [_][]const u8{ std.fs.path.dirname(src.file) orelse return error.BadPath, "headers.h" };
    const paths2 = [_][]const u8{ std.fs.path.dirname(src.file) orelse return error.BadPath, "headers-cpp.h" };

    const cpp = try std.fs.createFileAbsolute(try std.fs.path.join(allocator, &paths2), .{});
    const file = try std.fs.createFileAbsolute(try std.fs.path.join(allocator, &paths), .{});

    const HeaderGenerator = HeaderGen(
        Bindings,
        Exports,
        "src/javascript/jsc/bindings/bindings.zig",
    );
    HeaderGenerator.exec(HeaderGenerator{}, file, cpp);
}