diff --git a/CHANGELOG.md b/CHANGELOG.md index 59667d0ce..0dde54d5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ This project adheres to [Semantic Versioning], with the exception that minor rel ### Changed +- 👨‍💻📦 Build `spdlog` as a shared library on project installs ([#1411]) ([**@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**]) @@ -287,6 +288,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool +[#1411]: https://github.com/munich-quantum-toolkit/core/pull/1411 [#1406]: https://github.com/munich-quantum-toolkit/core/pull/1406 [#1402]: https://github.com/munich-quantum-toolkit/core/pull/1402 [#1385]: https://github.com/munich-quantum-toolkit/core/pull/1385 diff --git a/cmake/ExternalDependencies.cmake b/cmake/ExternalDependencies.cmake index 6f00a3e34..6f0fcda09 100644 --- a/cmake/ExternalDependencies.cmake +++ b/cmake/ExternalDependencies.cmake @@ -10,6 +10,7 @@ include(FetchContent) include(CMakeDependentOption) +include(GNUInstallDirs) set(FETCH_PACKAGES "") if(BUILD_MQT_CORE_BINDINGS) @@ -94,15 +95,25 @@ 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(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}) list(APPEND FETCH_PACKAGES spdlog) # Make all declared dependencies available. FetchContent_MakeAvailable(${FETCH_PACKAGES}) +# Ensure external shared libraries end up in a common lib layout used by our RUNPATH +if(TARGET spdlog) + set_target_properties( + spdlog + 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() + # Patch for spdlog cmake files to be installed in a common cmake directory if(SPDLOG_INSTALL) - include(GNUInstallDirs) install( CODE " file(GLOB SPDLOG_CMAKE_FILES diff --git a/src/qdmi/na/CMakeLists.txt b/src/qdmi/na/CMakeLists.txt index 79bf8d48e..2eb8e54ac 100644 --- a/src/qdmi/na/CMakeLists.txt +++ b/src/qdmi/na/CMakeLists.txt @@ -26,7 +26,7 @@ if(NOT TARGET ${TARGET_NAME}) target_sources(${TARGET_NAME} PUBLIC FILE_SET HEADERS BASE_DIRS ${MQT_CORE_INCLUDE_BUILD_DIR} FILES ${MQT_CORE_INCLUDE_BUILD_DIR}/qdmi/na/Generator.hpp) - # Link nlohmann_json, spdlog + # Link nlohmann_json and spdlog target_link_libraries( ${TARGET_NAME} PUBLIC nlohmann_json::nlohmann_json diff --git a/src/qdmi/sc/CMakeLists.txt b/src/qdmi/sc/CMakeLists.txt index e6dc288d9..67a7d1a05 100644 --- a/src/qdmi/sc/CMakeLists.txt +++ b/src/qdmi/sc/CMakeLists.txt @@ -26,7 +26,7 @@ if(NOT TARGET ${TARGET_NAME}) target_sources(${TARGET_NAME} PUBLIC FILE_SET HEADERS BASE_DIRS ${MQT_CORE_INCLUDE_BUILD_DIR} FILES ${MQT_CORE_INCLUDE_BUILD_DIR}/qdmi/sc/Generator.hpp) - # Link nlohmann_json, spdlog + # Link nlohmann_json and spdlog target_link_libraries( ${TARGET_NAME} PUBLIC nlohmann_json::nlohmann_json