Skip to content

Comments

Add SYSTEMC_UNITY_BUILD CMake option and require CMake 3.16+#119

Merged
lmailletcontoz merged 1 commit intoaccellera-official:mainfrom
RubBra:add-unity-build-flag
May 20, 2025
Merged

Add SYSTEMC_UNITY_BUILD CMake option and require CMake 3.16+#119
lmailletcontoz merged 1 commit intoaccellera-official:mainfrom
RubBra:add-unity-build-flag

Conversation

@RubBra
Copy link
Contributor

@RubBra RubBra commented May 20, 2025

This patch introduces a new CMake option -DSYSTEMC_UNITY_BUILD=ON to enable unity builds for the SystemC library, which may improve build performance in some environments.

Enabling this option compiles the sources as a single compilation unit. The option is OFF by default and does not affect standard builds.

The minimum required CMake version is raised to 3.16 to support this feature.

Rationale

Unity builds can significantly reduce build time in some build environments, especially those with many small translation units or slower filesystems.

CMake 3.16 is the first version that supports the required features (specifically UNITY_BUILD mode via target_sources() and target_sources(FILE_SET) logic).

Tested on

  • MSVC
  • Fedora 41 with Clang 15, 16, and 19 and GCC 12, 13, and 14
  • Tested both with SYSTEMC_UNITY_BUILD=ON and OFF

Build times were roughly halved by turning on the build option.

This patch introduces a new CMake option -DSYSTEMC_UNITY_BUILD=ON to enable
unity builds for the SystemC library, which may improve build performance
in some environments.

Enabling this option compiles the sources as a single compilation unit.
The option is OFF by default and does not affect standard builds.

The minimum required CMake version is raised to 3.16 to support this feature.

Signed-off-by: Ruben Brandhofer <ruben@mwa.re>
@lmailletcontoz lmailletcontoz merged commit e7d46b0 into accellera-official:main May 20, 2025
49 of 98 checks passed
@lmailletcontoz lmailletcontoz added this to the 3.0.2 milestone Oct 10, 2025
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.

2 participants