Resolves #8358.
This is a repeat of this comment:
I want to state up-front that this was AI-generated, but verified manually; this prose is also manually written by me. I decided to go this route after having good provenance and priors in Vulkan-Hpp. I deemed a lot of the work highly manual, repetitive, and error-prone, which made sense to automate to some degree, at least.
The gist is straightforward:
- The headers represent the public interface of imgui, and is included unconditionally in the corresponding module interface
- The
.cppfiles are the implementations, which are in the private module fragment, denoted bymodule :private; - To allow for macro and include safety, transitive includes are blocked by a macro that says "we are in the module purview", that is,
IMGUI_CXX_MODULE, and these headers are reproduced in each module interface unit. - Every symbol that needs to be exported is marked by
IMGUI_EXPORT, a macro that expands toexportwhen the above macro is itself active - Other macros have been gathered up into a 'macros header'. This should be available as usual with
#include <imgui.h>for header users, but module users will need to write#include <imgui_macros.h>for access to macros. - Repeat for the back-ends, which themselves
import imgui;. Note that some back-ends (especially for QNX and macOS/Metal/etc) haven't been ported. I am not sure of the interaction between Objective-C++ and C++20 modules.
This has been 'tested' (insofar as AI-generated testing counts...) locally, but I haven't really found a test suite online that I can adapt to verify that
- The header-only mode continues to work seamlessly for those who want to use headers
- The modules actually work
The change contains some miscellaneous CMake scaffolding, but this can be removed for the final work, and potentially integrate with #8896 or something else when that is ready.
Activity
9This pull request is a draft
Merging is unavailable until it is marked ready for review.