Skip to content

Conversation

@wdconinc
Copy link

This PR adds C++20 modules support (see also AIDASoft/podio#907). This mainly involved two things:

  • TU-local entities should be removed from headers (since they have internal linkage and we want external linkage), which in this case means moving from static constexpr to inline constexpr,
  • CMake needs support to install the right files, when SIO_ENABLE_CXX_MODULES=ON (and CMAKE_CXX_STANDARD=20 or newer).

BEGINRELEASENOTES

  • feat: add C++20 modules support

ENDRELEASENOTES

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds C++20 modules support to the SIO library, enabling modern C++ module-based compilation when SIO_ENABLE_CXX_MODULES=ON and using C++20 or newer. The implementation focuses on two main areas: converting translation-unit-local entities to have external linkage by changing from static constexpr to inline constexpr, and adding CMake infrastructure to build and install module interface files.

  • Changed constant definitions from static constexpr to inline constexpr for C++20 module compatibility
  • Added CMake module support with compiler/version/generator checks
  • Created module interface file (sio_module.ixx) to export SIO types and APIs

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
source/sio_module.ixx New module interface file that declares and exports SIO types, constants, and classes for C++20 module consumers
source/include/sio/definitions.h Updated constant declarations from static constexpr to inline constexpr to ensure external linkage in modules
source/include/sio/memcpy.h Updated sizeof_helper template members from static constexpr to inline static constexpr for module compatibility
source/CMakeLists.txt Added conditional installation logic to install module files when SIO_ENABLE_CXX_MODULES is enabled
cmake/SIOModules.cmake New CMake module providing functions and validation for C++20 module support (CMake 3.29+, GCC 14+, Clang 18+, Ninja generator)
CMakeLists.txt Includes SIOModules.cmake and conditionally installs builtin ZLIB when modules are enabled

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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