1
1
# set required cmake version
2
- cmake_minimum_required (VERSION 3.19...3.28 )
2
+ cmake_minimum_required (VERSION 3.19...3.30 )
3
3
4
4
project (
5
5
mqt-qcec
6
6
LANGUAGES CXX
7
7
DESCRIPTION "MQT QCEC - A tool for Quantum Circuit Equivalence Checking" )
8
8
9
- option (BUILD_MQT_QCEC_TESTS "Also build tests for the MQT QCEC project" ON )
10
9
option (BUILD_MQT_QCEC_BINDINGS "Build the MQT QCEC Python bindings" OFF )
11
-
12
10
if (BUILD_MQT_QCEC_BINDINGS)
13
11
# ensure that the BINDINGS option is set
14
12
set (BINDINGS
@@ -25,15 +23,32 @@ if(BUILD_MQT_QCEC_BINDINGS)
25
23
ON
26
24
CACHE BOOL "Prevent multiple searches for Python and instead cache the results." )
27
25
26
+ if (DISABLE_GIL)
27
+ message (STATUS "Disabling Python GIL" )
28
+ add_compile_definitions (Py_GIL_DISABLED)
29
+ endif ()
30
+
28
31
# top-level call to find Python
29
32
find_package (
30
- Python 3.8 REQUIRED
33
+ Python 3.9 REQUIRED
31
34
COMPONENTS Interpreter Development.Module
32
35
OPTIONAL_COMPONENTS Development.SABIModule)
33
36
endif ()
34
37
38
+ # check if this is the master project or used via add_subdirectory
39
+ if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME )
40
+ set (MQT_QCEC_MASTER_PROJECT ON )
41
+ else ()
42
+ set (MQT_QCEC_MASTER_PROJECT OFF )
43
+ endif ()
44
+
45
+ option (BUILD_MQT_QCEC_TESTS "Also build tests for the MQT QCEC project" ${MQT_QCEC_MASTER_PROJECT} )
46
+
35
47
include (cmake/ExternalDependencies.cmake)
36
48
49
+ # set the include directory for the build tree
50
+ set (MQT_QCEC_INCLUDE_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR} /include" )
51
+
37
52
# add main library code
38
53
add_subdirectory (src)
39
54
@@ -44,7 +59,15 @@ if(BUILD_MQT_QCEC_TESTS)
44
59
add_subdirectory (test )
45
60
endif ()
46
61
47
- configure_file (${CMAKE_CURRENT_SOURCE_DIR} /cmake/cmake_uninstall.cmake.in
48
- ${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake IMMEDIATE @ONLY)
49
- add_custom_target (uninstall COMMAND ${CMAKE_COMMAND} -P
50
- ${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake)
62
+ if (MQT_QCEC_MASTER_PROJECT)
63
+ if (NOT TARGET mqt-qcec-uninstall)
64
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR} /cmake/cmake_uninstall.cmake.in
65
+ ${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake IMMEDIATE @ONLY)
66
+ add_custom_target (mqt-qcec-uninstall COMMAND ${CMAKE_COMMAND} -P
67
+ ${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake)
68
+ endif ()
69
+ else ()
70
+ set (mqt-qcec_FOUND
71
+ TRUE
72
+ CACHE INTERNAL "True if mqt-qcec is found on the system" )
73
+ endif ()
0 commit comments