tmp: attempt 3 lol

This commit is contained in:
Rekai Nyangadzayi Musuka 2023-03-26 21:27:12 -05:00
parent 3e1017d4fc
commit 2c765eaf9a
1 changed files with 14 additions and 1 deletions

View File

@ -105,7 +105,20 @@ pub fn package(
zgui_c_cpp.linkSystemLibraryName("dwmapi");
},
.sdl2_opengl3 => {
if (target.isWindows()) blk: {
// see: https://github.com/MasterQ32/SDL.zig/blob/37f4ba9e31bea895fa19ef8b90d1f51111e52e67/Sdk.zig#L182-L199
zgui_c_cpp.addVcpkgPaths(if (args.options.shared) .dynamic else .static);
const path = zgui_c_cpp.vcpkg_bin_path orelse break :blk;
const src_path = std.fs.path.join(b.allocator, &.{ path, "SDL2.dll" }) catch @panic("out of memory");
std.fs.cwd().access(src_path, .{}) catch break :blk;
// we found SDL2.dll
zgui_c_cpp.linkSystemLibrary("SDL2");
b.installBinFile(src_path, "SDL2.dll");
} else zgui_c_cpp.linkSystemLibrary("SDL2");
zgui_c_cpp.addCSourceFile(thisDir() ++ "/libs/imgui/backends/imgui_impl_sdl.cpp", cflags);
zgui_c_cpp.addCSourceFile(thisDir() ++ "/libs/imgui/backends/imgui_impl_opengl3.cpp", cflags);