Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel

### Changed

- 📦 Switch to component-based installation for the MQT Core Python package ([#1596]) ([**@burgholzer**])
- ⬆️ Update QDMI to latest version from stable `v1.2.x` branch ([#1593]) ([**@burgholzer**])
- ⬆️ Update `clang-tidy` to version 22 ([#1564]) ([**@denialhaag**], [**@burgholzer**])
- 👷 Build on `macos-26`/`macos-26-intel` by default and `macos-15`/`macos-15-intel` for extensive tests ([#1571]) ([**@denialhaag**])
Expand Down Expand Up @@ -334,6 +335,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool

<!-- PR links -->

[#1596]: https://github.com/munich-quantum-toolkit/core/pull/1596
[#1593]: https://github.com/munich-quantum-toolkit/core/pull/1593
[#1588]: https://github.com/munich-quantum-toolkit/core/pull/1588
[#1583]: https://github.com/munich-quantum-toolkit/core/pull/1583
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ project(
VERSION ${MQT_CORE_VERSION}
DESCRIPTION "MQT Core - The Backbone of the Munich Quantum Toolkit")

set(MQT_CORE_TARGET_NAME "mqt-core")

if(BUILD_MQT_CORE_MLIR)
include(SetupMLIR)
endif()
Expand All @@ -116,8 +118,6 @@ if(MQT_CORE_INSTALL)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif()

set(MQT_CORE_TARGET_NAME "mqt-core")

cmake_dependent_option(BUILD_MQT_CORE_QIR_RUNNER "Build the QIR runner of the MQT Core project" ON
"BUILD_MQT_CORE_MLIR" OFF)

Expand Down
135 changes: 121 additions & 14 deletions cmake/ExternalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ set(JSON_URL https://github.com/nlohmann/json/releases/download/v${JSON_VERSION}
set(JSON_SystemInclude
ON
CACHE INTERNAL "Treat the library headers like system headers")
cmake_dependent_option(JSON_Install "Install nlohmann_json library" ON "MQT_CORE_INSTALL" OFF)
cmake_dependent_option(MQT_CORE_JSON_INSTALL "Install nlohmann_json library" ON "MQT_CORE_INSTALL"
OFF)
# Disable upstream nlohmann_json install rules and install with explicit MQT components below.
set(JSON_Install
OFF
CACHE BOOL "Disable upstream nlohmann_json install rules; handled by mqt-core" FORCE)
FetchContent_Declare(nlohmann_json URL ${JSON_URL} FIND_PACKAGE_ARGS ${JSON_VERSION})
list(APPEND FETCH_PACKAGES nlohmann_json)

Expand Down Expand Up @@ -117,7 +122,11 @@ set(SPDLOG_BUILD_PIC ON)
set(SPDLOG_SYSTEM_INCLUDES
ON
CACHE INTERNAL "Treat the library headers like system headers")
cmake_dependent_option(SPDLOG_INSTALL "Install spdlog library" ON "MQT_CORE_INSTALL" OFF)
cmake_dependent_option(MQT_CORE_SPDLOG_INSTALL "Install spdlog library" ON "MQT_CORE_INSTALL" OFF)
# Disable upstream spdlog install rules and install with explicit MQT components below.
set(SPDLOG_INSTALL
OFF
CACHE BOOL "Disable upstream spdlog install rules; handled by mqt-core" FORCE)
cmake_dependent_option(SPDLOG_BUILD_SHARED "Build spdlog as shared library" ON
"BUILD_MQT_CORE_SHARED_LIBS" OFF)
FetchContent_Declare(spdlog URL ${SPDLOG_URL} FIND_PACKAGE_ARGS ${SPDLOG_VERSION})
Expand Down Expand Up @@ -145,6 +154,62 @@ if(_eigen_target)
endif()
endif()

# Install nlohmann_json with explicit MQT components.
if(MQT_CORE_JSON_INSTALL AND TARGET nlohmann_json)
set(MQT_CORE_JSON_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/cmake/nlohmann_json")
set(MQT_CORE_JSON_TARGETS_EXPORT_NAME "nlohmann_jsonTargets")
set(MQT_CORE_JSON_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/nlohmann_jsonConfig.cmake")
set(MQT_CORE_JSON_VERSION_CONFIG_FILE
"${CMAKE_CURRENT_BINARY_DIR}/nlohmann_jsonConfigVersion.cmake")

# nlohmann_json's upstream templates expect these names.
set(_mqt_core_saved_project_name "${PROJECT_NAME}")
set(_mqt_core_saved_project_version "${PROJECT_VERSION}")
set(_mqt_core_saved_project_version_major "${PROJECT_VERSION_MAJOR}")
set(PROJECT_NAME "nlohmann_json")
set(PROJECT_VERSION "${JSON_VERSION}")
string(REGEX MATCH "^[0-9]+" PROJECT_VERSION_MAJOR "${JSON_VERSION}")
set(NLOHMANN_JSON_TARGET_NAME "nlohmann_json")
set(NLOHMANN_JSON_TARGETS_EXPORT_NAME "${MQT_CORE_JSON_TARGETS_EXPORT_NAME}")

configure_file(${nlohmann_json_SOURCE_DIR}/cmake/config.cmake.in ${MQT_CORE_JSON_CONFIG_FILE}
@ONLY)
configure_file(${nlohmann_json_SOURCE_DIR}/cmake/nlohmann_jsonConfigVersion.cmake.in
${MQT_CORE_JSON_VERSION_CONFIG_FILE} @ONLY)

set(PROJECT_NAME "${_mqt_core_saved_project_name}")
set(PROJECT_VERSION "${_mqt_core_saved_project_version}")
set(PROJECT_VERSION_MAJOR "${_mqt_core_saved_project_version_major}")
unset(_mqt_core_saved_project_name)
unset(_mqt_core_saved_project_version)
unset(_mqt_core_saved_project_version_major)
unset(NLOHMANN_JSON_TARGET_NAME)
unset(NLOHMANN_JSON_TARGETS_EXPORT_NAME)

install(
DIRECTORY ${nlohmann_json_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT ${MQT_CORE_TARGET_NAME}_Development)

install(
TARGETS nlohmann_json
EXPORT ${MQT_CORE_JSON_TARGETS_EXPORT_NAME}
INCLUDES
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT ${MQT_CORE_TARGET_NAME}_Development)

install(
EXPORT ${MQT_CORE_JSON_TARGETS_EXPORT_NAME}
NAMESPACE nlohmann_json::
DESTINATION ${MQT_CORE_JSON_CONFIG_INSTALL_DIR}
COMPONENT ${MQT_CORE_TARGET_NAME}_Development)

install(
FILES ${MQT_CORE_JSON_CONFIG_FILE} ${MQT_CORE_JSON_VERSION_CONFIG_FILE}
DESTINATION ${MQT_CORE_JSON_CONFIG_INSTALL_DIR}
COMPONENT ${MQT_CORE_TARGET_NAME}_Development)
endif()

# Ensure external shared libraries end up in a common lib layout used by our RUNPATH
if(TARGET spdlog)
set_target_properties(
Expand All @@ -154,17 +219,59 @@ if(TARGET spdlog)
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
endif()

# Patch for spdlog cmake files to be installed in a common cmake directory
if(SPDLOG_INSTALL)
# Install spdlog with explicit MQT components.
if(MQT_CORE_SPDLOG_INSTALL
AND TARGET spdlog
AND TARGET spdlog_header_only)
include(CMakePackageConfigHelpers)

set(MQT_CORE_SPDLOG_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/cmake/spdlog")
set(MQT_CORE_SPDLOG_CONFIG_TARGETS_FILE "spdlogConfigTargets.cmake")
set(MQT_CORE_SPDLOG_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/spdlogConfig.cmake")
set(MQT_CORE_SPDLOG_VERSION_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/spdlogConfigVersion.cmake")

install(
TARGETS spdlog spdlog_header_only
EXPORT spdlog
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${MQT_CORE_TARGET_NAME}_Runtime
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT ${MQT_CORE_TARGET_NAME}_Runtime
NAMELINK_COMPONENT ${MQT_CORE_TARGET_NAME}_Development
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${MQT_CORE_TARGET_NAME}_Development)
Comment thread
coderabbitai[bot] marked this conversation as resolved.

install(
DIRECTORY ${spdlog_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT ${MQT_CORE_TARGET_NAME}_Development
PATTERN "fmt/bundled" EXCLUDE)

if(NOT SPDLOG_USE_STD_FORMAT
AND NOT SPDLOG_FMT_EXTERNAL
AND NOT SPDLOG_FMT_EXTERNAL_HO)
install(
DIRECTORY ${spdlog_SOURCE_DIR}/include/spdlog/fmt/bundled/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/spdlog/fmt/bundled
COMPONENT ${MQT_CORE_TARGET_NAME}_Development)
endif()

install(
EXPORT spdlog
FILE ${MQT_CORE_SPDLOG_CONFIG_TARGETS_FILE}
NAMESPACE spdlog::
DESTINATION ${MQT_CORE_SPDLOG_CONFIG_INSTALL_DIR}
COMPONENT ${MQT_CORE_TARGET_NAME}_Development)

set(config_targets_file ${MQT_CORE_SPDLOG_CONFIG_TARGETS_FILE})
configure_package_config_file(
${spdlog_SOURCE_DIR}/cmake/spdlogConfig.cmake.in ${MQT_CORE_SPDLOG_CONFIG_FILE}
INSTALL_DESTINATION ${MQT_CORE_SPDLOG_CONFIG_INSTALL_DIR})
write_basic_package_version_file(
${MQT_CORE_SPDLOG_VERSION_CONFIG_FILE}
VERSION ${SPDLOG_VERSION}
COMPATIBILITY SameMajorVersion)

install(
CODE "
file(GLOB SPDLOG_CMAKE_FILES
\"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/spdlog/*\")
if(SPDLOG_CMAKE_FILES)
file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/cmake/spdlog\")
file(COPY \${SPDLOG_CMAKE_FILES}
DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/cmake/spdlog\")
file(REMOVE_RECURSE \"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/spdlog\")
endif()
")
FILES ${MQT_CORE_SPDLOG_CONFIG_FILE} ${MQT_CORE_SPDLOG_VERSION_CONFIG_FILE}
DESTINATION ${MQT_CORE_SPDLOG_CONFIG_INSTALL_DIR}
COMPONENT ${MQT_CORE_TARGET_NAME}_Development)
endif()
3 changes: 1 addition & 2 deletions mlir/lib/Compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ add_mlir_library(
MLIRQCToQCO
MLIRQCOToQC
MLIRQCToQIR
MQT::MLIRSupport
DISABLE_INSTALL)
MQT::MLIRSupport)

mqt_mlir_target_use_project_options(MQTCompilerPipeline)

Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Conversion/JeffToQCO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ add_mlir_conversion_library(
MLIRJeff
MLIRJeffToNative
MLIRQCODialect
MLIRTransforms
DISABLE_INSTALL)
MLIRTransforms)
3 changes: 1 addition & 2 deletions mlir/lib/Conversion/QCOToJeff/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ add_mlir_conversion_library(
MLIRJeff
MLIRNativeToJeff
MLIRQCODialect
MLIRTransforms
DISABLE_INSTALL)
MLIRTransforms)

if(TARGET MLIRQCOToJeff)
target_compile_definitions(MLIRQCOToJeff PRIVATE MQT_CORE_VERSION="${MQT_CORE_VERSION}")
Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Conversion/QCOToQC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ add_mlir_conversion_library(
MLIRArithDialect
MLIRFuncDialect
MLIRTransforms
MLIRFuncTransforms
DISABLE_INSTALL)
MLIRFuncTransforms)

mqt_mlir_target_use_project_options(MLIRQCOToQC)
3 changes: 1 addition & 2 deletions mlir/lib/Conversion/QCToQCO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ add_mlir_conversion_library(
MLIRArithDialect
MLIRFuncDialect
MLIRTransforms
MLIRFuncTransforms
DISABLE_INSTALL)
MLIRFuncTransforms)

mqt_mlir_target_use_project_options(MLIRQCToQCO)
3 changes: 1 addition & 2 deletions mlir/lib/Conversion/QCToQIR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ add_mlir_conversion_library(
MLIRTransforms
MLIRFuncDialect
MLIRFuncToLLVM
MLIRReconcileUnrealizedCasts
DISABLE_INSTALL)
MLIRReconcileUnrealizedCasts)

mqt_mlir_target_use_project_options(MLIRQCToQIR)
3 changes: 1 addition & 2 deletions mlir/lib/Dialect/QC/Builder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ add_mlir_library(
MLIRArithDialect
MLIRFuncDialect
MLIRSCFDialect
MLIRQCDialect
DISABLE_INSTALL)
MLIRQCDialect)

mqt_mlir_target_use_project_options(MLIRQCProgramBuilder)

Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Dialect/QC/IR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ add_mlir_dialect_library(
PRIVATE
MLIRIR
MLIRInferTypeOpInterface
MLIRSideEffectInterfaces
DISABLE_INSTALL)
MLIRSideEffectInterfaces)

mqt_mlir_target_use_project_options(MLIRQCDialect)

Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Dialect/QC/Translation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ add_mlir_library(
MLIRSCFDialect
MLIRQCDialect
MLIRQCProgramBuilder
MQT::CoreIR
DISABLE_INSTALL)
MQT::CoreIR)

mqt_mlir_target_use_project_options(MLIRQCTranslation)

Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Dialect/QCO/Builder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ add_mlir_library(
MLIRFuncDialect
MLIRSCFDialect
MLIRQCODialect
MLIRQTensorDialect
DISABLE_INSTALL)
MLIRQTensorDialect)

mqt_mlir_target_use_project_options(MLIRQCOProgramBuilder)

Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Dialect/QCO/IR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ add_mlir_dialect_library(
MLIRInferTypeOpInterface
MLIRSideEffectInterfaces
PUBLIC
Eigen3::Eigen
DISABLE_INSTALL)
Eigen3::Eigen)

mqt_mlir_target_use_project_options(MLIRQCODialect)

Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Dialect/QCO/Utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ add_mlir_dialect_library(
MLIRQCOInterfacesIncGen
LINK_LIBS
PUBLIC
MLIRQCODialect
DISABLE_INSTALL)
MLIRQCODialect)

mqt_mlir_target_use_project_options(MLIRQCOUtils)

Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Dialect/QIR/Builder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ add_mlir_library(
MLIRLLVMDialect
MLIRQIRUtils
MLIRIR
MLIRSupport
DISABLE_INSTALL)
MLIRSupport)

mqt_mlir_target_use_project_options(MLIRQIRProgramBuilder)

Expand Down
9 changes: 1 addition & 8 deletions mlir/lib/Dialect/QIR/Utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@

file(GLOB QIR_UTILS_SOURCES *.cpp)

add_mlir_library(
MLIRQIRUtils
${QIR_UTILS_SOURCES}
LINK_LIBS
PUBLIC
MLIRLLVMDialect
MLIRIR
DISABLE_INSTALL)
add_mlir_library(MLIRQIRUtils ${QIR_UTILS_SOURCES} LINK_LIBS PUBLIC MLIRLLVMDialect MLIRIR)

mqt_mlir_target_use_project_options(MLIRQIRUtils)

Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Dialect/QTensor/IR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ add_mlir_dialect_library(
MLIRInferTypeOpInterface
MLIRSideEffectInterfaces
PUBLIC
MLIRQCODialect
DISABLE_INSTALL)
MLIRQCODialect)

mqt_mlir_target_use_project_options(MLIRQTensorDialect)

Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ add_mlir_library(
MLIRTransformUtils
MLIRLLVMDialect
MLIRFuncDialect
MLIRArithDialect
DISABLE_INSTALL)
MLIRArithDialect)

mqt_mlir_target_use_project_options(MLIRSupportMQT)

Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ build.targets = [
"mqt-core-qdmi-sc-device-dyn",
]

install.components = [
"mqt-core_Runtime",
"mqt-core_Development",
"mqt-core_Python",
"qdmi_Development",
]

metadata.version.provider = "scikit_build_core.metadata.setuptools_scm"
sdist.include = ["python/mqt/core/_version.py"]
sdist.exclude = [
Expand Down
Loading