Got the example running on mac using a homebrew installed SDL2 using the following build.zig.
const std = @import("std"); pub fn build(b: *std.build.Builder) void { const target = b.standardTargetOptions(.{ .default_target = .{ .abi = .gnu } }); const mode = b.standardReleaseOptions(); const exe = b.addExecutable("hello-gamedev", "src/main.zig"); exe.setTarget(target); exe.setBuildMode(mode); exe.addIncludeDir("/usr/local/include/SDL2"); exe.addLibPath("/usr/local/lib"); exe.linkSystemLibrary("sdl2"); exe.linkLibC(); exe.install(); }
Thanks for the example!
Nice one! I think you don't even need exe.addIncludeDir and exe.addLibPath since Zig makes use of pkg-config. Given you have pkg-config installed.
exe.addIncludeDir
exe.addLibPath
pkg-config
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Got the example running on mac using a homebrew installed SDL2 using the following build.zig.
Thanks for the example!
Nice one!
I think you don't even need
exe.addIncludeDir
andexe.addLibPath
since Zig makes use of pkg-config. Given you havepkg-config
installed.