forked from lsschmid/mqt-qmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
62 lines (54 loc) · 1.89 KB
/
CMakeLists.txt
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
# set required cmake version
cmake_minimum_required(VERSION 3.19...3.27)
project(
qmap
LANGUAGES CXX
DESCRIPTION "MQT QMAP - A library for mapping of quantum circuits to quantum architectures")
# check whether the submodule ``modulename`` is correctly cloned in the ``/extern`` directory.
macro(CHECK_SUBMODULE_PRESENT modulename)
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/extern/${modulename}/CMakeLists.txt")
message(
FATAL_ERROR
"${modulename} submodule not cloned properly. \
Please run `git submodule update --init --recursive` \
from the main project directory")
endif()
endmacro()
check_submodule_present(mqt-core)
check_submodule_present(LogicBlocks)
option(BUILD_MQT_QMAP_BINDINGS "Build the MQT QMAP Python bindings" OFF)
if(BUILD_MQT_QMAP_BINDINGS)
# ensure that the BINDINGS option is set
set(BINDINGS
ON
CACHE BOOL "Enable settings related to Python bindings" FORCE)
# cmake-lint: disable=C0103
set(Python_FIND_VIRTUALENV
FIRST
CACHE STRING "Give precedence to virtualenvs when searching for Python")
# cmake-lint: disable=C0103
set(Python_ARTIFACTS_INTERACTIVE
ON
CACHE BOOL "Prevent multiple searches for Python and instead cache the results.")
# top-level call to find Python
find_package(
Python 3.8 REQUIRED
COMPONENTS Interpreter Development.Module
OPTIONAL_COMPONENTS Development.SABIModule)
endif()
# Add path for custom modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# search for Z3
find_package(Z3 4.8.15)
if(NOT Z3_FOUND)
message(WARNING "Did not find Z3. Exact library and other depending target will not be available")
endif()
# add main library code
add_subdirectory(src)
# add test code
option(BUILD_MQT_QMAP_TESTS "Also build tests for the MQT QMAP project" ON)
if(BUILD_MQT_QMAP_TESTS)
enable_testing()
include(GoogleTest)
add_subdirectory(test)
endif()