Skip to content
Closed
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: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
include:
- runs-on: ubuntu-24.04
compiler: gcc
preset: debug
preset: debug-shared
run-on-draft: true
setup-mlir: true
- runs-on: ubuntu-24.04
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ if(MQT_CORE_INSTALL)
set(CMAKE_INSTALL_RPATH ${BASEPOINT} ${BASEPOINT}/${CMAKE_INSTALL_LIBDIR}
${BASEPOINT}/../${CMAKE_INSTALL_LIBDIR})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
endif()

# add main library code
Expand Down
18 changes: 18 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
"LLVM_ENABLE_ASSERTIONS": "ON"
}
},
{
"name": "debug-shared",
"inherits": "debug",
"displayName": "Debug config with shared Core libraries",
"cacheVariables": {
"BUILD_SHARED_LIBS": "ON",
"BUILD_MQT_CORE_SHARED_LIBS": "ON"
}
},
{
"name": "debug-no-mlir",
"inherits": "base-unix-no-mlir",
Expand Down Expand Up @@ -144,6 +153,10 @@
"name": "debug",
"configurePreset": "debug"
},
{
"name": "debug-shared",
"configurePreset": "debug-shared"
},
{
"name": "debug-no-mlir",
"configurePreset": "debug-no-mlir"
Expand Down Expand Up @@ -197,6 +210,11 @@
"inherits": "base",
"configurePreset": "debug"
},
{
"name": "debug-shared",
"inherits": "base",
"configurePreset": "debug-shared"
},
{
"name": "debug-no-mlir",
"inherits": "base",
Expand Down
2 changes: 2 additions & 0 deletions cmake/ExternalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ if(BUILD_MQT_CORE_MLIR)
GIT_REPOSITORY https://github.com/unitaryfoundation/jeff-mlir.git
GIT_TAG 7e11628de13d87798474386721c08f218b5f277e)
function(_mqt_core_make_jeff_available)
# Embed jeff and its dependencies in the compiler's consumers, like our own compiler libraries.
set(BUILD_SHARED_LIBS OFF)
# Cap'n Proto, which is fetched transitively by jeff-mlir, uses the generic BUILD_TESTING option
# and defines a global `check` target when it is enabled. Do not let an embedding project's test
# setting leak into this third-party dependency.
Expand Down
6 changes: 6 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ cmake --build build
cmake --install build
```

Set `BUILD_MQT_CORE_SHARED_LIBS=ON` to build the public Core libraries as shared
libraries. This option defaults to `BUILD_SHARED_LIBS`. Internal compiler
libraries and the bundled jeff dependencies remain static and are linked into
their consumers; they are not an installed compiler SDK. QDMI device libraries
are always shared so the driver can load them at runtime.

Then, in your project's {code}`CMakeLists.txt`, use {code}`find_package()` to
locate the installed library:

Expand Down
4 changes: 4 additions & 0 deletions mlir/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
#
# Licensed under the MIT License

# Compiler libraries are private implementation details of the tools, bindings, and QDMI device.
# Embed them in those consumers instead of creating unexported shared-library dependencies.
set(BUILD_SHARED_LIBS OFF)

if(MSVC)
add_compile_definitions(_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING)
endif()
Expand Down
4 changes: 4 additions & 0 deletions src/qdmi/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ if(NOT TARGET ${TARGET_NAME})
# Add driver library
add_mqt_core_library(${TARGET_NAME} ALIAS_NAME QDMIDriver)

# A shared driver discovers device manifests beside its own library.
set_target_properties(${TARGET_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")

# Add sources to target
target_sources(${TARGET_NAME} PRIVATE DeviceRegistry.cpp Driver.cpp)

Expand Down
Loading