feat: prefer SDL.h instead of SDL/SDL.h on all supported platforms
This commit is contained in:
parent
b2f319e27d
commit
cdc933e741
25
build.zig
25
build.zig
|
@ -105,20 +105,25 @@ pub fn package(
|
||||||
zgui_c_cpp.linkSystemLibraryName("dwmapi");
|
zgui_c_cpp.linkSystemLibraryName("dwmapi");
|
||||||
},
|
},
|
||||||
.sdl2_opengl3 => {
|
.sdl2_opengl3 => {
|
||||||
// if (target.isWindows()) blk: {
|
if (target.isWindows()) blk: {
|
||||||
// // see: https://github.com/MasterQ32/SDL.zig/blob/37f4ba9e31bea895fa19ef8b90d1f51111e52e67/Sdk.zig#L182-L199
|
// 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;
|
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");
|
||||||
|
|
||||||
// std.log.info("path: {s}", .{src_path});
|
const bin_path = zgui_c_cpp.vcpkg_bin_path orelse @panic("vcpkg paths were found, so vcpkg_bin_path should be set ");
|
||||||
// // we found SDL2.dll
|
const dll_path = std.fs.path.join(b.allocator, &.{ bin_path, "SDL2.dll" }) catch @panic("out of memory");
|
||||||
// b.installBinFile(src_path, "SDL2.dll");
|
|
||||||
// }
|
std.fs.cwd().access(dll_path, .{}) catch break :blk;
|
||||||
|
b.installBinFile(dll_path, "SDL2.dll");
|
||||||
|
}
|
||||||
|
|
||||||
zgui_c_cpp.linkSystemLibrary("SDL2");
|
zgui_c_cpp.linkSystemLibrary("SDL2");
|
||||||
|
|
||||||
|
|
|
@ -67,13 +67,8 @@
|
||||||
#include "imgui_impl_sdl.h"
|
#include "imgui_impl_sdl.h"
|
||||||
|
|
||||||
// SDL
|
// SDL
|
||||||
#if defined(__WIN32__)
|
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
#include <SDL2/SDL_syswm.h>
|
|
||||||
#else
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_syswm.h>
|
#include <SDL_syswm.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <TargetConditionals.h>
|
#include <TargetConditionals.h>
|
||||||
|
|
Loading…
Reference in New Issue