@@ -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
559587fn 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" ,
0 commit comments