diff --git a/CHANGELOG.md b/CHANGELOG.md index a67098a87..a847283d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel ### Changed - ⚡ Improve uv build caching by removing unconditional `reinstall-package` and configuring dedicated `cache-keys` ([#1412]) ([**@burgholzer**]) -- 👨‍💻📦 Build `spdlog` as a shared library on project installs ([#1411]) ([**@burgholzer**]) +- 👨‍💻📦 Build `spdlog` and QDMI generators as shared libraries in Python package builds ([#1411], [#1403]) ([**@burgholzer**]) - ♻️🏁 Remove Windows-specific restrictions for dynamic QDMI device library handling ([#1406]) ([**@burgholzer**]) - ♻️ Migrate Python bindings from `pybind11` to `nanobind` ([#1383]) ([**@denialhaag**], [**@burgholzer**]) - 📦️ Provide Stable ABI wheels for Python 3.12+ ([#1383]) ([**@burgholzer**], [**@denialhaag**]) @@ -48,6 +48,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel ### Fixed +- 🔧 Install all available QDMI device targets in Python package builds ([#1403]) ([**@burgholzer**]) - 🐛 Fix operation validation in Qiskit backend to handle device-specific gate naming conventions ([#1384]) ([**@marcelwa**]) - 🐛 Fix conditional branch handling when importing MLIR from `QuantumComputation` ([#1378]) ([**@lirem101**]) - 🐛 Fix custom QDMI property and parameter handling in SC and NA devices ([#1355]) ([**@burgholzer**]) @@ -292,6 +293,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool [#1412]: https://github.com/munich-quantum-toolkit/core/pull/1412 [#1411]: https://github.com/munich-quantum-toolkit/core/pull/1411 [#1406]: https://github.com/munich-quantum-toolkit/core/pull/1406 +[#1403]: https://github.com/munich-quantum-toolkit/core/pull/1403 [#1402]: https://github.com/munich-quantum-toolkit/core/pull/1402 [#1385]: https://github.com/munich-quantum-toolkit/core/pull/1385 [#1384]: https://github.com/munich-quantum-toolkit/core/pull/1384 diff --git a/pyproject.toml b/pyproject.toml index 783895b14..c12b8afca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,10 +93,13 @@ build.targets = [ "mqt-core-na", "mqt-core-ir-bindings", "mqt-core-dd-bindings", - "mqt-core-qdmi-na-device", - "mqt-core-qdmi-ddsim-device", "mqt-core-fomac-bindings", "mqt-core-na-bindings", + "mqt-core-qdmi-ddsim-device", + "mqt-core-qdmi-na-device", + "mqt-core-qdmi-na-device-dyn", + "mqt-core-qdmi-sc-device", + "mqt-core-qdmi-sc-device-dyn", ] metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" diff --git a/src/qdmi/na/CMakeLists.txt b/src/qdmi/na/CMakeLists.txt index 2eb8e54ac..266799f97 100644 --- a/src/qdmi/na/CMakeLists.txt +++ b/src/qdmi/na/CMakeLists.txt @@ -13,11 +13,7 @@ set(TARGET_NAME ${MQT_CORE_TARGET_NAME}-qdmi-na-device-gen) if(NOT TARGET ${TARGET_NAME}) # Add library for device generation - # - # Note: We use a static library here to avoid issues with RPATH and finding the executable during - # the build process in Python builds - add_library(${TARGET_NAME} STATIC) - add_library(MQT::CoreQDMINaDeviceGen ALIAS ${TARGET_NAME}) + add_mqt_core_library(${TARGET_NAME} ALIAS_NAME QDMINaDeviceGen) # add sources to target target_sources(${TARGET_NAME} PRIVATE Generator.cpp) @@ -30,23 +26,17 @@ if(NOT TARGET ${TARGET_NAME}) target_link_libraries( ${TARGET_NAME} PUBLIC nlohmann_json::nlohmann_json - PRIVATE spdlog::spdlog MQT::ProjectOptions MQT::ProjectWarnings) - - # set versioning information - set_target_properties( - ${TARGET_NAME} - PROPERTIES VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} - EXPORT_NAME CoreNaDeviceGen) - - # set c++ standard - target_compile_features(${TARGET_NAME} PRIVATE cxx_std_20) + PRIVATE spdlog::spdlog) # add to list of MQT core targets - set(MQT_CORE_TARGETS ${MQT_CORE_TARGETS} ${TARGET_NAME}) + list(APPEND MQT_CORE_TARGETS ${TARGET_NAME}) - # Make version available - target_compile_definitions(${TARGET_NAME} PRIVATE MQT_CORE_VERSION="${MQT_CORE_VERSION}") + # place the generated library in a predictable location where the executable can find it + set_target_properties( + ${TARGET_NAME} + PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}") endif() # Set target name @@ -139,9 +129,7 @@ if(NOT TARGET ${TARGET_NAME}) set_target_properties(${TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) # add to list of MQT core targets - set(MQT_CORE_TARGETS - ${MQT_CORE_TARGETS} ${TARGET_NAME} - PARENT_SCOPE) + list(APPEND MQT_CORE_TARGETS ${TARGET_NAME}) # Make QDMI version available target_compile_definitions(${TARGET_NAME} PRIVATE QDMI_VERSION="${QDMI_VERSION}") @@ -189,5 +177,10 @@ if(NOT TARGET ${TARGET_NAME}) SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} EXPORT_NAME CoreQDMINaDeviceDyn) add_library(MQT::CoreQDMINaDeviceDyn ALIAS ${DYN_TARGET_NAME}) + list(APPEND MQT_CORE_TARGETS ${DYN_TARGET_NAME}) endif() endif() + +set(MQT_CORE_TARGETS + ${MQT_CORE_TARGETS} + PARENT_SCOPE) diff --git a/src/qdmi/sc/CMakeLists.txt b/src/qdmi/sc/CMakeLists.txt index 67a7d1a05..f328832fd 100644 --- a/src/qdmi/sc/CMakeLists.txt +++ b/src/qdmi/sc/CMakeLists.txt @@ -13,11 +13,7 @@ set(TARGET_NAME ${MQT_CORE_TARGET_NAME}-qdmi-sc-device-gen) if(NOT TARGET ${TARGET_NAME}) # Add library for device generation - # - # Note: We use a static library here to avoid issues with RPATH and finding the executable during - # the build process in Python builds - add_library(${TARGET_NAME} STATIC) - add_library(MQT::CoreQDMIScDeviceGen ALIAS ${TARGET_NAME}) + add_mqt_core_library(${TARGET_NAME} ALIAS_NAME QDMIScDeviceGen) # add sources to target target_sources(${TARGET_NAME} PRIVATE Generator.cpp) @@ -30,23 +26,14 @@ if(NOT TARGET ${TARGET_NAME}) target_link_libraries( ${TARGET_NAME} PUBLIC nlohmann_json::nlohmann_json - PRIVATE spdlog::spdlog MQT::ProjectOptions MQT::ProjectWarnings) + PRIVATE spdlog::spdlog) - # set versioning information + # place the generated library in a predictable location where the executable can find it set_target_properties( ${TARGET_NAME} - PROPERTIES VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} - EXPORT_NAME CoreScDeviceGen) - - # set c++ standard - target_compile_features(${TARGET_NAME} PRIVATE cxx_std_20) - - # add to list of MQT core targets - set(MQT_CORE_TARGETS ${MQT_CORE_TARGETS} ${TARGET_NAME}) - - # Make version available - target_compile_definitions(${TARGET_NAME} PRIVATE MQT_CORE_VERSION="${MQT_CORE_VERSION}") + PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}") endif() # Set target name @@ -139,9 +126,7 @@ if(NOT TARGET ${TARGET_NAME}) set_target_properties(${TARGET_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) # add to list of MQT core targets - set(MQT_CORE_TARGETS - ${MQT_CORE_TARGETS} ${TARGET_NAME} - PARENT_SCOPE) + list(APPEND MQT_CORE_TARGETS ${TARGET_NAME}) # Make QDMI version available target_compile_definitions(${TARGET_NAME} PRIVATE QDMI_VERSION="${QDMI_VERSION}") @@ -189,5 +174,10 @@ if(NOT TARGET ${TARGET_NAME}) SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} EXPORT_NAME CoreQDMIScDeviceDyn) add_library(MQT::CoreQDMIScDeviceDyn ALIAS ${DYN_TARGET_NAME}) + list(APPEND MQT_CORE_TARGETS ${DYN_TARGET_NAME}) endif() endif() + +set(MQT_CORE_TARGETS + ${MQT_CORE_TARGETS} + PARENT_SCOPE)