Skip to content

feat: optional C++20 module support (PSI_FUNCTIONOID_MODULE, opt-in) - #14

Merged
psiha merged 1 commit into
masterfrom
feat/module-support
Sep 20, 2026
Merged

psiha merged 1 commit into
masterfrom
feat/module-support

Conversation

@psiha

@psiha psiha commented Sep 20, 2026

Copy link
Copy Markdown
Owner

PSI_FUNCTIONOID_MODULE (off by default): builds PsiFunctionoidModule (alias Psi::FunctionoidModule), exporting the library's public headers as import psi.functionoid; instead of textual #include, for toolchains with usable C++20 module support (clang-cl, GNU-driver clang). Purely additive — the existing PsiFunctionoid interface target and every consumer vendoring these headers directly are unaffected regardless of whether this option exists.

Same shape as psiha/vm#173: the global module fragment carries the STL plus the two macro-only psiha deps these headers use (boost/assert.hpp, boost/config_ex.hpp) textually — modules never export macros, so a consumer wanting BOOST_ASSERT after import psi.functionoid; still includes it directly, same as consuming Boost anywhere else. The purview exports every real header via file(GLOB_RECURSE), so a header added later is picked up automatically.

No pre-existing issues surfaced here (unlike psiha/vm, this library is header-only with no compiled-source PCH-propagation to route around, and every header included cleanly).

Verified

  • PsiFunctionoidModule builds clean (clang-cl, Release).
  • test/module_smoke_test.cpp (gated the same way as the option): import psi.functionoid;, exercises callable<> construction, invocation, and reassignment, links against a real executable, produces the correct result.
  • The existing test suite (27 tests across functionoid_smoke + functionoid_vtable_attrs) run unmodified with the option at its default (off): all pass.

Adds PsiFunctionoidModule (alias Psi::FunctionoidModule), exporting the
library's public headers as `import psi.functionoid;` instead of textual
includes, for toolchains with usable C++20 module support (clang-cl,
GNU-driver clang). Off by default and purely additive: the existing
PsiFunctionoid interface target and every header-only consumer are
unaffected regardless of whether the option is set.

Same shape as psiha/vm's own module support: the global module fragment
carries the STL plus the two macro-only psiha deps these headers use
(boost/assert.hpp, boost/config_ex.hpp) textually - modules never export
macros, so a consumer wanting BOOST_ASSERT after importing still includes
it directly, same as consuming Boost anywhere else. The purview exports
every real header via file(GLOB_RECURSE), so a header added later is
picked up automatically.

Verified with a smoke test (test/module_smoke_test.cpp, gated the same
way) that imports the module and exercises real callable<> usage, linked
against a real executable producing the correct result - and by running
the existing 27-test suite unmodified with the option at its default (off).
@psiha
psiha merged commit 29ce9b4 into master Sep 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant