mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
pkg/cimgui
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,2 +1,3 @@
|
|||||||
vendor/** linguist-vendored
|
vendor/** linguist-vendored
|
||||||
website/** linguist-documentation
|
website/** linguist-documentation
|
||||||
|
pkg/cimgui/vendor/** linguist-vendored
|
||||||
|
64
pkg/cimgui/build.zig
Normal file
64
pkg/cimgui/build.zig
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
const NativeTargetInfo = std.zig.system.NativeTargetInfo;
|
||||||
|
|
||||||
|
pub fn build(b: *std.Build) !void {
|
||||||
|
const target = b.standardTargetOptions(.{});
|
||||||
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
|
_ = b.addModule("imgui", .{ .source_file = .{ .path = "main.zig" } });
|
||||||
|
|
||||||
|
const imgui = b.dependency("imgui", .{});
|
||||||
|
const lib = b.addStaticLibrary(.{
|
||||||
|
.name = "cimgui",
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
|
lib.linkLibC();
|
||||||
|
if (target.isWindows()) {
|
||||||
|
lib.linkSystemLibrary("imm32");
|
||||||
|
}
|
||||||
|
|
||||||
|
lib.addIncludePath(imgui.path(""));
|
||||||
|
|
||||||
|
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
|
defer flags.deinit();
|
||||||
|
try flags.appendSlice(&.{
|
||||||
|
"-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS=1",
|
||||||
|
});
|
||||||
|
if (target.isWindows()) {
|
||||||
|
try flags.appendSlice(&.{
|
||||||
|
"-DIMGUI_IMPL_API=extern\t\"C\"\t__declspec(dllexport)",
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
try flags.appendSlice(&.{
|
||||||
|
"-DIMGUI_IMPL_API=extern\t\"C\"",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
lib.addCSourceFile(.{ .file = .{ .path = "vendor/cimgui.cpp" }, .flags = flags.items });
|
||||||
|
lib.addCSourceFile(.{ .file = imgui.path("imgui.cpp"), .flags = flags.items });
|
||||||
|
lib.addCSourceFile(.{ .file = imgui.path("imgui_draw.cpp"), .flags = flags.items });
|
||||||
|
lib.addCSourceFile(.{ .file = imgui.path("imgui_demo.cpp"), .flags = flags.items });
|
||||||
|
lib.addCSourceFile(.{ .file = imgui.path("imgui_widgets.cpp"), .flags = flags.items });
|
||||||
|
lib.addCSourceFile(.{ .file = imgui.path("imgui_tables.cpp"), .flags = flags.items });
|
||||||
|
|
||||||
|
lib.installHeadersDirectoryOptions(.{
|
||||||
|
.source_dir = .{ .path = "vendor" },
|
||||||
|
.install_dir = .header,
|
||||||
|
.install_subdir = "",
|
||||||
|
.include_extensions = &.{".h"},
|
||||||
|
});
|
||||||
|
|
||||||
|
b.installArtifact(lib);
|
||||||
|
|
||||||
|
const test_exe = b.addTest(.{
|
||||||
|
.name = "test",
|
||||||
|
.root_source_file = .{ .path = "main.zig" },
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
|
test_exe.linkLibrary(lib);
|
||||||
|
const tests_run = b.addRunArtifact(test_exe);
|
||||||
|
const test_step = b.step("test", "Run tests");
|
||||||
|
test_step.dependOn(&tests_run.step);
|
||||||
|
}
|
13
pkg/cimgui/build.zig.zon
Normal file
13
pkg/cimgui/build.zig.zon
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
.{
|
||||||
|
.name = "cimgui",
|
||||||
|
.version = "1.89.9",
|
||||||
|
.paths = .{""},
|
||||||
|
.dependencies = .{
|
||||||
|
// This should be kept in sync with the submodule in the cimgui source
|
||||||
|
// code to be safe that they're compatible.
|
||||||
|
.imgui = .{
|
||||||
|
.url = "https://github.com/ocornut/imgui/archive/1d8e48c161370c37628c4f37f3f87cb19fbcb723.tar.gz",
|
||||||
|
.hash = "12205e93e208aada4c835acdc3e2c1fac95b3ad92b47abe6412ab043f9f13817ad9b",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
1
pkg/cimgui/main.zig
Normal file
1
pkg/cimgui/main.zig
Normal file
@ -0,0 +1 @@
|
|||||||
|
test {}
|
5547
pkg/cimgui/vendor/cimgui.cpp
vendored
Normal file
5547
pkg/cimgui/vendor/cimgui.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4560
pkg/cimgui/vendor/cimgui.h
vendored
Normal file
4560
pkg/cimgui/vendor/cimgui.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user