From 2a36a68ebea7ed32de306fcba2b8aa84ce34fa0c Mon Sep 17 00:00:00 2001 From: Nicholas Young Date: Fri, 18 Oct 2024 22:38:19 -0700 Subject: [PATCH] Added gstreamer app to build tree --- build.zig | 7 +++++++ flake.nix | 2 ++ 2 files changed, 9 insertions(+) diff --git a/build.zig b/build.zig index bb361ab..7cfdcb7 100644 --- a/build.zig +++ b/build.zig @@ -25,6 +25,7 @@ pub fn build(b: *std.Build) void { // These environment vars are set with the `nix develop` command const gst_dev_path = b.graph.env_map.get("GST_DEV_PATH"); + const gst_plugins_base_path = b.graph.env_map.get("GST_PLUGINS_BASE_PATH"); const glib_dev_path = b.graph.env_map.get("GLIB_DEV_PATH"); const glib_path = b.graph.env_map.get("GLIB_PATH"); @@ -32,6 +33,10 @@ pub fn build(b: *std.Build) void { std.debug.panic("GST_DEV_PATH environment variable was not set. Has the nix flake been updated? This should point at the gstreamer.XXX-dev folder", .{}); } + if (gst_plugins_base_path == null) { + std.debug.panic("GST_PLUGINS_DEV_PATH environment variable was not set. Has the nix flake been updated? This should point at the gst_all_1.gst-plugins-base.dev folder", .{}); + } + if (glib_dev_path == null) { std.debug.panic("GLIB_DEV_PATH environment variable was not set. Has the nix flake been updated? This should point at the glib.XXX-dev folder", .{}); } @@ -43,6 +48,7 @@ pub fn build(b: *std.Build) void { exe.linkSystemLibrary("c"); 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/app", .{gst_plugins_base_path.?}) }); // gstreamer-appsink exe.addIncludePath(.{ .cwd_relative = b.fmt("{s}/include/glib-2.0", .{glib_dev_path.?}) }); exe.addIncludePath(.{ .cwd_relative = b.fmt("{s}/lib/glib-2.0/include", .{glib_path.?}) }); @@ -53,6 +59,7 @@ pub fn build(b: *std.Build) void { exe.linkSystemLibrary("gstreamer-1.0"); + exe.linkSystemLibrary("gstreamer-app-1.0"); exe.linkSystemLibrary("glib-2.0"); exe.linkSystemLibrary("gobject-2.0"); diff --git a/flake.nix b/flake.nix index 890db72..5e6de5c 100644 --- a/flake.nix +++ b/flake.nix @@ -26,10 +26,12 @@ gst_all_1.gstreamer gst_all_1.gstreamer.dev gst_all_1.gst-plugins-base + gst_all_1.gst-plugins-base.dev gst_all_1.gst-plugins-good ]; GST_DEV_PATH = pkgs.gst_all_1.gstreamer.dev; + GST_PLUGINS_BASE_PATH = pkgs.gst_all_1.gst-plugins-base.dev; GLIB_DEV_PATH = pkgs.glib.dev; GLIB_PATH = pkgs.glib.out;