From 92b023955485dc33b61cf17062dd6743d6e96c42 Mon Sep 17 00:00:00 2001 From: sonoro1234 Date: Wed, 25 Jun 2025 18:44:25 +0200 Subject: [PATCH] add preprocesor ifndef for including only once in cimgui_impl.h --- cimgui_impl.h | 3 +++ generator/generator.lua | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cimgui_impl.h b/cimgui_impl.h index 27b6c2b..e9b8054 100644 --- a/cimgui_impl.h +++ b/cimgui_impl.h @@ -1,3 +1,5 @@ +#ifndef CIMGUI_IMPL_DEFINED +#define CIMGUI_IMPL_DEFINED #ifdef CIMGUI_USE_GLFW #ifdef CIMGUI_DEFINE_ENUMS_AND_STRUCTS @@ -196,3 +198,4 @@ CIMGUI_API int ImGui_ImplVulkanH_GetMinImageCountFromPresentMode(VkPresentModeKH CIMGUI_API ImGui_ImplVulkanH_Window* ImGui_ImplVulkanH_Window_ImGui_ImplVulkanH_Window(void); #endif +#endif //CIMGUI_IMPL_DEFINED diff --git a/generator/generator.lua b/generator/generator.lua index bdd930d..9aa62ba 100644 --- a/generator/generator.lua +++ b/generator/generator.lua @@ -460,7 +460,7 @@ if #implementations > 0 then parser2 = cpp2ffi.Parser() local config = dofile(CONFIG_GENERATOR_PATH) --"./config_generator.lua" - local impl_str = "" + local impl_str = "#ifndef CIMGUI_IMPL_DEFINED\n#define CIMGUI_IMPL_DEFINED\n" local impl_str_cpp = {} for i,impl in ipairs(implementations) do print("------------implementation:",impl) @@ -502,7 +502,7 @@ if #implementations > 0 then end impl_str = impl_str.. table.concat(outtab)..cfuncsstr .. "\n#endif\n" end - + impl_str = impl_str .. "#endif //CIMGUI_IMPL_DEFINED\n" parser2:do_parse() save_data("./output/cimgui_impl.h",impl_str)