Skip to content

Conversation

@burgholzer
Copy link
Member

Description

Picking apart #1403 even more.
This small PR directly exposes the MQT Core version as part of the CMake library macro.

Checklist:

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

@burgholzer burgholzer self-assigned this Dec 30, 2025
@burgholzer burgholzer added usability Anything related to usability c++ Anything related to C++ code labels Dec 30, 2025
@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 30, 2025

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • Chores
    • Reorganized build configuration to consolidate version information definitions at the core library level.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Refactors CMake version definitions by centralizing MQT_CORE_VERSION to the core library's compile definitions, while removing duplicate MQT_CORE_VERSION definitions from three QDMI target configurations, each retaining only QDMI_VERSION locally.

Changes

Cohort / File(s) Summary
Core Library Build
cmake/AddMQTCoreLibrary.cmake
Adds MQT_CORE_VERSION compile definition to the core library target via target_compile_definitions(${name} PRIVATE MQT_CORE_VERSION="${MQT_CORE_VERSION}")
QDMI Target Cleanup
src/qdmi/dd/CMakeLists.txt, src/qdmi/na/CMakeLists.txt, src/qdmi/sc/CMakeLists.txt
Removes MQT_CORE_VERSION from private compile definitions; each target now defines only QDMI_VERSION locally

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • #1401 — Updates QDMI-related CMake build configuration and target definitions for version management alignment.

Suggested labels

enhancement, QDMI

Poem

🐰 With versions now tidy and clean,
Duplicates stripped from the scene,
Core holds the truth, so divine,
QDMI targets each find their own line! 🎯

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: exposing MQT_CORE_VERSION as part of the add_mqt_core_library macro. It directly reflects the primary modification across the CMake configuration files.
Description check ✅ Passed The PR description follows the template structure with a clear summary of the change, context from issue #1403, and all checklist items marked as completed. It provides meaningful information about the purpose and status of the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f748baa and 6841e23.

📒 Files selected for processing (4)
  • cmake/AddMQTCoreLibrary.cmake
  • src/qdmi/dd/CMakeLists.txt
  • src/qdmi/na/CMakeLists.txt
  • src/qdmi/sc/CMakeLists.txt
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: flowerthrower
Repo: munich-quantum-toolkit/core-plugins-catalyst PR: 1
File: CHANGELOG.md:18-18
Timestamp: 2025-12-01T11:00:40.342Z
Learning: In the munich-quantum-toolkit/core-plugins-catalyst repository, the CHANGELOG.md intentionally references the parent MQT Core repository's release notes (https://github.com/munich-quantum-toolkit/core/releases) because the plugin repository is based on work performed in the parent repository.
Learnt from: DRovara
Repo: munich-quantum-toolkit/core PR: 1108
File: mlir/lib/Dialect/MQTOpt/Transforms/ReplaceBasisStateControlsWithIfPattern.cpp:219-221
Timestamp: 2025-10-09T13:14:10.178Z
Learning: The MQT Core project (munich-quantum-toolkit/core repository) uses the C++20 standard, not C++17. C++20 features such as abbreviated function templates (e.g., `const auto&` parameters) are supported and valid in this codebase.
Learnt from: burgholzer
Repo: munich-quantum-toolkit/yaqs PR: 212
File: CHANGELOG.md:12-15
Timestamp: 2025-10-14T14:37:38.047Z
Learning: In the munich-quantum-toolkit/yaqs project, changelog entries follow the template: "- $TITLE ([#$NUMBER]($URL)) ([**AUTHOR**](https://github.com/$AUTHOR))". Issue references should not be included in changelog entries; the PR number is sufficient for traceability.
Learnt from: denialhaag
Repo: munich-quantum-toolkit/core PR: 1360
File: .github/workflows/reusable-mlir-tests.yml:40-43
Timestamp: 2025-12-05T17:45:37.602Z
Learning: In the munich-quantum-toolkit/core repository, patch releases of LLVM dependencies don't require documentation updates, changelog entries, or additional tests beyond what's validated by passing CI checks.
Learnt from: burgholzer
Repo: munich-quantum-toolkit/core PR: 1355
File: src/qdmi/sc/Device.cpp:97-102
Timestamp: 2025-12-07T09:10:31.836Z
Learning: In the munich-quantum-toolkit/core repository, duplication of QDMI-related macros (such as IS_INVALID_ARGUMENT) across device implementations (e.g., in src/qdmi/sc/Device.cpp and src/qdmi/dd/Device.cpp) is acceptable as a temporary measure. The preferred long-term solution is to upstream these macros to the QDMI repository rather than creating local shared headers, so they can be reused across all dependent projects.
Learnt from: burgholzer
Repo: munich-quantum-toolkit/core PR: 1287
File: test/qdmi/dd/CMakeLists.txt:9-21
Timestamp: 2025-11-03T23:09:26.881Z
Learning: The CMake functions `generate_device_defs_executable` and `generate_prefixed_qdmi_headers` used in QDMI device test CMakeLists.txt files are provided by the external QDMI library (fetched via FetchContent from https://github.com/Munich-Quantum-Software-Stack/qdmi.git), specifically in the cmake/PrefixHandling.cmake module of the QDMI repository.
Learnt from: burgholzer
Repo: munich-quantum-toolkit/core PR: 1246
File: bindings/CMakeLists.txt:0-0
Timestamp: 2025-10-10T08:09:54.528Z
Learning: In the Munich Quantum Toolkit (MQT) Core project, scikit-build-core is configured with `wheel.install-dir = "mqt/core"` in pyproject.toml, which automatically prefixes all CMake `DESTINATION` paths with `mqt/core/` during wheel installation. Therefore, CMake install destinations are relative to the `mqt/core` package namespace, not `site-packages`.
📚 Learning: 2025-12-28T17:14:53.890Z
Learnt from: burgholzer
Repo: munich-quantum-toolkit/core PR: 1403
File: src/qdmi/na/CMakeLists.txt:31-38
Timestamp: 2025-12-28T17:14:53.890Z
Learning: In the munich-quantum-toolkit/core repository, the NA device generator target (mqt-core-qdmi-na-device-gen) is intentionally propagated to MQT_CORE_TARGETS via list(APPEND) because it's publicly linked to the NA device library (the NA device uses a public function from the generator). The SC device generator is not propagated because it has no such dependency with the SC device library.

Applied to files:

  • cmake/AddMQTCoreLibrary.cmake
  • src/qdmi/na/CMakeLists.txt
  • src/qdmi/sc/CMakeLists.txt
  • src/qdmi/dd/CMakeLists.txt
📚 Learning: 2025-11-03T23:09:26.881Z
Learnt from: burgholzer
Repo: munich-quantum-toolkit/core PR: 1287
File: test/qdmi/dd/CMakeLists.txt:9-21
Timestamp: 2025-11-03T23:09:26.881Z
Learning: The CMake functions `generate_device_defs_executable` and `generate_prefixed_qdmi_headers` used in QDMI device test CMakeLists.txt files are provided by the external QDMI library (fetched via FetchContent from https://github.com/Munich-Quantum-Software-Stack/qdmi.git), specifically in the cmake/PrefixHandling.cmake module of the QDMI repository.

Applied to files:

  • cmake/AddMQTCoreLibrary.cmake
  • src/qdmi/na/CMakeLists.txt
  • src/qdmi/sc/CMakeLists.txt
  • src/qdmi/dd/CMakeLists.txt
📚 Learning: 2025-12-07T09:10:31.836Z
Learnt from: burgholzer
Repo: munich-quantum-toolkit/core PR: 1355
File: src/qdmi/sc/Device.cpp:97-102
Timestamp: 2025-12-07T09:10:31.836Z
Learning: In the munich-quantum-toolkit/core repository, duplication of QDMI-related macros (such as IS_INVALID_ARGUMENT) across device implementations (e.g., in src/qdmi/sc/Device.cpp and src/qdmi/dd/Device.cpp) is acceptable as a temporary measure. The preferred long-term solution is to upstream these macros to the QDMI repository rather than creating local shared headers, so they can be reused across all dependent projects.

Applied to files:

  • src/qdmi/na/CMakeLists.txt
  • src/qdmi/sc/CMakeLists.txt
  • src/qdmi/dd/CMakeLists.txt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
  • GitHub Check: 🐍 Test (ubuntu-24.04-arm) / 🐍 ubuntu-24.04-arm
  • GitHub Check: 🐍 Test (ubuntu-24.04) / 🐍 ubuntu-24.04
  • GitHub Check: 🐍 Test (windows-2022) / 🐍 windows-2022
  • GitHub Check: 🐍 Test (macos-14) / 🐍 macos-14
  • GitHub Check: 🐍 Test (macos-15-intel) / 🐍 macos-15-intel
  • GitHub Check: 🇨‌ Test 🏁 (windows-2022, msvc, Debug) / 🏁 windows-2022 msvc Debug
  • GitHub Check: 🇨‌ Test 🏁 (windows-2022, msvc, Release) / 🏁 windows-2022 msvc Release
  • GitHub Check: 🇨‌ Test 🍎 (macos-14, clang, Debug) / 🍎 macos-14 clang Debug
  • GitHub Check: 🇨‌ Test 🐧 (ubuntu-24.04, gcc, Release) / 🐧 ubuntu-24.04 gcc Release
  • GitHub Check: 🇨‌ Test 🐧 (ubuntu-24.04, gcc, Debug) / 🐧 ubuntu-24.04 gcc Debug
  • GitHub Check: 🇨‌ Test 🏁 (windows-11-arm, msvc, Release) / 🏁 windows-11-arm msvc Release
  • GitHub Check: 🇨‌ Test 🐧 (ubuntu-24.04-arm, gcc, Release) / 🐧 ubuntu-24.04-arm gcc Release
  • GitHub Check: 🇨‌ Test 🍎 (macos-15-intel, clang, Release) / 🍎 macos-15-intel clang Release
  • GitHub Check: 🇨‌ Coverage / 📈 Coverage
  • GitHub Check: 🇨‌ Test 🍎 (macos-14, clang, Release) / 🍎 macos-14 clang Release
  • GitHub Check: 🐍 Lint / 🚨 Lint
  • GitHub Check: 🇨‌ Lint / 🚨 Lint
🔇 Additional comments (4)
src/qdmi/na/CMakeLists.txt (1)

146-147: LGTM! Duplicate version definition correctly removed.

Since this target is created via add_mqt_core_library() (line 108), it now automatically receives MQT_CORE_VERSION from the macro. Retaining only QDMI_VERSION here is correct, as it's specific to the NA device.

src/qdmi/sc/CMakeLists.txt (1)

146-147: LGTM! Duplicate version definition correctly removed.

Since this target is created via add_mqt_core_library() (line 108), it now automatically receives MQT_CORE_VERSION from the macro. Retaining only QDMI_VERSION here is correct, as it's specific to the SC device.

src/qdmi/dd/CMakeLists.txt (1)

55-56: LGTM! Duplicate version definition correctly removed.

Since this target is created via add_mqt_core_library() (line 19), it now automatically receives MQT_CORE_VERSION from the macro. Retaining only QDMI_VERSION here is correct, as it's specific to the DD device.

cmake/AddMQTCoreLibrary.cmake (1)

50-52: LGTM! Centralized version definition reduces duplication.

The addition of MQT_CORE_VERSION to the add_mqt_core_library macro centralizes version management for all core libraries. The PRIVATE scope is appropriate for internal version tracking. All targets requiring MQT_CORE_VERSION either use add_mqt_core_library (device libraries) or define it explicitly (generator libraries, executables, and test targets).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@burgholzer burgholzer enabled auto-merge (squash) December 30, 2025 19:30
@burgholzer burgholzer merged commit 362a56f into main Dec 30, 2025
34 checks passed
@burgholzer burgholzer deleted the always-expose-mqt-core-version branch December 30, 2025 20:03
burgholzer added a commit that referenced this pull request Jan 8, 2026
…#1409)

## Description

Picking apart #1403 even more.
This small PR directly exposes the MQT Core version as part of the CMake
library macro.

## Checklist:

<!---
This checklist serves as a reminder of a couple of things that ensure
your pull request will be merged swiftly.
-->

- [x] The pull request only contains commits that are focused and
relevant to this change.
- [x] I have added appropriate tests that cover the new/changed
functionality.
- [x] I have updated the documentation to reflect these changes.
- [x] I have added entries to the changelog for any noteworthy
additions, changes, fixes, or removals.
- [x] I have added migration instructions to the upgrade guide (if
needed).
- [x] The changes follow the project's style guidelines and introduce no
new warnings.
- [x] The changes are fully tested and pass the CI checks.
- [x] I have reviewed my own code changes.

Signed-off-by: burgholzer <[email protected]>
(cherry picked from commit 362a56f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Anything related to C++ code usability Anything related to usability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants