Skip to content

Commit 9090bf6

Browse files
committed
πŸ‘¨β€πŸ’»πŸ“¦ build QDMI generators as shared libraries on install
Signed-off-by: burgholzer <burgholzer@me.com>
1 parent 43da430 commit 9090bf6

3 files changed

Lines changed: 14 additions & 38 deletions

File tree

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel
2626
### Changed
2727

2828
- ⚑ Improve uv build caching by removing unconditional `reinstall-package` and configuring dedicated `cache-keys` ([#1412]) ([**@burgholzer**])
29-
- πŸ‘¨β€πŸ’»πŸ“¦ Build `spdlog` as a shared library on project installs ([#1411]) ([**@burgholzer**])
29+
- πŸ‘¨β€πŸ’»πŸ“¦ Build `spdlog` and QDMI generators as a shared libraries on project installs ([#1411], [#1403]) ([**@burgholzer**])
3030
- β™»οΈπŸ Remove Windows-specific restrictions for dynamic QDMI device library handling ([#1406]) ([**@burgholzer**])
3131
- ♻️ Migrate Python bindings from `pybind11` to `nanobind` ([#1383]) ([**@denialhaag**], [**@burgholzer**])
3232
- πŸ“¦οΈ Provide Stable ABI wheels for Python 3.12+ ([#1383]) ([**@burgholzer**], [**@denialhaag**])
@@ -293,6 +293,7 @@ _πŸ“š Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool
293293
[#1412]: https://github.com/munich-quantum-toolkit/core/pull/1412
294294
[#1411]: https://github.com/munich-quantum-toolkit/core/pull/1411
295295
[#1406]: https://github.com/munich-quantum-toolkit/core/pull/1406
296+
[#1403]: https://github.com/munich-quantum-toolkit/core/pull/1403
296297
[#1402]: https://github.com/munich-quantum-toolkit/core/pull/1402
297298
[#1385]: https://github.com/munich-quantum-toolkit/core/pull/1385
298299
[#1384]: https://github.com/munich-quantum-toolkit/core/pull/1384

β€Žsrc/qdmi/na/CMakeLists.txtβ€Ž

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ set(TARGET_NAME ${MQT_CORE_TARGET_NAME}-qdmi-na-device-gen)
1313
if(NOT TARGET ${TARGET_NAME})
1414

1515
# Add library for device generation
16-
#
17-
# Note: We use a static library here to avoid issues with RPATH and finding the executable during
18-
# the build process in Python builds
19-
add_library(${TARGET_NAME} STATIC)
20-
add_library(MQT::CoreQDMINaDeviceGen ALIAS ${TARGET_NAME})
16+
add_mqt_core_library(${TARGET_NAME} ALIAS_NAME QDMINaDeviceGen)
2117

2218
# add sources to target
2319
target_sources(${TARGET_NAME} PRIVATE Generator.cpp)
@@ -30,23 +26,16 @@ if(NOT TARGET ${TARGET_NAME})
3026
target_link_libraries(
3127
${TARGET_NAME}
3228
PUBLIC nlohmann_json::nlohmann_json
33-
PRIVATE spdlog::spdlog MQT::ProjectOptions MQT::ProjectWarnings)
34-
35-
# set versioning information
36-
set_target_properties(
37-
${TARGET_NAME}
38-
PROPERTIES VERSION ${PROJECT_VERSION}
39-
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
40-
EXPORT_NAME CoreNaDeviceGen)
41-
42-
# set c++ standard
43-
target_compile_features(${TARGET_NAME} PRIVATE cxx_std_20)
29+
PRIVATE spdlog::spdlog)
4430

4531
# add to list of MQT core targets
4632
list(APPEND MQT_CORE_TARGETS ${TARGET_NAME})
4733

48-
# Make version available
49-
target_compile_definitions(${TARGET_NAME} PRIVATE MQT_CORE_VERSION="${MQT_CORE_VERSION}")
34+
# place the generated library in a predictable location where the executable can find it
35+
set_target_properties(
36+
${TARGET_NAME}
37+
PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}"
38+
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
5039
endif()
5140

5241
# Set target name

β€Žsrc/qdmi/sc/CMakeLists.txtβ€Ž

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ set(TARGET_NAME ${MQT_CORE_TARGET_NAME}-qdmi-sc-device-gen)
1313
if(NOT TARGET ${TARGET_NAME})
1414

1515
# Add library for device generation
16-
#
17-
# Note: We use a static library here to avoid issues with RPATH and finding the executable during
18-
# the build process in Python builds
19-
add_library(${TARGET_NAME} STATIC)
20-
add_library(MQT::CoreQDMIScDeviceGen ALIAS ${TARGET_NAME})
16+
add_mqt_core_library(${TARGET_NAME} ALIAS_NAME QDMIScDeviceGen)
2117

2218
# add sources to target
2319
target_sources(${TARGET_NAME} PRIVATE Generator.cpp)
@@ -30,23 +26,13 @@ if(NOT TARGET ${TARGET_NAME})
3026
target_link_libraries(
3127
${TARGET_NAME}
3228
PUBLIC nlohmann_json::nlohmann_json
33-
PRIVATE spdlog::spdlog MQT::ProjectOptions MQT::ProjectWarnings)
29+
PRIVATE spdlog::spdlog)
3430

35-
# set versioning information
31+
# place the generated library in a predictable location where the executable can find it
3632
set_target_properties(
3733
${TARGET_NAME}
38-
PROPERTIES VERSION ${PROJECT_VERSION}
39-
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
40-
EXPORT_NAME CoreScDeviceGen)
41-
42-
# set c++ standard
43-
target_compile_features(${TARGET_NAME} PRIVATE cxx_std_20)
44-
45-
# add to list of MQT core targets
46-
set(MQT_CORE_TARGETS ${MQT_CORE_TARGETS} ${TARGET_NAME})
47-
48-
# Make version available
49-
target_compile_definitions(${TARGET_NAME} PRIVATE MQT_CORE_VERSION="${MQT_CORE_VERSION}")
34+
PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}"
35+
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
5036
endif()
5137

5238
# Set target name

0 commit comments

Comments
Β (0)