-
-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
104 lines (87 loc) · 3.29 KB
/
CMakeLists.txt
File metadata and controls
104 lines (87 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
# Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
# All rights reserved.
#
# SPDX-License-Identifier: MIT
#
# Licensed under the MIT License
# set required cmake version
cmake_minimum_required(VERSION 3.24...4.0)
project(
mqt-ddsim
LANGUAGES C CXX
DESCRIPTION "MQT DDSIM - A quantum circuit simulator based on decision diagrams")
set(CMAKE_CXX_STANDARD 20)
option(BUILD_MQT_DDSIM_BINDINGS "Build the MQT DDSIM Python bindings" OFF)
if(BUILD_MQT_DDSIM_BINDINGS)
# ensure that the BINDINGS option is set
set(BINDINGS
ON
CACHE INTERNAL "Enable settings related to Python bindings")
# Some common settings for finding Python
set(Python_FIND_VIRTUALENV
FIRST
CACHE STRING "Give precedence to virtualenvs when searching for Python")
set(Python_FIND_FRAMEWORK
LAST
CACHE STRING "Prefer Brew/Conda to Apple framework Python")
set(Python_ARTIFACTS_INTERACTIVE
ON
CACHE BOOL "Prevent multiple searches for Python and instead cache the results.")
if(DISABLE_GIL)
message(STATUS "Disabling Python GIL")
add_compile_definitions(Py_GIL_DISABLED)
endif()
# top-level call to find Python
find_package(Python 3.10 REQUIRED COMPONENTS Interpreter Development.Module
${SKBUILD_SABI_COMPONENT})
endif()
# check if this is the master project or used via add_subdirectory
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(MQT_DDSIM_MASTER_PROJECT ON)
else()
set(MQT_DDSIM_MASTER_PROJECT OFF)
endif()
option(BUILD_MQT_DDSIM_TESTS "Also build tests for the MQT DDSIM project"
${MQT_DDSIM_MASTER_PROJECT})
option(BUILD_MQT_DDSIM_CLI "Build the MQT DDSIM command line interface" ${MQT_DDSIM_MASTER_PROJECT})
# on macOS with GCC, disable module scanning
# https://www.reddit.com/r/cpp_questions/comments/1kwlkom/comment/ni5angh/
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.28")
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
else()
message(WARNING "CMake 3.28+ is required to disable C++ module scanning on macOS with GCC. "
"Current version: ${CMAKE_VERSION}. "
"Consider upgrading CMake to avoid potential build issues.")
endif()
endif()
include(cmake/ExternalDependencies.cmake)
# set the include directory for the build tree
set(MQT_DDSIM_INCLUDE_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
# set prefix for all MQT DDSIM targets
set(MQT_DDSIM_TARGET_NAME mqt-ddsim)
add_subdirectory(src)
if(BUILD_MQT_DDSIM_BINDINGS)
add_subdirectory(bindings)
endif()
if(BUILD_MQT_DDSIM_TESTS)
enable_testing()
include(GoogleTest)
add_subdirectory(test)
endif()
if(BUILD_MQT_DDSIM_CLI)
add_subdirectory(apps)
endif()
if(MQT_DDSIM_MASTER_PROJECT)
if(NOT TARGET mqt-ddsim-uninstall)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY)
add_custom_target(mqt-ddsim-uninstall COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
else()
set(mqt-ddsim_FOUND
TRUE
CACHE INTERNAL "True if mqt-ddsim is found on the system")
endif()