Skip to content

Caio/modules#1337

Draft
caiowakamatsu wants to merge 5 commits into
skypjack:wipfrom
caiowakamatsu:caio/modules
Draft

Caio/modules#1337
caiowakamatsu wants to merge 5 commits into
skypjack:wipfrom
caiowakamatsu:caio/modules

Conversation

@caiowakamatsu

Copy link
Copy Markdown

This PR is for finish the work @MilanBorovy started with #1290 to get C++ 20 modules working with EnTT.

I will rebase it against wip due to the STL injection changes causing a massive merge conflict.


Original PR text

  • Make EnTT consumable as C++ module
  • Added ENTT_MODULE CMake option enabling EnTT compilation as C++
  • Added ENTT_USER_CONFIG CMake option to be able to specify C++ config defines

I've [@MilanBorovy] noticed that similar pull rq is already ongoing but seems to be dead for a few months.

Instead of exporting symbols in separate files, export macros are used (similar to how fmt does it).

By setting ENTT_MODULE CMake option to ON the EnTT::EnTT target becomes module library allowing EnTT to be consumed as import entt;.

Another option ENTT_USER_CONFIG is added to CMake. It can be used to configure entt as on can't simply #define all configurations inside source with modules.

Usage example:

entt_config.hpp

#define ENTT_ID_TYPE std::uint64_t
#define ENTT_USE_ATOMIC

CMakeLists.txt

...
set(ENTT_MODULE ON)
cmake_path(APPEND PROJECT_SOURCE_DIR user_config.hpp OUTPUT_VARIABLE ENTT_USER_CONFIG)

add_subdirectory(entt)

...

target_link_libraries(exe PUBLIC EnTT::EnTT)

Some explanation of this would be nice to put in wiki, unfortunately I [@MilanBorovy] can't pull request changes to wiki AFAIK.

* Make EnTT consumable as C++ module
* Added `ENTT_MODULE` CMake option enabling EnTT compilation as C++ module
* Added `ENTT_USER_CONFIG` CMake option to be able to specify C++ config defines
@caiowakamatsu

Copy link
Copy Markdown
Author

In favor of keeping this PR well scoped, I think an attempt to reconcile STL injection + modules should not be made here. Instead a separate PR should be done for that functionality.

@skypjack skypjack self-requested a review June 23, 2026 07:17
@skypjack skypjack self-assigned this Jun 23, 2026
@skypjack skypjack added enhancement accepted requests, sooner or later I'll do it help wanted I don't have the knowledge/resources to do that discussion it sounds interesting, let's discuss it labels Jun 23, 2026
@skypjack

Copy link
Copy Markdown
Owner

In favor of keeping this PR well scoped, I think an attempt to reconcile STL injection + modules should not be made here. Instead a separate PR should be done for that functionality.

That's fair. We still need to fix the conflicts though, and thanks for pointing this to wip. 🙏
My idea was to cut a release by the end of the month, but I'm fine with doing it in July if we want to include this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discussion it sounds interesting, let's discuss it enhancement accepted requests, sooner or later I'll do it help wanted I don't have the knowledge/resources to do that

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants