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) 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()