-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
146 lines (127 loc) · 4.31 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
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
cmake_minimum_required (VERSION 3.8 FATAL_ERROR)
option(COMPILE_TESTS "Compile tests" OFF) #ON by default
project (FastVQA
LANGUAGES C CXX
DESCRIPTION "High performance variational quantum algorithms simulation framework"
VERSION 0.1.0
)
set(namespace "fastVQA")
set(CMAKE_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
set(CMAKE_BUILD_TYPE Release)
set(QUEST_PRECISION 4)
include(GNUInstallDirs)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
message(
STATUS
"CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
)
set(public_headers
include/fastVQA.h
include/vqas/vqe.h
include/vqas/qaoa.h
include/vqas/vqeOptions.h
include/vqas/vqaOptions.h
include/vqas/qaoaOptions.h
include/ansatz.h
include/cost_function.h
include/accelerator.h
include/accelerator_base.h
include/aqc_pqc/AqcPqcAccelerator.h
include/pauliHamiltonian.h
include/experimentBuffer.h
include/circuit.h
include/gate.h
include/optimizer.h
include/symbolic_manipulation.h
${CMAKE_CURRENT_SOURCE_DIR}/quantum_backends/QuEST/QuEST/include/QuEST.h
${CMAKE_CURRENT_SOURCE_DIR}/quantum_backends/QuEST/QuEST/include/QuEST_precision.h
)
if(DEFINED GMP_H_DIR)
set (CMAKE_CXX_FLAGS "-I${GMP_H_DIR} -L${GMP_L_DIR} -g3 -Wall -O2")
else()
set (CMAKE_CXX_FLAGS "-I ~/.local/include -L ~/.local/lib -g3 -Wall -O2")
endif()
add_subdirectory(src/optimizer)
add_subdirectory(quantum_backends)
add_library(${PROJECT_NAME} STATIC)
target_sources(${PROJECT_NAME}
PRIVATE
src/vqas/vqe.cpp
src/vqas/qaoa.cpp
src/aqc_pqc/aqc_pqc_accelerator.cpp
src/aqc_pqc/aqc_pqc_opt_rank_reduce.cpp
src/aqc_pqc/aqc_pqc_opt_trivial.cpp
src/aqc_pqc/derivatives_evaluation.cpp
src/gate.cpp
src/circuit.cpp
src/ansatz.cpp
src/accelerator.cpp
src/pauliHamiltonian.cpp
src/accelerator_base.cpp
src/symbolic_manipulation.cpp
#${quest_src}
${optimizer_src}
)
target_include_directories(${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include/internal
${CMAKE_CURRENT_SOURCE_DIR}/include/internal/vqas
${CMAKE_CURRENT_SOURCE_DIR}/include/internal/aqc_pqc
${CMAKE_CURRENT_SOURCE_DIR}/src/optimizer/nlopt/src/api
${CMAKE_CURRENT_SOURCE_DIR}/quantum_backends/QuEST/QuEST/include
#${CMAKE_CURRENT_SOURCE_DIR}/quantum_backends/QuEST/QuEST/include
#${CMAKE_CURRENT_SOURCE_DIR}/quantum_backends/QuEST/QuEST/src
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
#find_package(QuEST)
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${public_headers}")
target_link_libraries(${PROJECT_NAME} PRIVATE QuEST nlopt Eigen3::Eigen)
target_compile_definitions(${PROJECT_NAME}
PRIVATE
QuEST_PREC=${QUEST_PRECISION}
)
install(TARGETS ${PROJECT_NAME} nlopt QuEST
EXPORT "${PROJECT_NAME}Targets"
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
# generate and install export file
install(EXPORT "${PROJECT_NAME}Targets"
FILE "${PROJECT_NAME}Targets.cmake"
NAMESPACE ${namespace}::
DESTINATION cmake
)
include(CMakePackageConfigHelpers)
# generate the version file for the config file
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION "${version}"
COMPATIBILITY AnyNewerVersion
)
# create config file
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION cmake
)
# install config files
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION cmake
)
# generate the export targets for the build tree
export(EXPORT "${PROJECT_NAME}Targets"
FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Targets.cmake"
NAMESPACE ${namespace}::
)
if(COMPILE_TESTS)
add_subdirectory(tests)
endif(COMPILE_TESTS)
unset(COMPILE_TESTS CACHE)