forked from qulacs/qulacs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
489 lines (436 loc) · 15.2 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
cmake_minimum_required(VERSION 3.0)
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
project(qulacs)
##### Set default behavior #####
set(DEFAULT_USE_OMP Yes)
set(DEFAULT_USE_MPI No)
set(DEFAULT_USE_GPU No)
set(DEFAULT_USE_PYTHON Yes)
set(DEFAULT_USE_TEST No)
set(DEFAULT_COVERAGE No)
if(("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "aarch64") OR
("${CMAKE_C_COMPILER}" MATCHES "/usr/bin/aarch64-linux-gnu-gcc*")) # for cross-compile
message(STATUS "SIMD SUPPORT: Yes")
set(DEFAULT_OPT_FLAGS "-mtune=native -march=native")
set(DEFAULT_USE_SIMD Yes)
elseif(("${CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "^x86.*") OR
("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "AMD64"))
message(STATUS "SIMD SUPPORT: Yes")
set(DEFAULT_OPT_FLAGS "-mtune=native -march=native")
set(DEFAULT_USE_SIMD Yes)
else()
message(STATUS "SIMD SUPPORT: No")
set(DEFAULT_USE_SIMD No)
endif()
##### Check compiler Version #####
message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "CMAKE_C_COMPILER_VERSION = ${CMAKE_C_COMPILER_VERSION}")
message(STATUS "CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
if(${CMAKE_C_COMPILER_VERSION} VERSION_LESS 7.0.0)
message(FATAL_ERROR "gcc >= 7.0.0 is required.")
endif()
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 7.0.0)
message(FATAL_ERROR "g++ >= 7.0.0 is required.")
endif()
set(DEFAULT_OPT_FLAGS "${DEFAULT_OPT_FLAGS} -mfpmath=both")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
message(STATUS "MSVC_VERSION = ${MSVC_VERSION}")
if(${MSVC_VERSION} VERSION_LESS 1900)
message(FATAL_ERROR "MSVC >= 2015 is required.")
endif()
elseif ((${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang"))
set(DEFAULT_USE_OMP No)
if(${COVERAGE})
message(FATAL_ERROR "Coverage is not supported for clang. Do not set COVERAGE=Yes on this environment.")
endif()
else()
message(FATAL_ERROR "Unsupported Compiler.")
endif()
##### Update with given flags #####
if(NOT DEFINED USE_SIMD)
set(USE_SIMD ${DEFAULT_USE_SIMD})
endif()
if(NOT DEFINED USE_OMP)
set(USE_OMP ${DEFAULT_USE_OMP})
endif()
if(NOT DEFINED USE_MPI)
set(USE_MPI ${DEFAULT_USE_MPI})
endif()
if(NOT DEFINED USE_GPU)
set(USE_GPU ${DEFAULT_USE_GPU})
endif()
if(NOT DEFINED USE_PYTHON)
set(USE_PYTHON ${DEFAULT_USE_PYTHON})
endif()
if(NOT DEFINED USE_TEST)
set(USE_TEST ${DEFAULT_USE_TEST})
endif()
if(NOT DEFINED COVERAGE)
set(COVERAGE ${DEFAULT_COVERAGE})
endif()
if(NOT DEFINED OPT_FLAGS)
set(OPT_FLAGS ${DEFAULT_OPT_FLAGS})
endif()
message(STATUS "CMAKE_HOST_SYSTEM_PROCESSOR = ${CMAKE_HOST_SYSTEM_PROCESSOR}")
message(STATUS "USE_SIMD = ${USE_SIMD}")
message(STATUS "USE_OMP = ${USE_OMP}")
message(STATUS "USE_MPI = ${USE_MPI}")
message(STATUS "USE_GPU = ${USE_GPU}")
message(STATUS "USE_TEST = ${USE_TEST}")
message(STATUS "COVERAGE = ${COVERAGE}")
message(STATUS "USE_PYTHON = ${USE_PYTHON}")
message(STATUS "OPT_FLAGS = ${OPT_FLAGS}")
##### configure include files #####
file(GLOB_RECURSE header_files ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h)
foreach(path IN LISTS header_files)
string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/src/ ${CMAKE_CURRENT_SOURCE_DIR}/include/ path_dst ${path})
configure_file(${path} ${path_dst} COPYONLY)
endforeach()
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
##### set external projects #####
include(ExternalProject)
include(${CMAKE_SOURCE_DIR}/cmake_script/FetchContent.cmake)
# Boost
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
# The minimum version tested in CI is 1.71.0.
find_package(Boost 1.71.0 REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost not found. Please install boost.")
endif()
message(STATUS "Boost found at ${Boost_INCLUDE_DIRS}")
# Eigen
set(EIGEN_BUILD_DIR ${CMAKE_BINARY_DIR}/eigen)
set(EIGEN_INSTALL_DIR ${CMAKE_SOURCE_DIR}/include)
set(EIGEN_INCLUDE_DIR ${EIGEN_INSTALL_DIR})
ExternalProject_Add(
eigen
URL https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.gz
PREFIX ${EIGEN_BUILD_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} -E copy_directory ${EIGEN_BUILD_DIR}/src/eigen/Eigen ${EIGEN_INCLUDE_DIR}/Eigen
&& ${CMAKE_COMMAND} -E copy_directory ${EIGEN_BUILD_DIR}/src/eigen/unsupported ${EIGEN_INCLUDE_DIR}/unsupported
TEST_COMMAND ""
)
include_directories(SYSTEM ${EIGEN_INCLUDE_DIR})
# Cereal
set(CEREAL_BUILD_DIR ${CMAKE_BINARY_DIR}/cereal)
set(CEREAL_INSTALL_DIR ${CMAKE_SOURCE_DIR}/include)
set(CEREAL_INCLUDE_DIR ${CEREAL_INSTALL_DIR})
ExternalProject_Add(
Cereal
URL https://github.com/USCiLab/cereal/archive/v1.3.0.tar.gz
PREFIX ${CEREAL_BUILD_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} -E copy_directory ${CEREAL_BUILD_DIR}/src/Cereal/include ${CEREAL_INCLUDE_DIR}
TEST_COMMAND ""
)
include_directories(SYSTEM ${CEREAL_INCLUDE_DIR})
# Google test
if(USE_TEST)
FetchContent_Declare(
googletest_fetch
GIT_REPOSITORY https://github.com/google/googletest
GIT_TAG release-1.8.1
)
FetchContent_GetProperties(googletest_fetch)
if(NOT googletest_fetch_POPULATED)
message(STATUS "Fetch googletest for C++ testing")
FetchContent_Populate(googletest_fetch)
add_subdirectory(${googletest_fetch_SOURCE_DIR})
endif()
else()
message(STATUS "Skip downloding googletest")
endif()
# Pybind11
if(USE_PYTHON)
if(MSYS OR MINGW OR CYGWIN)
set(PYBIND11_BUILD_DIR ${CMAKE_BINARY_DIR}/pybind11)
set(PYBIND11_INSTALL_DIR ${CMAKE_SOURCE_DIR}/python/pybind11)
set(PYBIND11_INCLUDE_DIR ${PYBIND11_INSTALL_DIR}/include)
ExternalProject_Add(
pybind11_pop
URL http://github.com/pybind/pybind11/archive/v2.10.0.tar.gz
PREFIX ${PYBIND11_BUILD_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} -E copy_directory ${PYBIND11_BUILD_DIR}/src/pybind11_pop ${PYBIND11_INSTALL_DIR}
TEST_COMMAND ""
)
include_directories(SYSTEM ${PYBIND11_INCLUDE_DIR})
else()
FetchContent_Declare(
pybind11_fetch
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG v2.10.0
)
FetchContent_GetProperties(pybind11_fetch)
if(NOT pybind11_fetch_POPULATED)
message(STATUS "Fetch pybind11 for python-binding")
FetchContent_Populate(pybind11_fetch)
add_subdirectory(${pybind11_fetch_SOURCE_DIR})
endif()
endif()
else()
message(STATUS "Skip downloading pybind11")
endif()
##### set warnings #####
if(NOT USE_GPU)
set(WARNING_C "-Wall -Wextra -Werror=undef -Wlogical-op -Wmissing-include-dirs \
-Wpointer-arith -Winit-self -Wfloat-equal -Wsuggest-attribute=noreturn \
-Werror=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type \
-Werror=incompatible-pointer-types -Werror=format=2 -Wredundant-decls -Wmissing-noreturn \
-Wimplicit-fallthrough=5 -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Werror=overflow -Wdate-time \
-Wnested-externs -fdiagnostics-color=auto")
set(WARNING_CPP "-Wall -Wextra -Wlogical-op -Wmissing-include-dirs \
-Wpointer-arith -Winit-self -Wfloat-equal -Wsuggest-attribute=noreturn \
-Werror=missing-declarations -Werror=return-type \
-Werror=format=2 -Wredundant-decls -Wmissing-noreturn \
-Wimplicit-fallthrough=5 -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Werror=overflow -Wdate-time \
-fdiagnostics-color=auto")
# -Werror=undef is eliminated due to conflict with boost
endif()
##### set output directory #####
# PYTHON_SETUP_FLAG is set if you have run setup.py previously.
if(NOT DEFINED PYTHON_SETUP_FLAG)
message(STATUS "Install from cmakebuild")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)
if(MSVC)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/../lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/../bin)
endif()
else()
message(STATUS "Install from pip")
endif()
##### set flags #####
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang"))
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Set C++ standard
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(PYBIND11_CPP_STANDARD -std=c++14)
# Enable pthread
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
# Enable imaginary literals for C++
if(NOT MINGW)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals")
endif()
# Enable openmp
if(USE_OMP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
endif()
# Enable openmpi
if(USE_MPI)
if((NOT "${CMAKE_C_COMPILER}" MATCHES ".*mpicc") OR
(NOT "${CMAKE_CXX_COMPILER}" MATCHES ".*mpic\\+\\+"))
message(FATAL_ERROR, "USE_MPI must be used in mpicc/mpic++.")
endif()
add_compile_options("-D _USE_MPI -lmpi")
endif()
# Enable gpu
if(USE_GPU)
add_compile_options("-D _USE_GPU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
add_compile_options("-fPIC")
endif()
# Enable simd
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
## Check if SVE is supported
include(${CMAKE_SOURCE_DIR}/cmake_script/FindSVE.cmake)
CHECK_SVE_LINUX()
message(STATUS "SVE_FOUND = ${SVE_FOUND}")
if(USE_SIMD AND SVE_FOUND)
message(STATUS "SVE Enabled")
add_compile_options("-D _USE_SVE")
else()
message(STATUS "SVE Disabled")
endif()
elseif("${CMAKE_C_COMPILER}" MATCHES "/usr/bin/aarch64-linux-gnu-gcc*") # for cross-compile
message(STATUS "SVE Enabled(force)")
add_compile_options("-D _USE_SVE")
elseif(("${CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "^x86.*") OR
("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "AMD64"))
## Check if AVX2 is supported
include(${CMAKE_SOURCE_DIR}/cmake_script/FindAVX2.cmake)
CHECK_AVX2_LINUX()
message(STATUS "AVX2_FOUND = ${AVX2_FOUND}")
if(USE_SIMD AND AVX2_FOUND)
message(STATUS "AVX2 Enabled")
add_compile_options("-D _USE_SIMD")
else()
message(STATUS "AVX2 Disabled")
endif()
endif()
# Add optimization flags
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${OPT_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OPT_FLAGS}")
# Add coverage flags
if(COVERAGE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
SET(CMAKE_C_COMPILER ${CMAKE_CXX_COMPILER})
elseif(MSVC)
# Compile csim with cpp compiler since VC does not completely support C99 complex values
# SET(CMAKE_C_COMPILER ${CMAKE_CXX_COMPILER})
# add_compile_options("/TP")
# Ignore warning
## ignore warning about template export
add_compile_options(/wd4251)
## ignore warning on non-Unicode files
add_compile_options(/wd4819)
# Enable simd
## Check if AVX2 is supported
include(${CMAKE_SOURCE_DIR}/cmake_script/FindAVX2.cmake)
CHECK_AVX2_WINDOWS()
message(STATUS "AVX2_FOUND = ${AVX2_FOUND}")
if(USE_SIMD AND AVX2_FOUND)
message(STATUS "AVX2 Enabled")
add_compile_options("/D_USE_SIMD")
else()
message(STATUS "AVX2 Disabled")
endif()
# enable openmp
if(USE_OMP)
add_compile_options("/openmp")
endif()
# enable mpi
if(USE_MPI)
message(FATAL_ERROR, "USE_MPI is not supported in MSVC environment.")
endif()
# enable gpu
if(USE_GPU)
add_compile_options("/D_USE_GPU")
endif()
# Static link to multithread runtimes
set(variables
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_MINSIZEREL
)
foreach(variable ${variables})
if(${variable} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
endif()
endforeach()
else()
message(FATAL "Unsupported environment")
endif()
##### show configurations #####
message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
message(STATUS "CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}")
message(STATUS "CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}")
message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
message(STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_CXX_FLAGS_DEBUG = ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CMAKE_CXX_FLAGS_RELEASE = ${CMAKE_CXX_FLAGS_RELEASE}")
##### add make directories #####
add_subdirectory(src)
if(USE_TEST)
add_subdirectory(test)
endif()
if(USE_PYTHON)
add_subdirectory(python)
endif()
add_subdirectory(benchmark)
##### custom target #####
# testing
if(USE_TEST)
if(USE_GPU)
add_custom_target(test
DEPENDS csim_test
DEPENDS cppsim_test
DEPENDS gpusim_test
DEPENDS vqcsim_test
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/csim_test
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/cppsim_test
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/gpusim_test
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/vqcsim_test
)
else()
add_custom_target(test
DEPENDS csim_test
DEPENDS cppsim_test
DEPENDS vqcsim_test
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/csim_test
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/cppsim_test
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/vqcsim_test
)
add_custom_target(buildtest
DEPENDS csim_test
DEPENDS cppsim_test
DEPENDS vqcsim_test
)
add_custom_target(coverage
DEPENDS test
COMMAND mkdir -p "${CMAKE_CURRENT_SOURCE_DIR}/coverage"
COMMAND lcov -d "${CMAKE_CURRENT_SOURCE_DIR}/build/src/csim/CMakeFiles/csim_static.dir" -d "${CMAKE_CURRENT_SOURCE_DIR}/build/src/cppsim/CMakeFiles/cppsim_static.dir" -d "${CMAKE_CURRENT_SOURCE_DIR}/build/src/vqcsim/CMakeFiles/vqcsim_static.dir" -c -o "${CMAKE_CURRENT_SOURCE_DIR}/coverage/coverage.info"
COMMAND lcov -r "${CMAKE_CURRENT_SOURCE_DIR}/coverage/coverage.info" "*/include/*" -o "${CMAKE_CURRENT_SOURCE_DIR}/coverage/coverageFiltered.info"
COMMAND genhtml -o "${CMAKE_CURRENT_SOURCE_DIR}/coverage/html" --num-spaces 4 -s --legend "${CMAKE_CURRENT_SOURCE_DIR}/coverage/coverageFiltered.info"
)
endif()
endif()
# benchmark
add_custom_target(bench
DEPENDS csim_benchmark
DEPENDS cppsim_benchmark
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/csim_benchmark
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/cppsim_benchmark
)
# format
find_program(CLANG_FORMAT "clang-format")
if(CLANG_FORMAT)
file(GLOB_RECURSE ALL_CXX_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/benchmark/*.[ch]pp
${CMAKE_CURRENT_SOURCE_DIR}/benchmark/*.[ch]
${CMAKE_CURRENT_SOURCE_DIR}/src/*.[ch]pp
${CMAKE_CURRENT_SOURCE_DIR}/src/*.[ch]
${CMAKE_CURRENT_SOURCE_DIR}/test/*.[ch]pp
${CMAKE_CURRENT_SOURCE_DIR}/test/*.[ch]
)
add_custom_target(
format
COMMAND clang-format
-style=file
-i
${ALL_CXX_SOURCE_FILES}
)
endif()
# shared libs
add_custom_target(shared
DEPENDS csim_shared
DEPENDS cppsim_shared
DEPENDS vqcsim_shared
)
# python binding
if(USE_PYTHON)
add_custom_target(python
DEPENDS qulacs_core
)
add_custom_target(pythontest
DEPENDS qulacs_core
COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/python/test/test_qulacs.py
)
endif()
#dependency setting for ExternalProject
add_dependencies(qulacs_core Cereal)
add_dependencies(qulacs_core eigen)