Compare commits
11 Commits
1dfff5e0b0
...
5b2b64a9de
Author | SHA1 | Date | |
---|---|---|---|
5b2b64a9de | |||
1c6205769f | |||
99d138d5e8 | |||
5ad078e5d6 | |||
573b2347f6 | |||
fd91b5ceaa | |||
45f02a82a8 | |||
340dfa2bb7 | |||
8a2becdd79 | |||
9f23fbe948 | |||
63e18caa5b |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/zig-cache
|
||||
/zig-out
|
16
build.zig
16
build.zig
@@ -109,14 +109,20 @@ pub fn package(
|
||||
// see: https://github.com/MasterQ32/SDL.zig/blob/37f4ba9e31bea895fa19ef8b90d1f51111e52e67/Sdk.zig#L182-L199
|
||||
|
||||
zgui_c_cpp.addVcpkgPaths(if (args.options.shared) .dynamic else .static) catch break :blk;
|
||||
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");
|
||||
const vcpkg_triplet = zgui_c_cpp.target.vcpkgTriplet(b.allocator, if (args.options.shared) .Dynamic else .Static) catch |e| {
|
||||
std.debug.panic("failed to determing vcpkg triplet: {}", .{e});
|
||||
};
|
||||
defer b.allocator.free(vcpkg_triplet);
|
||||
|
||||
std.fs.cwd().access(src_path, .{}) catch break :blk;
|
||||
const include_path = b.pathJoin(&.{ b.vcpkg_root.found, "installed", vcpkg_triplet, "include", "SDL2" });
|
||||
zgui_c_cpp.include_dirs.append(.{ .raw_path = include_path }) catch @panic("out of memory");
|
||||
|
||||
// we found SDL2.dll
|
||||
b.installBinFile(src_path, "SDL2.dll");
|
||||
const bin_path = zgui_c_cpp.vcpkg_bin_path orelse @panic("vcpkg paths were found, so vcpkg_bin_path should be set ");
|
||||
const dll_path = std.fs.path.join(b.allocator, &.{ bin_path, "SDL2.dll" }) catch @panic("out of memory");
|
||||
|
||||
std.fs.cwd().access(dll_path, .{}) catch break :blk;
|
||||
b.installBinFile(dll_path, "SDL2.dll");
|
||||
}
|
||||
|
||||
zgui_c_cpp.linkSystemLibrary("SDL2");
|
||||
|
@@ -9,9 +9,9 @@ pub const version = @import("std").SemanticVersion{ .major = 0, .minor = 9, .pat
|
||||
pub usingnamespace @import("gui.zig");
|
||||
pub const plot = @import("plot.zig");
|
||||
pub const backend = switch (@import("zgui_options").backend) {
|
||||
.glfw_wgpu => @import("backend_glfw_wgpu.zig"),
|
||||
.glfw_opengl3 => @import("backend_glfw_opengl3.zig"),
|
||||
.sdl2_opengl3 => @import("backend_sdl2_opengl3.zig"),
|
||||
.glfw_wgpu => @import("backend_glfw_wgpu.zig"),
|
||||
.win32_dx12 => .{}, // TODO:
|
||||
.no_backend => .{},
|
||||
};
|
||||
|
Reference in New Issue
Block a user