From 94d960d49c05944477a01200c310e2b9b3deff6c Mon Sep 17 00:00:00 2001
From: Patrick Wuttke 
Date: Mon, 20 Oct 2025 14:57:30 +0200
Subject: [PATCH] ImGui: Added user_config option for supplying a user-defined
 configuration file (see IMGUI_USER_CONFIG). Added misc/cpp to include path so
 imgui_stdlib.h can be easily included.
---
 recipes/imgui/recipe.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/recipes/imgui/recipe.py b/recipes/imgui/recipe.py
index 767f9f5..df7950b 100644
--- a/recipes/imgui/recipe.py
+++ b/recipes/imgui/recipe.py
@@ -30,15 +30,22 @@ def _git_cook(env: Environment, repo: dict, options: dict) -> dict:
     for backend in chain(env.get('IMGUI_BACKENDS', []), options.get('backends', [])):
         imgui_source_files.append(os.path.join(repo['checkout_root'], 'backends', f'imgui_impl_{backend}.cpp'))
 
+    private_cppdefines = ['IMGUI_IMPL_VULKAN_NO_PROTOTYPES=1']
+    public_cppdefines = []
+    if options.get('user_config'):
+        define = f'IMGUI_USER_CONFIG=\\"{options["user_config"]}\\"'
+        private_cppdefines.append(define)
+        public_cppdefines.append(define)
     lib_imgui = env.StaticLibrary(
         CPPPATH = [repo['checkout_root']],
-        CPPDEFINES = ['IMGUI_IMPL_VULKAN_NO_PROTOTYPES=1'],
+        CPPDEFINES = private_cppdefines,
         target = env['LIB_DIR'] + '/imgui',
         source = imgui_source_files,
         dependencies = _dependencies(env, None, options)
     )
     return {
-        'CPPPATH': [repo['checkout_root']],
+        'CPPDEFINES': public_cppdefines,
+        'CPPPATH': [repo['checkout_root'], os.path.join(repo['checkout_root'], 'misc/cpp')],
         'LIBS': [lib_imgui]
     }