From 43540af087b77a1f13114e7ad0d80864fce4eea5 Mon Sep 17 00:00:00 2001 From: foxnne Date: Fri, 16 Feb 2024 15:13:33 -0600 Subject: [PATCH 1/8] mach-core: Update to sysgpu branch --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index e3e4a3f..dd833c5 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -8,8 +8,8 @@ .version = "0.1.0", .dependencies = .{ .mach_core = .{ - .url = "https://pkg.machengine.org/mach-core/370bc1504cebaffcda5ed1ae9915fd2ac6778479.tar.gz", - .hash = "12205da1ecba58ba8c9ca65dbf75e32f42fde0490d34a98596ae72d4d3db81659dc5", + .url = "https://pkg.machengine.org/mach-core/2422c164842eadebd937509c591e3d36aa92470b.tar.gz", + .hash = "122038cccd01128c92f12cfeee34677bf64f423d9aebb17f0648ef4d4a58e452ab71", }, .freetype = .{ .url = "https://pkg.machengine.org/freetype/398638fd1cb723e478658ea371fe3be1a4dce0ae.tar.gz", From 76d23b7a1bf0c1f61d96d615f2422c8fd430a10b Mon Sep 17 00:00:00 2001 From: foxnne Date: Wed, 6 Mar 2024 13:48:03 -0600 Subject: [PATCH 2/8] mach: Update `mach-core` dependency to `mach` --- build.zig | 8 ++++---- build.zig.zon | 6 +++--- examples/example_mach.zig | 2 +- src/imgui_mach.zig | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.zig b/build.zig index ba0bb21..8910313 100644 --- a/build.zig +++ b/build.zig @@ -1,7 +1,7 @@ const std = @import("std"); const builtin = @import("builtin"); -const mach_core = @import("mach_core"); +const mach = @import("mach"); pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); @@ -9,7 +9,7 @@ pub fn build(b: *std.Build) !void { const use_freetype = b.option(bool, "use_freetype", "Use Freetype") orelse false; - const mach_core_dep = b.dependency("mach_core", .{ + const mach_dep = b.dependency("mach", .{ .target = target, .optimize = optimize, }); @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) !void { const module = b.addModule("zig-imgui", .{ .root_source_file = .{ .path = "src/imgui.zig" }, .imports = &.{ - .{ .name = "mach-core", .module = mach_core_dep.module("mach-core") }, + .{ .name = "mach", .module = mach_dep.module("mach") }, }, }); @@ -65,7 +65,7 @@ pub fn build(b: *std.Build) !void { // Example const build_options = b.addOptions(); - const app = try mach_core.App.init(b, mach_core_dep.builder, .{ + const app = try mach.CoreApp.init(b, mach_dep.builder, .{ .name = "mach-imgui-example", .src = "examples/example_mach.zig", .target = target, diff --git a/build.zig.zon b/build.zig.zon index dd833c5..97c24ae 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -7,9 +7,9 @@ .name = "mach-imgui", .version = "0.1.0", .dependencies = .{ - .mach_core = .{ - .url = "https://pkg.machengine.org/mach-core/2422c164842eadebd937509c591e3d36aa92470b.tar.gz", - .hash = "122038cccd01128c92f12cfeee34677bf64f423d9aebb17f0648ef4d4a58e452ab71", + .mach = .{ + .url = "https://pkg.machengine.org/mach/ea6a9438aa13ee83f9239d3aada352dcb9ea8b7c.tar.gz", + .hash = "1220a1ac8dba2fee590af6bafce6e1d5a768b93456e8877fe3d5402f19aec3d5d696", }, .freetype = .{ .url = "https://pkg.machengine.org/freetype/398638fd1cb723e478658ea371fe3be1a4dce0ae.tar.gz", diff --git a/examples/example_mach.zig b/examples/example_mach.zig index 050b5de..5e76e9a 100644 --- a/examples/example_mach.zig +++ b/examples/example_mach.zig @@ -2,7 +2,7 @@ const std = @import("std"); const build_options = @import("build-options"); const imgui = @import("imgui"); const imgui_mach = imgui.backends.mach; -const core = @import("mach-core"); +const core = @import("mach").core; const gpu = core.gpu; pub const App = @This(); diff --git a/src/imgui_mach.zig b/src/imgui_mach.zig index 5831441..65bc365 100644 --- a/src/imgui_mach.zig +++ b/src/imgui_mach.zig @@ -1,6 +1,6 @@ const std = @import("std"); const imgui = @import("imgui.zig"); -const core = @import("mach-core"); +const core = @import("mach").core; const gpu = core.gpu; var allocator: std.mem.Allocator = undefined; From 80246b69bef69dcf231e7ba62fbc73dadc364bba Mon Sep 17 00:00:00 2001 From: foxnne Date: Mon, 25 Mar 2024 13:53:38 -0500 Subject: [PATCH 3/8] build: Update to latest mach --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 97c24ae..2c5ffb0 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -8,8 +8,8 @@ .version = "0.1.0", .dependencies = .{ .mach = .{ - .url = "https://pkg.machengine.org/mach/ea6a9438aa13ee83f9239d3aada352dcb9ea8b7c.tar.gz", - .hash = "1220a1ac8dba2fee590af6bafce6e1d5a768b93456e8877fe3d5402f19aec3d5d696", + .url = "https://pkg.machengine.org/mach/279290bbf2f1adab0af00323280a07d6bfff47a5.tar.gz", + .hash = "1220ba5472217ef81455b19d540967049bbfaf768b30d04534865707e907ee1c4aec", }, .freetype = .{ .url = "https://pkg.machengine.org/freetype/398638fd1cb723e478658ea371fe3be1a4dce0ae.tar.gz", From cd30757bc9377099cc4b838ec86824f5c0b0c4fb Mon Sep 17 00:00:00 2001 From: foxnne <49629865+foxnne@users.noreply.github.com> Date: Mon, 25 Mar 2024 13:55:06 -0500 Subject: [PATCH 4/8] build: Update to latest mach (#2) --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 97c24ae..2c5ffb0 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -8,8 +8,8 @@ .version = "0.1.0", .dependencies = .{ .mach = .{ - .url = "https://pkg.machengine.org/mach/ea6a9438aa13ee83f9239d3aada352dcb9ea8b7c.tar.gz", - .hash = "1220a1ac8dba2fee590af6bafce6e1d5a768b93456e8877fe3d5402f19aec3d5d696", + .url = "https://pkg.machengine.org/mach/279290bbf2f1adab0af00323280a07d6bfff47a5.tar.gz", + .hash = "1220ba5472217ef81455b19d540967049bbfaf768b30d04534865707e907ee1c4aec", }, .freetype = .{ .url = "https://pkg.machengine.org/freetype/398638fd1cb723e478658ea371fe3be1a4dce0ae.tar.gz", From 8a91a4e058d54f422e585c8e8e5b3b3ec440da94 Mon Sep 17 00:00:00 2001 From: foxnne Date: Mon, 25 Mar 2024 14:07:53 -0500 Subject: [PATCH 5/8] build.zig: Fix compile error --- build.zig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index 8910313..a5867fd 100644 --- a/build.zig +++ b/build.zig @@ -56,10 +56,11 @@ pub fn build(b: *std.Build) !void { } lib.addIncludePath(imgui_dep.path(".")); - lib.addCSourceFiles(.{ - .files = files.items, - .flags = flags.items, - }); + + for (files.items) |file| { + lib.addCSourceFile(.{ .file = .{ .path = file }, .flags = flags.items }); + } + b.installArtifact(lib); // Example From 64d9179d275a04051ac9c688470578265f2f6734 Mon Sep 17 00:00:00 2001 From: foxnne <49629865+foxnne@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:08:59 -0500 Subject: [PATCH 6/8] build.zig: Fix compile error (#3) * build: Update to latest mach * build.zig: Fix compile error --- build.zig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index 8910313..a5867fd 100644 --- a/build.zig +++ b/build.zig @@ -56,10 +56,11 @@ pub fn build(b: *std.Build) !void { } lib.addIncludePath(imgui_dep.path(".")); - lib.addCSourceFiles(.{ - .files = files.items, - .flags = flags.items, - }); + + for (files.items) |file| { + lib.addCSourceFile(.{ .file = .{ .path = file }, .flags = flags.items }); + } + b.installArtifact(lib); // Example From 84ce1fac8f1be6fb8aed3a9276ffb88e6a1e99d9 Mon Sep 17 00:00:00 2001 From: foxnne Date: Fri, 7 Jun 2024 09:23:47 -0500 Subject: [PATCH 7/8] build: Update to zig 2024.5.0-mach --- .gitignore | 2 ++ build.zig | 16 ++++++++-------- build.zig.zon | 11 ++++++----- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 6ef2e7b..b220efd 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ # Cheers! # -andrewrk +.zig-cache/ +.zig-out/ zig-cache/ zig-out/ /release/ diff --git a/build.zig b/build.zig index a5867fd..6bbb086 100644 --- a/build.zig +++ b/build.zig @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) !void { }); const module = b.addModule("zig-imgui", .{ - .root_source_file = .{ .path = "src/imgui.zig" }, + .root_source_file = b.path("src/imgui.zig"), .imports = &.{ .{ .name = "mach", .module = mach_dep.module("mach") }, }, @@ -38,11 +38,11 @@ pub fn build(b: *std.Build) !void { try files.appendSlice(&.{ "src/cimgui.cpp", - imgui_dep.path("imgui.cpp").getPath(b), - imgui_dep.path("imgui_widgets.cpp").getPath(b), - imgui_dep.path("imgui_tables.cpp").getPath(b), - imgui_dep.path("imgui_draw.cpp").getPath(b), - imgui_dep.path("imgui_demo.cpp").getPath(b), + imgui_dep.builder.path("imgui.cpp").getPath(b), + imgui_dep.builder.path("imgui_widgets.cpp").getPath(b), + imgui_dep.builder.path("imgui_tables.cpp").getPath(b), + imgui_dep.builder.path("imgui_draw.cpp").getPath(b), + imgui_dep.builder.path("imgui_demo.cpp").getPath(b), }); if (use_freetype) { @@ -58,7 +58,7 @@ pub fn build(b: *std.Build) !void { lib.addIncludePath(imgui_dep.path(".")); for (files.items) |file| { - lib.addCSourceFile(.{ .file = .{ .path = file }, .flags = flags.items }); + lib.addCSourceFile(.{ .file = .{ .cwd_relative = file }, .flags = flags.items }); } b.installArtifact(lib); @@ -84,7 +84,7 @@ pub fn build(b: *std.Build) !void { // Generator const generator_exe = b.addExecutable(.{ .name = "mach-imgui-generator", - .root_source_file = .{ .path = "src/generate.zig" }, + .root_source_file = b.path("src/generate.zig"), .target = target, .optimize = optimize, }); diff --git a/build.zig.zon b/build.zig.zon index 2c5ffb0..4ec1d47 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -8,12 +8,13 @@ .version = "0.1.0", .dependencies = .{ .mach = .{ - .url = "https://pkg.machengine.org/mach/279290bbf2f1adab0af00323280a07d6bfff47a5.tar.gz", - .hash = "1220ba5472217ef81455b19d540967049bbfaf768b30d04534865707e907ee1c4aec", + .url = "https://pkg.machengine.org/mach/b72f0e11b6d292c2b60789359a61f7ee6d7dc371.tar.gz", + .hash = "122015e1dac4afaf275f7f2adde3814e6a27f5799cbef96bb487ee305f7e33f4dca3", }, - .freetype = .{ - .url = "https://pkg.machengine.org/freetype/398638fd1cb723e478658ea371fe3be1a4dce0ae.tar.gz", - .hash = "12208c57b72e3fb5c8d5d3e667e2e21ca1d9e2b6fc3f84182b320f63933f591823da", + .mach_freetype = .{ + .url = "https://pkg.machengine.org/mach-freetype/86fc8024d4ddd53df75dfa4f3ad4eebe0b1b4284.tar.gz", + .hash = "12206251ed342f400b80abf3c338521f5d8c83eb596899abf77a2afe0cfd46e61ff0", + .lazy = true, }, .imgui = .{ .url = "https://github.com/ocornut/imgui/archive/refs/tags/v1.90.tar.gz", From 5ee5bd9e581b7050ab4fef6cfa31cf7449da37b0 Mon Sep 17 00:00:00 2001 From: foxnne Date: Fri, 7 Jun 2024 10:24:09 -0500 Subject: [PATCH 8/8] build: Fix issues with relative path --- build.zig | 8 ++++++-- examples/example_mach.zig | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index 6bbb086..f211c98 100644 --- a/build.zig +++ b/build.zig @@ -57,8 +57,12 @@ pub fn build(b: *std.Build) !void { lib.addIncludePath(imgui_dep.path(".")); - for (files.items) |file| { - lib.addCSourceFile(.{ .file = .{ .cwd_relative = file }, .flags = flags.items }); + for (files.items, 0..) |file, i| { + if (i == 0) { + lib.addCSourceFile(.{ .file = b.path(file), .flags = flags.items }); + } else { + lib.addCSourceFile(.{ .file = .{ .cwd_relative = file }, .flags = flags.items }); + } } b.installArtifact(lib); diff --git a/examples/example_mach.zig b/examples/example_mach.zig index 5e76e9a..c9510ac 100644 --- a/examples/example_mach.zig +++ b/examples/example_mach.zig @@ -2,8 +2,9 @@ const std = @import("std"); const build_options = @import("build-options"); const imgui = @import("imgui"); const imgui_mach = imgui.backends.mach; -const core = @import("mach").core; -const gpu = core.gpu; +const mach = @import("mach"); +const core = mach.core; +const gpu = mach.gpu; pub const App = @This();