-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
146 lines (123 loc) · 4.07 KB
/
CMakeLists.txt
File metadata and controls
146 lines (123 loc) · 4.07 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# ------------------------------------------------------------------------------
# Copyright 2024 Munich Quantum Software Stack Project
#
# Licensed under the Apache License, Version 2.0 with LLVM Exceptions (the
# "License"); you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://github.com/Munich-Quantum-Software-Stack/QDMI-Devices/blob/develop/LICENSE
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# ------------------------------------------------------------------------------
# set required cmake version
cmake_minimum_required(VERSION 3.19...3.30)
project(
Backends
VERSION 0.1
DESCRIPTION "QDMI Backends"
LANGUAGES C)
# Generate compile_commands.json to make it easier to work with clang based
# tools
set(CMAKE_EXPORT_COMPILE_COMMANDS
ON
CACHE BOOL "Export compile commands" FORCE)
option(BUILD_BACKEND_TESTS "Build the backend tests" ON)
option(BUILD_DOCUMENTATION "Build the documentations" OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(AVAILABLE_MODULES lrz eviden dcdb databases datacenters simulators)
# Main config variable for users
set(BUILD_MODULES
"all"
CACHE STRING "Semicolon-separated list of modules to build (or 'all')")
# Normalize and parse user input
string(TOLOWER "${BUILD_MODULES}" BUILD_MODULES)
string(REPLACE " " "" BUILD_MODULES "${BUILD_MODULES}")
string(REPLACE "," ";" BUILD_MODULES "${BUILD_MODULES}")
set(ENABLED_MODULES "")
if(BUILD_MODULES STREQUAL "all")
set(ENABLED_MODULES ${AVAILABLE_MODULES})
else()
foreach(module ${BUILD_MODULES})
list(FIND AVAILABLE_MODULES ${module} index)
if(index EQUAL -1)
message(
FATAL_ERROR
"Unknown module: '${module}'. Available modules: ${AVAILABLE_MODULES}"
)
endif()
list(APPEND ENABLED_MODULES ${module})
endforeach()
endif()
# Show what's being built
message(STATUS "Enabled modules: ${ENABLED_MODULES}")
# Include submodules conditionally
foreach(module ${AVAILABLE_MODULES})
list(FIND ENABLED_MODULES ${module} index)
if(NOT index EQUAL -1)
message(STATUS "Including module: ${module}")
if(module STREQUAL "lrz")
option(BUILD_BACKEND_LRZ "Build LRZ Backend" ON)
elseif(module STREQUAL "eviden")
option(BUILD_BACKEND_EVIDEN "Build EVIDEN Backend" ON)
elseif(module STREQUAL "dcdb")
option(BUILD_BACKEND_DCDB "Build DCDB Backend" ON)
elseif(module STREQUAL "simulators")
option(BUILD_SIMULATOR "Build Simulator Backends" ON)
elseif(module STREQUAL "datacenters")
option(BUILD_DATACENTERS "Build Datacenter Backends" ON)
elseif(module STREQUAL "databases")
option(BUILD_DATABASES "Build Database Backends" ON)
endif()
else()
message(STATUS "Skipping module: ${module}")
endif()
endforeach()
if(BUILD_DATACENTERS)
set(BUILD_BACKEND_LRZ
ON
CACHE BOOL "" FORCE)
endif()
if(BUILD_DATABASES)
set(BUILD_BACKEND_DCDB
ON
CACHE BOOL "" FORCE)
endif()
if(BUILD_SIMULATOR)
set(BUILD_BACKEND_EVIDEN
ON
CACHE BOOL "" FORCE)
endif()
if(BUILD_BACKEND_EVIDEN)
set(QAPTIVA_QDMI_PREFIX "QAPTIVA")
endif()
if(BUILD_BACKEND_DCDB)
set(DCDB_QDMI_PREFIX "DCDB")
endif()
if(BUILD_BACKEND_LRZ)
set(LRZ_QDMI_PREFIX "LRZ")
endif()
if(ENABLE_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0 -g")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -O0 -g")
endif()
include(cmake/ExternalDependencies.cmake)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED True)
set(CMAKE_C_EXTENSIONS False)
enable_language(CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_subdirectory(src)
if(BUILD_BACKEND_TESTS)
add_subdirectory(tests)
endif()
if(BUILD_DOCUMENTATION)
add_subdirectory(docs)
endif()