diff --git a/build.zig b/build.zig index f481935..4162d26 100644 --- a/build.zig +++ b/build.zig @@ -15,6 +15,7 @@ pub fn build(b: *std.Build) void { // set a preferred release mode, allowing the user to decide how to optimize. const optimize = b.standardOptimizeOption(.{}); + const gobject = b.dependency("gobject", .{}); const exe = b.addExecutable(.{ .name = "zig-gst", @@ -51,6 +52,11 @@ pub fn build(b: *std.Build) void { } exe.linkSystemLibrary("c"); + + exe.root_module.addImport("glib", gobject.module("glib2")); + exe.root_module.addImport("gobject", gobject.module("gobject2")); + exe.root_module.addImport("gst", gobject.module("gst1")); + exe.addIncludePath(.{ .cwd_relative = b.fmt("{s}/include/gstreamer-1.0", .{gst_dev_path.?}) }); // not sure why both are needed, but exe.addIncludePath(.{ .cwd_relative = b.fmt("{s}/include/gstreamer-1.0/gst", .{gst_dev_path.?}) }); // it won't compile without them exe.addIncludePath(.{ .cwd_relative = b.fmt("{s}/include/gstreamer-1.0", .{gst_plugins_base_dev_path.?}) }); // needed for header resolution of below dep diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 0000000..95d8edd --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,17 @@ +.{ + .name = "HailoImageProcessor", + .version = "0.0.0", + .paths = .{ + "src", + "flake.nix", + "flake.lock", + "build.nix", + "README.md", + }, + .dependencies = .{ + .gobject = .{ + .url = "https://github.com/ianprime0509/zig-gobject/releases/download/v0.2.2/bindings-gnome47.tar.zst", + .hash = "12208d70ee791d7ef7e16e1c3c9c1127b57f1ed066a24f87d57fc9f730c5dc394b9d", + }, + } +} diff --git a/src/main.zig b/src/main.zig index 8129e6d..a3ca976 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,12 +1,23 @@ const std = @import("std"); -const gst = @cImport({ // glib-object for g_object_* functions - @cInclude("glib-object.h"); - @cInclude("glib.h"); // and glib for other g_* functions - @cInclude("gst.h"); - @cInclude("gst/app/gstappsrc.h"); // because I don't want two include paths for header file name resolution +const hlo = @cImport({ + @cInclude("hailort.h"); +}); +const gst_app = @cImport({ // glib-object for g_object_* functions + @cInclude("gstappsrc.h"); }); -pub fn main() void { +const gst = @import("gst"); +const glib = @import("glib"); +const gobject = @import("gobject"); + +const Allocator = std.mem.Allocator; +const assert = std.debug.assert; + +const hef_file = "yolov7.hef"; +const max_edge_layers = 32; + + +pub fn main() !void { // This allows me to utilize the same command line args and gstreamer gst.gst_init(@ptrCast(&std.os.argv.len), @ptrCast(&std.os.argv.ptr));