Skip to content

build(c++): report machine flags used - #211

Open
robertodr wants to merge 10 commits into
refactor-use-hwlocfrom
build-report-machine-flags-used
Open

build(c++): report machine flags used#211
robertodr wants to merge 10 commits into
refactor-use-hwlocfrom
build-report-machine-flags-used

Conversation

@robertodr

Copy link
Copy Markdown
Member

Summary

🤖 AI text below 🤖

This pull request introduces reporting of machine-dependent compiler flags (such as those set via -march) used to build the project. It adds a mechanism to query, clean, and expose the actual flags used for the active variant, making this information available at both the C++ and Python levels. Additionally, it introduces a utility script and its tests for parsing GCC target options.

Machine-dependent flags reporting and variant introspection:

  • Added a CMake function (_monoprop_query_machine_flags) to query and clean the machine-dependent flags used for each build variant, storing them in CMake variables and generating a new header (Variants.h) with compile-time functions to report the active variant and flags. [1] [2]
  • Updated Info.h.in and the C++ bindings to expose the active variant and its compiler flags via variant() and variant_flags() functions, which are now also accessible in Python as monoprop.__variant__ and monoprop.__compiler_flags__. [1] [2] [3] [4] [5] [6]
  • Updated the test workflow to print the variant and compiler flags in CI logs for easier debugging and reproducibility.

Utility script and testing:

  • Added tools/gcc-target-help-clean.py, a script to normalize the output of gcc -Q --help=target, and a corresponding test suite to ensure robust parsing and cleaning of compiler flag output. [1] [2]

CMake and source organization:

  • Ensured generated headers (VariantMacros.h, Info.h, etc.) are included in the public interface and properly listed in the CMake configuration.
  • Clarified and simplified CMake comments and logic regarding module scanning and flag handling.

These changes improve transparency into the build environment, facilitate reproducibility, and make it easier to debug and optimize builds for different architectures.

Checklist

  • Tests added or updated to cover the changes
  • Documentation updated (docstrings, docs/, CONTRIBUTING.md) if needed
  • CHANGELOG / release notes updated if applicable

AI/LLM disclosure

  • I did not use LLM tooling, or used it only privately for ideation
  • I used the following tool to help write this PR description:
  • I used the following tool to generate or modify code: GitHub Copilot, claude-opus-4.8

Important

By opening this PR I confirm that I have read CONTRIBUTING.md and I agree to the terms of the Contributor License Agreement.

Warning

If you're contributing on behalf of your employer, contact cla@algorithmiq.fi to arrange a Corporate CLA.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Docs preview: https://pr-211.monoprop-docs.pages.dev

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.58%. Comparing base (43084d9) to head (e0da3d3).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@                 Coverage Diff                 @@
##           refactor-use-hwloc     #211   +/-   ##
===================================================
  Coverage               97.58%   97.58%           
===================================================
  Files                      14       14           
  Lines                     745      745           
  Branches                   99       99           
===================================================
  Hits                      727      727           
  Misses                     13       13           
  Partials                    5        5           
Flag Coverage Δ
cpp 97.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@robertodr
robertodr force-pushed the build-report-machine-flags-used branch from fd4f296 to e0da3d3 Compare August 7, 2026 12:28
@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant