From e693a3afecd0d6a0318c394bc5bd214ff242a6be Mon Sep 17 00:00:00 2001 From: burgholzer Date: Thu, 22 May 2025 14:25:43 +0200 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=8E=A8=20use=20generator=20expression?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: burgholzer --- cmake/AddMQTCoreLibrary.cmake | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmake/AddMQTCoreLibrary.cmake b/cmake/AddMQTCoreLibrary.cmake index ec151ed16b..1f1a155890 100644 --- a/cmake/AddMQTCoreLibrary.cmake +++ b/cmake/AddMQTCoreLibrary.cmake @@ -22,11 +22,7 @@ endfunction() function(add_mqt_core_library name) cmake_parse_arguments(ARG "" "ALIAS_NAME" "" ${ARGN}) - if(BUILD_MQT_CORE_SHARED_LIBS) - add_library(${name} SHARED ${ARG_UNPARSED_ARGUMENTS}) - else() - add_library(${name} ${ARG_UNPARSED_ARGUMENTS}) - endif() + add_library(${name} $<$:SHARED> ${ARG_UNPARSED_ARGUMENTS}) if(NOT ARG_ALIAS_NAME) # remove prefix 'mqt-' from target name if exists string(REGEX REPLACE "^${MQT_CORE_TARGET_NAME}" "" ALIAS_NAME_ARG ${name}) From a53ee3ef09d764a20d1306a7f3cfd6bb991f71ed Mon Sep 17 00:00:00 2001 From: burgholzer Date: Thu, 22 May 2025 14:57:58 +0200 Subject: [PATCH 2/4] =?UTF-8?q?Revert=20"=F0=9F=8E=A8=20use=20generator=20?= =?UTF-8?q?expression"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a589d5d36776fab4d29c0e62f358a7d2d0030cbb. --- cmake/AddMQTCoreLibrary.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/AddMQTCoreLibrary.cmake b/cmake/AddMQTCoreLibrary.cmake index 1f1a155890..ec151ed16b 100644 --- a/cmake/AddMQTCoreLibrary.cmake +++ b/cmake/AddMQTCoreLibrary.cmake @@ -22,7 +22,11 @@ endfunction() function(add_mqt_core_library name) cmake_parse_arguments(ARG "" "ALIAS_NAME" "" ${ARGN}) - add_library(${name} $<$:SHARED> ${ARG_UNPARSED_ARGUMENTS}) + if(BUILD_MQT_CORE_SHARED_LIBS) + add_library(${name} SHARED ${ARG_UNPARSED_ARGUMENTS}) + else() + add_library(${name} ${ARG_UNPARSED_ARGUMENTS}) + endif() if(NOT ARG_ALIAS_NAME) # remove prefix 'mqt-' from target name if exists string(REGEX REPLACE "^${MQT_CORE_TARGET_NAME}" "" ALIAS_NAME_ARG ${name}) From ccb9ee4a694fb0142f2cedf75e4ee007f11e8a85 Mon Sep 17 00:00:00 2001 From: Yannick Stade <100073938+ystade@users.noreply.github.com> Date: Thu, 22 May 2025 14:46:56 +0200 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=9A=B8=20only=20build=20MQT=20Core=20?= =?UTF-8?q?libs=20as=20shared=20libraries?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: burgholzer --- pyproject.toml | 2 +- src/algorithms/CMakeLists.txt | 2 +- src/circuit_optimizer/CMakeLists.txt | 2 +- src/datastructures/CMakeLists.txt | 2 +- src/dd/CMakeLists.txt | 2 +- src/ir/CMakeLists.txt | 2 +- src/na/CMakeLists.txt | 2 +- src/qasm3/CMakeLists.txt | 2 +- src/zx/CMakeLists.txt | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 88229d671b..63296a1ebb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -117,7 +117,7 @@ git-only = [ [tool.scikit-build.cmake.define] BUILD_MQT_CORE_BINDINGS = "ON" BUILD_MQT_CORE_TESTS = "OFF" -BUILD_SHARED_LIBS = "ON" +BUILD_MQT_CORE_SHARED_LIBS = "ON" [[tool.scikit-build.overrides]] if.python-version = ">=3.13" diff --git a/src/algorithms/CMakeLists.txt b/src/algorithms/CMakeLists.txt index 9ea273690c..71f66b2bcf 100644 --- a/src/algorithms/CMakeLists.txt +++ b/src/algorithms/CMakeLists.txt @@ -42,7 +42,7 @@ if(NOT TARGET ${MQT_CORE_TARGET_NAME}-algorithms) ${MQT_CORE_TARGET_NAME}-algorithms PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/.. FILES ${CMAKE_CURRENT_BINARY_DIR}/mqt_core_algorithms_export.h) - if(NOT BUILD_SHARED_LIBS) + if(NOT BUILD_MQT_CORE_SHARED_LIBS) target_compile_definitions(${MQT_CORE_TARGET_NAME}-algorithms PUBLIC MQT_CORE_ALGO_STATIC_DEFINE) endif() diff --git a/src/circuit_optimizer/CMakeLists.txt b/src/circuit_optimizer/CMakeLists.txt index 056c95b362..4739d0f3dd 100644 --- a/src/circuit_optimizer/CMakeLists.txt +++ b/src/circuit_optimizer/CMakeLists.txt @@ -44,7 +44,7 @@ if(NOT TARGET ${MQT_CORE_TARGET_NAME}-circuit-optimizer) ${MQT_CORE_TARGET_NAME}-circuit-optimizer PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/.. FILES ${CMAKE_CURRENT_BINARY_DIR}/mqt_core_circuit_optimizer_export.h) - if(NOT BUILD_SHARED_LIBS) + if(NOT BUILD_MQT_CORE_SHARED_LIBS) target_compile_definitions(${MQT_CORE_TARGET_NAME}-circuit-optimizer PUBLIC MQT_CORE_CIRCUIT_OPTIMIZER_STATIC_DEFINE) endif() diff --git a/src/datastructures/CMakeLists.txt b/src/datastructures/CMakeLists.txt index 880b2789f9..8b8f624759 100644 --- a/src/datastructures/CMakeLists.txt +++ b/src/datastructures/CMakeLists.txt @@ -41,7 +41,7 @@ if(NOT TARGET ${MQT_CORE_TARGET_NAME}-ds) target_sources( ${MQT_CORE_TARGET_NAME}-ds PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/.. FILES ${CMAKE_CURRENT_BINARY_DIR}/mqt_core_ds_export.h) - if(NOT BUILD_SHARED_LIBS) + if(NOT BUILD_MQT_CORE_SHARED_LIBS) target_compile_definitions(${MQT_CORE_TARGET_NAME}-ds PUBLIC MQT_CORE_DS_STATIC_DEFINE) endif() diff --git a/src/dd/CMakeLists.txt b/src/dd/CMakeLists.txt index 83e70080e0..ca176d8e0b 100644 --- a/src/dd/CMakeLists.txt +++ b/src/dd/CMakeLists.txt @@ -41,7 +41,7 @@ if(NOT TARGET ${MQT_CORE_TARGET_NAME}-dd) target_sources( ${MQT_CORE_TARGET_NAME}-dd PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/.. FILES ${CMAKE_CURRENT_BINARY_DIR}/mqt_core_dd_export.h) - if(NOT BUILD_SHARED_LIBS) + if(NOT BUILD_MQT_CORE_SHARED_LIBS) target_compile_definitions(${MQT_CORE_TARGET_NAME}-dd PUBLIC MQT_CORE_DD_STATIC_DEFINE) endif() diff --git a/src/ir/CMakeLists.txt b/src/ir/CMakeLists.txt index 81c592942b..7081d5949f 100644 --- a/src/ir/CMakeLists.txt +++ b/src/ir/CMakeLists.txt @@ -42,7 +42,7 @@ if(NOT TARGET MQT::CoreIR) target_sources( ${MQT_CORE_TARGET_NAME}-ir PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/.. FILES ${CMAKE_CURRENT_BINARY_DIR}/mqt_core_ir_export.h) - if(NOT BUILD_SHARED_LIBS) + if(NOT BUILD_MQT_CORE_SHARED_LIBS) target_compile_definitions(${MQT_CORE_TARGET_NAME}-ir PUBLIC MQT_CORE_IR_STATIC_DEFINE) endif() diff --git a/src/na/CMakeLists.txt b/src/na/CMakeLists.txt index abaffa474e..7d79a575ff 100644 --- a/src/na/CMakeLists.txt +++ b/src/na/CMakeLists.txt @@ -41,7 +41,7 @@ if(NOT TARGET ${MQT_CORE_TARGET_NAME}-na) target_sources( ${MQT_CORE_TARGET_NAME}-na PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/.. FILES ${CMAKE_CURRENT_BINARY_DIR}/mqt_core_na_export.h) - if(NOT BUILD_SHARED_LIBS) + if(NOT BUILD_MQT_CORE_SHARED_LIBS) target_compile_definitions(${MQT_CORE_TARGET_NAME}-na PUBLIC MQT_CORE_NA_STATIC_DEFINE) endif() diff --git a/src/qasm3/CMakeLists.txt b/src/qasm3/CMakeLists.txt index a763e9077d..bc9ca5eebb 100644 --- a/src/qasm3/CMakeLists.txt +++ b/src/qasm3/CMakeLists.txt @@ -41,7 +41,7 @@ if(NOT TARGET MQT::CoreQASM) target_sources( ${MQT_CORE_TARGET_NAME}-qasm PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/.. FILES ${CMAKE_CURRENT_BINARY_DIR}/mqt_core_qasm_export.h) - if(NOT BUILD_SHARED_LIBS) + if(NOT BUILD_MQT_CORE_SHARED_LIBS) target_compile_definitions(${MQT_CORE_TARGET_NAME}-qasm PUBLIC MQT_CORE_QASM_STATIC_DEFINE) endif() diff --git a/src/zx/CMakeLists.txt b/src/zx/CMakeLists.txt index 1e2f0e35bb..af03034e61 100644 --- a/src/zx/CMakeLists.txt +++ b/src/zx/CMakeLists.txt @@ -85,7 +85,7 @@ if(NOT TARGET ${MQT_CORE_TARGET_NAME}-zx) target_sources( ${MQT_CORE_TARGET_NAME}-zx PUBLIC FILE_SET HEADERS BASE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/.. FILES ${CMAKE_CURRENT_BINARY_DIR}/mqt_core_zx_export.h) - if(NOT BUILD_SHARED_LIBS) + if(NOT BUILD_MQT_CORE_SHARED_LIBS) target_compile_definitions(${MQT_CORE_TARGET_NAME}-zx PUBLIC MQT_CORE_ZX_STATIC_DEFINE) endif() From de0fea3aaccc24866f8902c9f467d07941a5713e Mon Sep 17 00:00:00 2001 From: burgholzer Date: Thu, 22 May 2025 14:48:01 +0200 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=9A=B8=20add=20dedicated=20option=20i?= =?UTF-8?q?nitialized=20with=20`BUILD=5FSHARED=5FLIBS`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: burgholzer --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb9e5b808e..b039e24e8b 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,8 @@ endif() option(MQT_CORE_INSTALL "Generate installation instructions for MQT Core" ${MQT_CORE_MASTER_PROJECT}) option(BUILD_MQT_CORE_TESTS "Also build tests for the MQT Core project" ${MQT_CORE_MASTER_PROJECT}) +option(BUILD_MQT_CORE_SHARED_LIBS "Build MQT Core libraries as shared libraries" + ${BUILD_SHARED_LIBS}) # try to determine the project version include(GetVersion)