mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-09-19 20:18:07 +00:00
pkg/opengl: replace cImport with translate-c
General Zig 0.16+ futureproofing
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const Buffer = @This();
|
||||
|
||||
const std = @import("std");
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
const errors = @import("errors.zig");
|
||||
const glad = @import("glad.zig");
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Framebuffer = @This();
|
||||
|
||||
const std = @import("std");
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
const errors = @import("errors.zig");
|
||||
const glad = @import("glad.zig");
|
||||
const Texture = @import("Texture.zig");
|
||||
|
||||
@@ -4,7 +4,7 @@ const std = @import("std");
|
||||
const assert = std.debug.assert;
|
||||
const log = std.log.scoped(.opengl);
|
||||
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
const Shader = @import("Shader.zig");
|
||||
const errors = @import("errors.zig");
|
||||
const glad = @import("glad.zig");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Renderbuffer = @This();
|
||||
|
||||
const std = @import("std");
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
const errors = @import("errors.zig");
|
||||
const glad = @import("glad.zig");
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Sampler = @This();
|
||||
|
||||
const std = @import("std");
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
const errors = @import("errors.zig");
|
||||
const glad = @import("glad.zig");
|
||||
const Texture = @import("Texture.zig");
|
||||
|
||||
@@ -4,7 +4,7 @@ const std = @import("std");
|
||||
const assert = std.debug.assert;
|
||||
const log = std.log.scoped(.opengl);
|
||||
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
const errors = @import("errors.zig");
|
||||
const glad = @import("glad.zig");
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Texture = @This();
|
||||
|
||||
const std = @import("std");
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
const errors = @import("errors.zig");
|
||||
const glad = @import("glad.zig");
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const VertexArray = @This();
|
||||
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
const glad = @import("glad.zig");
|
||||
const errors = @import("errors.zig");
|
||||
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) !void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const c = b.addTranslateC(.{
|
||||
.root_source_file = b.path("gl.c"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
c.addIncludePath(b.path("../../vendor/glad/include"));
|
||||
|
||||
const module = b.addModule("opengl", .{ .root_source_file = b.path("main.zig") });
|
||||
module.addIncludePath(b.path("../../vendor/glad/include"));
|
||||
module.addImport("c", c.createModule());
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
pub const c = @cImport({
|
||||
@cInclude("glad/gl.h");
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
const errors = @import("errors.zig");
|
||||
const glad = @import("glad.zig");
|
||||
const Primitive = @import("primitives.zig").Primitive;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const std = @import("std");
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
const glad = @import("glad.zig");
|
||||
|
||||
pub const Error = error{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const std = @import("std");
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
const errors = @import("errors.zig");
|
||||
const glad = @import("glad.zig");
|
||||
|
||||
|
||||
2
pkg/opengl/gl.c
Normal file
2
pkg/opengl/gl.c
Normal file
@@ -0,0 +1,2 @@
|
||||
#include <glad/gl.h>
|
||||
#include <glad/glad_egl.h>
|
||||
@@ -1,5 +1,5 @@
|
||||
const std = @import("std");
|
||||
const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
|
||||
pub const Context = c.GladGLContext;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
//!
|
||||
//! WARNING: Lots of performance improvements that we can make with Zig
|
||||
//! comptime help. I'm deferring this until later but have some fun ideas.
|
||||
pub const c = @import("c.zig").c;
|
||||
pub const c = @import("c");
|
||||
pub const glad = @import("glad.zig");
|
||||
pub const egl = @import("egl.zig");
|
||||
pub const ext = @import("extensions.zig");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pub const c = @import("c.zig").c;
|
||||
const c = @import("c");
|
||||
|
||||
pub const Primitive = enum(c_int) {
|
||||
point = c.GL_POINTS,
|
||||
|
||||
Reference in New Issue
Block a user