-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
29 lines (26 loc) · 1.52 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
cmake_minimum_required(VERSION 3.20)
project(qrack_device)
if (NOT MSVC)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(ENABLE_OPENCL "Use OpenCL optimizations" ON)
find_package(OpenCL)
if ((NOT OpenCL_FOUND) OR (APPLE AND NOT ((${CMAKE_SYSTEM_PROCESSOR} MATCHES "^amd") OR (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86_64"))))
set (ENABLE_OPENCL OFF)
endif ((NOT OpenCL_FOUND) OR (APPLE AND NOT ((${CMAKE_SYSTEM_PROCESSOR} MATCHES "^amd") OR (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86_64"))))
add_library(qrack_device SHARED pennylane_qrack/qrack_device.cpp)
target_link_directories(qrack_device PUBLIC ${CMAKE_SOURCE_DIR}/catalyst/runtime/include ${CMAKE_SOURCE_DIR}/qrack/build)
target_include_directories(qrack_device PUBLIC ${CMAKE_SOURCE_DIR}/catalyst/runtime/include ${CMAKE_SOURCE_DIR}/_qrack_include)
if (ENABLE_OPENCL)
if (APPLE)
target_include_directories(qrack_device PUBLIC ${CMAKE_SOURCE_DIR}/qrack/build/_deps/opencl-headers-src/ ${CMAKE_SOURCE_DIR}/qrack/build/_deps/opencl-clhpp-src/include/)
target_link_libraries(qrack_device PUBLIC qrack "-framework OpenCL")
else (APPLE)
target_link_libraries(qrack_device PUBLIC qrack OpenCL)
endif (APPLE)
else (ENABLE_OPENCL)
target_link_libraries(qrack_device PUBLIC qrack)
endif (ENABLE_OPENCL)
set_property(TARGET qrack_device PROPERTY POSITION_INDEPENDENT_CODE ON)
install(TARGETS qrack_device LIBRARY DESTINATION pennylane_qrack)
endif (NOT MSVC)