-
Notifications
You must be signed in to change notification settings - Fork 159
/
CMakeLists.txt
46 lines (41 loc) · 1.38 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
set(CMAKE_CXX_STANDARD 11)
cmake_minimum_required(VERSION 3.11)
# Check if CMAKE_SYSTEM_NAME is Darwin (macOS) and CMAKE_SYSTEM_PROCESSOR is arm64
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(APPLE_ARM TRUE)
else()
set(APPLE_ARM FALSE)
endif()
# Set the project name and language
if(APPLE)
project(qsim LANGUAGES CXX)
else()
execute_process(COMMAND which nvcc OUTPUT_VARIABLE has_nvcc OUTPUT_STRIP_TRAILING_WHITESPACE)
if(has_nvcc)
project(qsim LANGUAGES CXX CUDA)
else()
execute_process(COMMAND which hipcc OUTPUT_VARIABLE has_hipcc OUTPUT_STRIP_TRAILING_WHITESPACE)
if(has_hipcc)
project(qsim LANGUAGES CXX HIP)
else()
project(qsim LANGUAGES CXX)
endif()
endif()
endif()
find_package(OpenMP REQUIRED)
# Add subdirectories based on the architecture or available compilers
ADD_SUBDIRECTORY(pybind_interface/basic)
ADD_SUBDIRECTORY(pybind_interface/decide)
if(NOT APPLE_ARM)
if(has_nvcc)
ADD_SUBDIRECTORY(pybind_interface/cuda)
if(DEFINED ENV{CUQUANTUM_ROOT})
ADD_SUBDIRECTORY(pybind_interface/custatevec)
endif()
elseif(has_hipcc)
ADD_SUBDIRECTORY(pybind_interface/hip)
endif()
ADD_SUBDIRECTORY(pybind_interface/sse)
ADD_SUBDIRECTORY(pybind_interface/avx512)
ADD_SUBDIRECTORY(pybind_interface/avx2)
endif()