Skip to content

Commit 7d0dc7f

Browse files
committed
Add bgfx source sync automation.
1 parent 084afc9 commit 7d0dc7f

66 files changed

Lines changed: 592 additions & 27084 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.zig

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub fn build(b: *std.Build) !void {
1616
.multithread = b.option(bool, "multithread", "Compile with BGFX_CONFIG_MULTITHREADED") orelse true,
1717
.with_shaderc = b.option(bool, "with_shaderc", "Compile with shaderc executable") orelse true,
1818
.shaderc_optimize = b.option(std.builtin.OptimizeMode, "shaderc_optimize", "Shaderc optimize mode") orelse .ReleaseFast,
19+
.with_sync = b.option(bool, "with_sync", "Enable bgfx src sync tool") orelse true,
1920
};
2021

2122
const options_step = b.addOptions();
@@ -188,7 +189,7 @@ pub fn build(b: *std.Build) !void {
188189
// Bgfx imgui backend
189190
// TODO: zig based
190191
//
191-
const bgfx_imgui_path = "libs/bgfx/examples/common/imgui/";
192+
const bgfx_imgui_path = "libs/imgui/";
192193
if (options.imgui_include) |include| {
193194
bgfx.root_module.addIncludePath(.{ .cwd_relative = include });
194195
bgfx.root_module.addCSourceFiles(.{
@@ -554,6 +555,33 @@ pub fn build(b: *std.Build) !void {
554555
shaderc.root_module.linkLibrary(spirv_opt_lib);
555556
shaderc.root_module.linkLibrary(spirv_cross_lib);
556557
}
558+
559+
//
560+
// Sync bgfx source and libs.
561+
//
562+
if (options.with_sync) {
563+
const sync_local_step = b.step("sync", "Sync BGFX sources");
564+
const copy_tool = b.addExecutable(.{
565+
.name = "sync",
566+
.root_module = b.createModule(.{
567+
.root_source_file = b.path("src/tools/sync.zig"),
568+
.target = target,
569+
.optimize = optimize,
570+
}),
571+
});
572+
573+
const bx_dep = b.lazyDependency("bx", .{});
574+
const bimg_dep = b.lazyDependency("bimg", .{});
575+
const bgfx_dep = b.lazyDependency("bgfx", .{});
576+
577+
if (bx_dep != null and bimg_dep != null and bgfx_dep != null) {
578+
const copy_run = b.addRunArtifact(copy_tool);
579+
copy_run.addDirectoryArg(bx_dep.?.path(""));
580+
copy_run.addDirectoryArg(bimg_dep.?.path(""));
581+
copy_run.addDirectoryArg(bgfx_dep.?.path(""));
582+
sync_local_step.dependOn(&copy_run.step);
583+
}
584+
}
557585
}
558586

559587
fn bxInclude(b: *std.Build, step: *std.Build.Step.Compile, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) void {
@@ -743,7 +771,6 @@ const glsl_lang_files = .{
743771
glslang_path ++ "SPIRV/GlslangToSpv.cpp",
744772
glslang_path ++ "SPIRV/InReadableOrder.cpp",
745773
glslang_path ++ "SPIRV/Logger.cpp",
746-
glslang_path ++ "SPIRV/SPVRemapper.cpp",
747774
glslang_path ++ "SPIRV/SpvBuilder.cpp",
748775
glslang_path ++ "SPIRV/SpvPostProcess.cpp",
749776
glslang_path ++ "SPIRV/SpvTools.cpp",
@@ -870,12 +897,8 @@ const spirv_opt_files = .{
870897
spirv_opt_path ++ "source/opt/inline_exhaustive_pass.cpp",
871898
spirv_opt_path ++ "source/opt/inline_opaque_pass.cpp",
872899
spirv_opt_path ++ "source/opt/inline_pass.cpp",
873-
spirv_opt_path ++ "source/opt/inst_bindless_check_pass.cpp",
874-
spirv_opt_path ++ "source/opt/inst_buff_addr_check_pass.cpp",
875-
spirv_opt_path ++ "source/opt/inst_debug_printf_pass.cpp",
876900
spirv_opt_path ++ "source/opt/instruction.cpp",
877901
spirv_opt_path ++ "source/opt/instruction_list.cpp",
878-
spirv_opt_path ++ "source/opt/instrument_pass.cpp",
879902
spirv_opt_path ++ "source/opt/interface_var_sroa.cpp",
880903
spirv_opt_path ++ "source/opt/interp_fixup_pass.cpp",
881904
spirv_opt_path ++ "source/opt/invocation_interlock_placement_pass.cpp",

build.zig.zon

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,21 @@
1212
"build.zig.zon",
1313
},
1414

15-
.dependencies = .{},
15+
.dependencies = .{
16+
.bx = .{
17+
.url = "https://github.com/bkaradzic/bx/archive/cac72f6cfa0893393ea12692ebfacb4495f8c826.tar.gz",
18+
.hash = "N-V-__8AAHS2TwD_HRKwJEGThGOlrlVkf2wDqTnRc0nCAQIy",
19+
.lazy = true,
20+
},
21+
.bimg = .{
22+
.url = "https://github.com/bkaradzic/bimg/archive/9114b47f532ce59cd0c6c9f8932df2c48888d4c1.tar.gz",
23+
.hash = "N-V-__8AAEd8OQDd_Q6YetkHilL1z29yXsE8oCskhrC-7zGV",
24+
.lazy = true,
25+
},
26+
.bgfx = .{
27+
.url = "https://github.com/bkaradzic/bgfx/archive/8532b2c45d2f4332a9ac9734b85c2ea2253cb8d5.tar.gz",
28+
.hash = "N-V-__8AAEcBaA5gsEixdEnaokhS0ZH6sKcE0pjE6X2FQkOQ",
29+
.lazy = true,
30+
},
31+
},
1632
}

libs/bgfx/3rdparty/.editorconfig

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)