Skip to content

Added -DBits cmake option for selective build, w/ auto-trimming of built backend interfaces#595

Open
anderkve wants to merge 13 commits into
masterfrom
selective-build
Open

Added -DBits cmake option for selective build, w/ auto-trimming of built backend interfaces#595
anderkve wants to merge 13 commits into
masterfrom
selective-build

Conversation

@anderkve
Copy link
Copy Markdown
Collaborator

@anderkve anderkve commented May 8, 2026

This PR attempts to make it easier for the user to only build the parts of GAMBIT they actually need for their given project.

  • Added new CMake option for the user to select which Bits to include in the build. (ScannerBit is always included.) Example: cmake -DBits=ColliderBit;DecayBit .. will ditch all Bits except ColliderBit, DecayBit and ScannerBit

  • Also added system for automatic filtering of the backend interfaces (frontends), so that we only build the frontends for the backends that are actually used by the Bits we include in our build.

  • Added a new make target make list-backends which lists all the available backends, their make targets, and what Bit(s) they are relevant for

  • Added a similar new make target make list-scanners which lists all the available scanners in the cmake system, and where relevant, their make targets.

  • In our cmake system, replaced some embedded Python code with native cmake code for significant speed increase when checking the ditch status of build elements.

…trimming of backend interfaces.

- Added new CMake option for the user to select which Bits to include in the build. (ScannerBit is always included.)
Example: "cmake -DBits=ColliderBit;DecayBit .." will ditch all Bits except ColliderBit and DecayBit.

- Also added system for automatic filtering of the backend interfaces (frontends), so that we only build the frontends
for the backends that are actually used by the Bits we include in our build.

- Added a new make target "make list-backends" which lists all the available backends, their make targets, and what Bit(s)
they are relevant for

- In our cmake system, replaced some embedded Python code with native cmake code for significant speed increase when
checking the ditch status of build elements.
@anderkve anderkve requested a review from ChrisJChang May 8, 2026 23:01
@anderkve anderkve added build Core Core group task Backends Relates to GAMBIT interaction with external codes. labels May 8, 2026
@anderkve anderkve requested a review from pstoecker May 9, 2026 08:07
@anderkve
Copy link
Copy Markdown
Collaborator Author

anderkve commented May 9, 2026

Suggesting both @ChrisJChang and @pstoecker as reviewers, but no need for both of you – whoever gets time first can look at it. (Most of the new code is just two new python helper scripts for making the lists and some new cmake utility functions.)

@pstoecker
Copy link
Copy Markdown
Member

pstoecker commented May 9, 2026

I have not looked at the code yet, so the answer might be in plain sight. Just a thought at the beginning

I know it is bad usage and probably very unlikely to happen: What is the behavior if you have some "Bit" explicitly ditched via -Ditch=SomeBit;... but also explicitly requested via -DBits=SomeBit;...?

  • Is this an error during the cmake config step?
  • If not, does -Ditch beat -DBits and SomeBit is missing or vice versa and SomeBit is included?

Personally I would make it an error rather than silently swallow the conflicting configuration

EDIT: Fixed typo: to be clear, if have not started reviewing yet

@anderkve
Copy link
Copy Markdown
Collaborator Author

anderkve commented May 9, 2026

Goot point, @pstoecker. Currently there is no error, -Ditch takes preference over -DBits. But you are right that just making it an error would be neater. I'll do that.

I've just now found a couple of other tweaks I want to make to this system, so you can anyway hold off the review until I've implemented those things. Will let you know when it's ready!

@anderkve
Copy link
Copy Markdown
Collaborator Author

anderkve commented May 9, 2026

@pstoecker Now all the functionality should be in place, I think. But I will revise the code a bit (get rid of overly verbose comments, etc.), so don't do a detailed read of the code yet. But if you want to test the functionality, it should be ready for that.

@anderkve
Copy link
Copy Markdown
Collaborator Author

OK, I think this one is ready for testing + review now.

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

Labels

Backends Relates to GAMBIT interaction with external codes. build Core Core group task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants