-
Notifications
You must be signed in to change notification settings - Fork 181
/
CMakeLists.txt
71 lines (61 loc) · 2.29 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
# ============================================================================ #
# Copyright (c) 2022 - 2024 NVIDIA Corporation & Affiliates. #
# All rights reserved. #
# #
# This source code and the accompanying materials are made available under #
# the terms of the Apache License 2.0 which accompanies this distribution. #
# ============================================================================ #
llvm_canonicalize_cmake_booleans(
CUDA_FOUND
CUDAQ_TEST_REMOTE_SIM
)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
MAIN_CONFIG
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
PATHS
${PATHS_FOR_PLUGINS}
)
set(CUDAQ_TEST_PARAMS
nvqpp_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)
get_property(test_cudaq_libraries GLOBAL PROPERTY CUDAQ_RUNTIME_LIBS)
set(CUDAQ_TEST_DEPENDS
CircuitCheck
cudaq-opt
cudaq-translate
FileCheck
)
# We require split-file, which should be installed along with FileCheck, but
# the CI doesn't do it. Comment this out and open a bug.
# split-file
if (NOT CUDAQ_DISABLE_CPP_FRONTEND)
set(CUDAQ_TEST_DEPENDS ${CUDAQ_TEST_DEPENDS}
cudaq-quake
fixup-linkage
nvq++
${test_cudaq_libraries}
)
endif()
add_custom_target(nvqpp-targettest-depends DEPENDS ${CUDAQ_TEST_DEPENDS})
set_target_properties(nvqpp-targettest-depends PROPERTIES FOLDER "TargetTests")
# Limit the number of llvm-lit worker threads because running too many of these
# tests in parallel can consume all the GPU resources.
set(LIT_ARGS "-j 8")
add_lit_testsuite(check-targets "Running the end-to-end target tests"
${CMAKE_CURRENT_BINARY_DIR}
PARAMS ${CUDAQ_TEST_PARAMS}
DEPENDS ${CUDAQ_TEST_DEPENDS}
ARGS ${LIT_ARGS}
)
set_target_properties(check-targets PROPERTIES FOLDER "TargetTests")
add_lit_testsuites(CUDAQ ${CMAKE_CURRENT_SOURCE_DIR}
PARAMS ${CUDAQ_TEST_PARAMS}
DEPENDS ${CUDAQ_TEST_DEPENDS}
FOLDER "Tests/Subdirectories"
ARGS ${LIT_ARGS}
)
# Add nvqpp tests to the ctest suite
add_test(NAME ctest-targettests
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target check-targets
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})