Skip to content
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
2049ff7
Add constants header to prefix handling
ystade Feb 11, 2026
1dc02dd
Add installation instructions for device
ystade Feb 11, 2026
4c3f8b3
Use dependent option
ystade Feb 11, 2026
7bfcda0
Remove qdmi target
ystade Feb 11, 2026
253516f
🎨 pre-commit fixes
pre-commit-ci[bot] Feb 11, 2026
09f0cbc
Update changelog
ystade Feb 11, 2026
9401dfa
remove install intr because they already exist
ystade Feb 11, 2026
aac020d
Update changelog
ystade Feb 11, 2026
e1280a1
Remove unsused option
ystade Feb 11, 2026
35964b8
Instantiate device from template
ystade Feb 11, 2026
af3620a
Update cxx std
ystade Feb 11, 2026
833da05
Fix cmake
ystade Feb 11, 2026
3e929e3
Fix template
ystade Feb 11, 2026
daed971
Fix tests
ystade Feb 11, 2026
47e10ae
Enable device tests
ystade Feb 11, 2026
8cb41a1
Remove qdmi target from the one linked with devices
ystade Feb 11, 2026
8e5219f
Add install instructions from template
ystade Feb 11, 2026
3fcd551
Rename install vars and align cmake
ystade Feb 11, 2026
f8ef473
Fix indentation
ystade Feb 11, 2026
325731f
Make device installation optional
ystade Feb 11, 2026
16a9ee0
Update changelog
ystade Feb 11, 2026
8c881f4
🎨 pre-commit fixes
pre-commit-ci[bot] Feb 11, 2026
a1aea05
Prevent segfault when freeing session with nullptr
ystade Feb 11, 2026
caae627
Adapt test to new library names
ystade Feb 11, 2026
e5de402
Fix conf file creation
ystade Feb 11, 2026
83679f8
Fix path
ystade Feb 11, 2026
7ae15f5
🎨 pre-commit fixes
pre-commit-ci[bot] Feb 11, 2026
9eea362
Ignore all test dirs
ystade Feb 11, 2026
1509984
Build also device tests when linting
ystade Feb 11, 2026
0ba7c6b
Fix pattern
ystade Feb 11, 2026
5dfdb7d
Fix docs build (avoid recursively adding another Doxyfile
ystade Feb 11, 2026
2c89cdc
Temporarily change qdmi rev in template
ystade Feb 11, 2026
550ea1a
Merge branch 'develop' into example-device-template
ystade Feb 17, 2026
086fc6c
Update device from template
ystade Feb 17, 2026
6db5530
Merge remote-tracking branch 'origin/develop' into example-device-tem…
ystade Feb 23, 2026
653b7ca
Update device
ystade Feb 23, 2026
057af90
Fix bugs in cmake config
ystade Feb 23, 2026
3f79f06
Fix line breaks
ystade Feb 23, 2026
a040463
🐛 Fix codecov config
ystade Feb 24, 2026
627c9aa
Merge remote-tracking branch 'origin/develop' into example-device-tem…
ystade Feb 24, 2026
c313dfc
🎨 Update device
ystade Feb 25, 2026
398dfa5
🎨 pre-commit fixes
pre-commit-ci[bot] Feb 25, 2026
1b0f7f4
✅ Fix coverage settings
ystade Feb 26, 2026
5158132
🎨 Rename qdmi_docs to qdmi-docs for consistency
ystade Feb 26, 2026
560bf0a
🎨 Add license to license config
ystade Feb 26, 2026
e35adfc
🐛 Fix header.html
ystade Feb 26, 2026
a0b8632
🐛 Fix codecov config
ystade Feb 26, 2026
1ae5fd3
✅ Add test case for missing line
ystade Feb 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ignore:
- "test/**/*"
- "/**/test/**/*"

coverage:
range: 60..90
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ jobs:
with:
clang-version: 21
cpp-linter-extra-args: "-std=c++20"
# do not try to build docs in linter builds
cmake-args: "-DBUILD_QDMI_DOCS=OFF"
cmake-args: "-DBUILD_CXX_QDMI_TESTS=ON"

template:
name: 🏗️ Build and Test Templates
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-cpp-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
run: pipx install ninja
- name: Configure CMake
run: |
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON -DBUILD_QDMI_DOCS=OFF
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON -DBUILD_CXX_QDMI_TESTS=ON
- name: Build
run: cmake --build build --config Debug
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-cpp-install-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
# configure CMake for using the installed QDMI
- name: Configure CMake for use of installed QDMI
run:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DUSE_INSTALLED_QDMI=ON
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DUSE_INSTALLED_QDMI=ON -DBUILD_CXX_QDMI_TESTS=ON
-DCMAKE_PREFIX_PATH=install-dir ${{ inputs.cmake-args }}
# build the project
- name: Build QDMI examples, templates, and tests with installed QDMI
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ clients compiled against a different minor or major version.

## [Unreleased]

### Added

- 👨‍💻 Add an option to disable installation instructions for QDMI (example and template) device ([#326])
([\@ystade])

### Changed

- 👨‍💻 Base the example device implementation on the device template ([#326])
([\@ystade])
- 🚸 Export _all_ device headers (incl. `constants.h`) into device implementation ([#325]) ([\@ystade])

## [1.2.1] - 2025-12-22

_If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md#121)._
Expand Down Expand Up @@ -112,6 +123,8 @@ changelogs._

<!-- PR links -->

[#326]: https://github.com/Munich-Quantum-Software-Stack/QDMI/pull/326
[#325]: https://github.com/Munich-Quantum-Software-Stack/QDMI/pull/325
[#285]: https://github.com/Munich-Quantum-Software-Stack/QDMI/pull/285
[#275]: https://github.com/Munich-Quantum-Software-Stack/QDMI/pull/275
[#274]: https://github.com/Munich-Quantum-Software-Stack/QDMI/pull/274
Expand Down
15 changes: 6 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ set(PROJECT_VERSION_FULL "${PROJECT_VERSION}${PROJECT_VERSION_PRERELEASE}")
# enable organization of targets into folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

include(CMakeDependentOption)

# Set a default build type if none was specified
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
Expand All @@ -52,14 +54,9 @@ option(
"Use an installed version of QDMI to build examples, templates, and tests"
OFF)

if(USE_INSTALLED_QDMI)
set(QDMI_INSTALL
OFF
CACHE BOOL "Generate installation instructions for QDMI" FORCE)
else()
option(QDMI_INSTALL "Generate installation instructions for QDMI"
${QDMI_MASTER_PROJECT})
endif()
cmake_dependent_option(
INSTALL_QDMI "Generate installation instructions for QDMI"
${QDMI_MASTER_PROJECT} "NOT USE_INSTALLED_QDMI" OFF)
option(BUILD_QDMI_TESTS "Also build tests for the QDMI project"
${QDMI_MASTER_PROJECT})
option(BUILD_QDMI_EXAMPLES "Also build examples for the QDMI project"
Expand Down Expand Up @@ -178,7 +175,7 @@ if(BUILD_QDMI_TESTS)
endif()

# Installation instructions for the main library
if(QDMI_INSTALL)
if(INSTALL_QDMI)
set(QDMI_CONFIG_INSTALL_DIR
"${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}"
CACHE INTERNAL "Config install directory")
Expand Down
18 changes: 16 additions & 2 deletions cmake/GenerateTemplate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,22 @@ if("${QDMI_TEMPLATE_CLEAN}" STREQUAL "")
set(QDMI_TEMPLATE_CLEAN OFF)
endif()

file(REAL_PATH "${QDMI_TEMPLATE_SOURCE_DIR}" QDMI_TEMPLATE_SOURCE_DIR)
file(REAL_PATH "${QDMI_TEMPLATE_OUTPUT_DIR}" QDMI_TEMPLATE_OUTPUT_DIR)
# file(REAL_PATH ...) fails if the path doesn't (yet) exist on some
# platforms/CMakes. Use REAL_PATH only when the path exists; otherwise compute
# an absolute path which does not require the target to exist.
if(EXISTS "${QDMI_TEMPLATE_SOURCE_DIR}")
file(REAL_PATH "${QDMI_TEMPLATE_SOURCE_DIR}" QDMI_TEMPLATE_SOURCE_DIR)
else()
get_filename_component(QDMI_TEMPLATE_SOURCE_DIR "${QDMI_TEMPLATE_SOURCE_DIR}"
ABSOLUTE)
endif()

if(EXISTS "${QDMI_TEMPLATE_OUTPUT_DIR}")
file(REAL_PATH "${QDMI_TEMPLATE_OUTPUT_DIR}" QDMI_TEMPLATE_OUTPUT_DIR)
else()
get_filename_component(QDMI_TEMPLATE_OUTPUT_DIR "${QDMI_TEMPLATE_OUTPUT_DIR}"
ABSOLUTE)
endif()

string(TOLOWER "${QDMI_TEMPLATE_PREFIX}" QDMI_TEMPLATE_prefix)

Expand Down
8 changes: 4 additions & 4 deletions cmake/PrefixHandling.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function(generate_prefixed_qdmi_headers prefix)
endif()

# Get the list of all QDMI device headers.
file(GLOB_RECURSE QDMI_DEVICE_HEADERS ${QDMI_INCLUDE_DIR}/qdmi/device.h
${QDMI_INCLUDE_DIR}/qdmi/types.h)
file(GLOB_RECURSE QDMI_DEVICE_HEADERS ${QDMI_INCLUDE_DIR}/qdmi/constants.h
${QDMI_INCLUDE_DIR}/qdmi/device.h ${QDMI_INCLUDE_DIR}/qdmi/types.h)

# Determine the correct CMake directory for prefix_defs.txt
set(QDMI_PREFIX_DIR "${QDMI_CMAKE_DIR}")
Expand All @@ -55,7 +55,7 @@ function(generate_prefixed_qdmi_headers prefix)
# Replace the include for the device header with the prefixed version.
string(
REGEX
REPLACE "#include (\"|<)qdmi/(device|types).h(\"|>)"
REPLACE "#include (\"|<)qdmi/(constants|device|types).h(\"|>)"
"#include \\1${QDMI_prefix}_qdmi/\\2.h\\3" header_content
"${header_content}")
# Replace the prefix definitions.
Expand Down Expand Up @@ -116,5 +116,5 @@ function(generate_device_defs_executable prefix)
qdmi_test_${QDMI_prefix}_device_defs PRIVATE qdmi::qdmi ${DEVICE_TARGET}
qdmi::qdmi_project_warnings)
target_compile_features(qdmi_test_${QDMI_prefix}_device_defs
PRIVATE cxx_std_17)
PRIVATE cxx_std_20)
endfunction()
19 changes: 15 additions & 4 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ set(DOXYGEN_INPUT_DIRS ${PROJECT_SOURCE_DIR}/include)
# correctly and is not passed to Doxygen. Whenever such a file is modified,
# CMake detects that change and will rerun the Doxygen command instead of using
# the cached result when the target `qdmi_docs` is built.
file(GLOB_RECURSE DOXYGEN_INPUT_FILES ${PROJECT_SOURCE_DIR}/include/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*.md)
file(
GLOB_RECURSE
DOXYGEN_INPUT_FILES
${PROJECT_SOURCE_DIR}/include/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*.md
${PROJECT_SOURCE_DIR}/CHANGELOG.md
${PROJECT_SOURCE_DIR}/UPGRADING.md
${PROJECT_SOURCE_DIR}/README.md)
# After the variable above is correctly initialized, we can add the additional
# files that are not source code but still part of the documentation. IMPORTANT:
# The order the files with the static content are added here influences their
Expand All @@ -52,8 +58,13 @@ string(REPLACE ";" " " DOXYGEN_INPUT_DIRS "${DOXYGEN_INPUT_DIRS}")
# can be included with the `\include`or `\snippet` command, we need to add the
# directories where these files are located.
set(DOXYGEN_EXAMPLE_DIRS
${PROJECT_SOURCE_DIR}/examples ${PROJECT_SOURCE_DIR}/.github
${PROJECT_SOURCE_DIR}/CHANGELOG.md ${PROJECT_SOURCE_DIR}/UPGRADING.md
${PROJECT_SOURCE_DIR}/examples/device/src
${PROJECT_SOURCE_DIR}/examples/driver
${PROJECT_SOURCE_DIR}/examples/fomac
${PROJECT_SOURCE_DIR}/examples/tool
${PROJECT_SOURCE_DIR}/.github
${PROJECT_SOURCE_DIR}/CHANGELOG.md
${PROJECT_SOURCE_DIR}/UPGRADING.md
${PROJECT_SOURCE_DIR}/README.md)
# Again, replace the semicolon with a space such that Doxygen can handle it.
string(REPLACE ";" " " DOXYGEN_EXAMPLE_DIRS "${DOXYGEN_EXAMPLE_DIRS}")
Expand Down
22 changes: 11 additions & 11 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ are returned by the @ref QDMI_device_session_query_device_property function. Bel
respective implementation in C++.

<!-- prettier-ignore-start -->
\dontinclude device.cpp
\dontinclude cxx_device.cpp
\skip int CXX_QDMI_device_session_query_device_property
\until QDMI_DEVICE_PROPERTY_LIBRARYVERSION
\until size_ret)
Expand All @@ -48,23 +48,23 @@ The following macro is used to add string properties to the device. The macro is
implementation of the @ref QDMI_device_session_query_device_property function.

<!-- prettier-ignore-start -->
\dontinclude device.cpp
\dontinclude cxx_device.cpp
\skip #define ADD_STRING_PROPERTY
\until DOXYGEN MACRO END
<!-- prettier-ignore-end -->

A similar macro is defined for other (fixed length) data types, for example, `int`, `double`.

<!-- prettier-ignore-start -->
\dontinclude device.cpp
\dontinclude cxx_device.cpp
\skip #define ADD_SINGLE_VALUE_PROPERTY
\until DOXYGEN MACRO END
<!-- prettier-ignore-end -->

Another macro is defined for list properties of the data types above.

<!-- prettier-ignore-start -->
\dontinclude device.cpp
\dontinclude cxx_device.cpp
\skip #define ADD_LIST_PROPERTY
\until DOXYGEN MACRO END
<!-- prettier-ignore-end -->
Expand All @@ -77,7 +77,7 @@ The following two examples demonstrate how to return integer or enumeration prop
device.

<!-- prettier-ignore-start -->
\dontinclude device.cpp
\dontinclude cxx_device.cpp
\skip int CXX_QDMI_device_session_query_device_property
\until {
\skip QDMI_DEVICE_PROPERTY_STATUS
Expand All @@ -94,7 +94,7 @@ return the coupling map of the device as a list of @ref QDMI_Site pairs. The pai
into a single list of @ref QDMI_Site's.

<!-- prettier-ignore-start -->
\dontinclude device.cpp
\dontinclude cxx_device.cpp
\skipline constexpr std::array<const CXX_QDMI_Site_impl_d *, 20>
\skip DEVICE_COUPLING_MAP
\until ;
Expand All @@ -114,7 +114,7 @@ demonstrates how different properties of operations, for example, varying fideli
gates can be returned.

<!-- prettier-ignore-start -->
\dontinclude device.cpp
\dontinclude cxx_device.cpp
\skip QDMI_Pair_hash
\until OPERATION_FIDELITIES
\until ;
Expand All @@ -129,7 +129,7 @@ following example provides a mock implementation of the necessary functions to s
first example shows a mock implementation of @ref QDMI_device_session_create_device_job.

<!-- prettier-ignore-start -->
\dontinclude device.cpp
\dontinclude cxx_device.cpp
\skip QDMI_device_session_create_device_job
\until DOXYGEN FUNCTION END
<!-- prettier-ignore-end -->
Expand All @@ -138,7 +138,7 @@ The function @ref QDMI_device_job_set_parameter allows setting different paramet
example, the number of shots (@ref QDMI_JOB_PARAMETER_SHOTSNUM).

<!-- prettier-ignore-start -->
\dontinclude device.cpp
\dontinclude cxx_device.cpp
\skip QDMI_device_job_set_parameter
\until DOXYGEN FUNCTION END
<!-- prettier-ignore-end -->
Expand All @@ -147,12 +147,12 @@ After the job is set up, it can be submitted to the device. The following exampl
implementation of @ref QDMI_device_job_submit.

<!-- prettier-ignore-start -->
\dontinclude device.cpp
\dontinclude cxx_device.cpp
\skip QDMI_device_job_submit
\until DOXYGEN FUNCTION END
<!-- prettier-ignore-end -->

For the full implementation of the example devices we refer to the respective source files in the
QDMI repository, that is,
[`device.cpp`](https://github.com/Munich-Quantum-Software-Stack/QDMI/blob/develop/examples/device/device.cpp)
[`cxx_device.cpp`](https://github.com/Munich-Quantum-Software-Stack/QDMI/blob/develop/examples/device/cxx_device.cpp)
for the C++ implementation.
3 changes: 3 additions & 0 deletions examples/device/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BasedOnStyle: LLVM
IncludeBlocks: Regroup
Standard: c++20
69 changes: 69 additions & 0 deletions examples/device/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
FormatStyle: file

Checks: |
bugprone-*,
-bugprone-easily-swappable-parameters,
clang-analyzer-*,
-clang-analyzer-security.insecureAPI.*,
clang-diagnostic-*,
cppcoreguidelines-*,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-owning-memory,
google-*,
-google-readability-todo,
-google-build-using-namespace,
misc-*,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
modernize-*,
-modernize-use-trailing-return-type,
performance-*,
portability-*,
-portability-avoid-pragma-once
readability-*,
-readability-identifier-length,
-readability-magic-numbers,
-readability-function-cognitive-complexity

CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.ConstantParameterCase
value: lower_case
- key: readability-identifier-naming.EnumCase
value: UPPER_CASE
- key: readability-identifier-naming.EnumConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.FunctionCase
value: Leading_upper_snake_case
- key: readability-identifier-naming.FunctionIgnoredRegexp
value: ".*QDMI.*"
- key: readability-identifier-naming.GlobalConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: "true"
- key: readability-identifier-naming.LocalConstantCase
value: lower_case
- key: readability-identifier-naming.MemberCase
value: lower_case
- key: readability-identifier-naming.MemberIgnoredRegexp
value: ".*QDMI.*"
- key: readability-identifier-naming.MethodCase
value: lower_case
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.StaticConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.StructCase
value: Leading_upper_snake_case
- key: readability-identifier-naming.StructIgnoredRegexp
value: ".*QDMI.*"
- key: readability-identifier-naming.VariableCase
value: lower_case
6 changes: 6 additions & 0 deletions examples/device/.cmake-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
format:
line_width: 80
keyword_case: "upper"
autosort: true
markup:
first_comment_is_literal: true
Loading
Loading