-
Notifications
You must be signed in to change notification settings - Fork 240
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
189 lines (172 loc) · 6.8 KB
/
CMakeLists.txt
File metadata and controls
189 lines (172 loc) · 6.8 KB
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
#=============================================================================
# Copyright 2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================
function(add_compile_diagnostics TARGET)
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
target_compile_options(${TARGET} PRIVATE -Wall -Wextra -Wpedantic -Werror)
endif()
endfunction()
set(stdexec_test_sources
test_main.cpp
stdexec/cpos/test_cpo_bulk.cpp
stdexec/cpos/test_cpo_receiver.cpp
stdexec/cpos/test_cpo_start.cpp
stdexec/cpos/test_cpo_connect.cpp
stdexec/cpos/test_cpo_connect_awaitable.cpp
stdexec/cpos/test_cpo_schedule.cpp
stdexec/cpos/test_cpo_upon_error.cpp
stdexec/cpos/test_cpo_upon_stopped.cpp
stdexec/concepts/test_concept_scheduler.cpp
stdexec/concepts/test_concepts_receiver.cpp
stdexec/concepts/test_concept_operation_state.cpp
stdexec/concepts/test_concepts_sender.cpp
stdexec/concepts/test_concepts_stop_tokens.cpp
stdexec/concepts/test_concepts_scope_association.cpp
stdexec/concepts/test_concepts_scope_token.cpp
stdexec/concepts/test_awaitables.cpp
stdexec/algos/factories/test_just.cpp
stdexec/algos/factories/test_transfer_just.cpp
stdexec/algos/factories/test_just_error.cpp
stdexec/algos/factories/test_just_stopped.cpp
stdexec/algos/factories/test_read.cpp
stdexec/algos/factories/test_schedule.cpp
stdexec/algos/adaptors/test_associate.cpp
stdexec/algos/adaptors/test_starts_on.cpp
stdexec/algos/adaptors/test_on.cpp
stdexec/algos/adaptors/test_on2.cpp
stdexec/algos/adaptors/test_on3.cpp
stdexec/algos/adaptors/test_continues_on.cpp
stdexec/algos/adaptors/test_finally.cpp
stdexec/algos/adaptors/test_then.cpp
stdexec/algos/adaptors/test_upon_error.cpp
stdexec/algos/adaptors/test_upon_stopped.cpp
stdexec/algos/adaptors/test_let_value.cpp
stdexec/algos/adaptors/test_let_error.cpp
stdexec/algos/adaptors/test_let_stopped.cpp
stdexec/algos/adaptors/test_bulk.cpp
stdexec/algos/adaptors/test_when_all.cpp
stdexec/algos/adaptors/test_transfer_when_all.cpp
stdexec/algos/adaptors/test_into_variant.cpp
stdexec/algos/adaptors/test_sequence.cpp
stdexec/algos/adaptors/test_stopped_as_optional.cpp
stdexec/algos/adaptors/test_stopped_as_error.cpp
stdexec/algos/adaptors/test_write_env.cpp
stdexec/algos/adaptors/test_stop_when.cpp
stdexec/algos/adaptors/test_spawn_future.cpp
stdexec/algos/consumers/test_sync_wait.cpp
stdexec/algos/consumers/test_spawn.cpp
stdexec/detail/test_any.cpp
stdexec/detail/test_completion_signatures.cpp
stdexec/detail/test_demangle.cpp
stdexec/detail/test_utility.cpp
stdexec/detail/test_intrusive_mpsc_queue.cpp
stdexec/schedulers/test_task_scheduler.cpp
stdexec/schedulers/test_parallel_scheduler.cpp
stdexec/queries/test_env.cpp
stdexec/queries/test_get_forward_progress_guarantee.cpp
stdexec/queries/test_get_completion_behavior.cpp
stdexec/queries/test_forwarding_queries.cpp
stdexec/types/test_task.cpp
stdexec/types/test_counting_scopes.cpp
)
add_library(common_test_settings INTERFACE)
set_target_properties(common_test_settings PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
MSVC_DEBUG_INFORMATION_FORMAT Embedded
)
target_include_directories(common_test_settings INTERFACE "${CMAKE_CURRENT_LIST_DIR}")
target_compile_definitions(common_test_settings INTERFACE STDEXEC_NAMESPACE=std::execution)
target_compile_options(common_test_settings INTERFACE
$<$<CXX_COMPILER_ID:MSVC>:/wd4714> # function marked as __forceinline not inlined
$<$<CXX_COMPILER_ID:GNU>:-Wno-maybe-uninitialized> # warnings being emitted from stdlib headers, why?
)
target_link_libraries(common_test_settings INTERFACE $<TARGET_NAME_IF_EXISTS:TBB::tbb>)
# target_compile_definitions(
# common_test_settings INTERFACE
# $<$<NOT:$<AND:$<CXX_COMPILER_ID:NVHPC>,$<COMPILE_LANGUAGE:CXX>>>:STDEXEC_ENABLE_EXTRA_TYPE_CHECKING>)
add_executable(test.stdexec ${stdexec_test_sources})
add_compile_diagnostics(test.stdexec)
target_link_libraries(test.stdexec
PUBLIC
STDEXEC::stdexec
stdexec_executable_flags
Catch2::Catch2
PRIVATE
common_test_settings)
if(STDEXEC_BUILD_PARALLEL_SCHEDULER)
add_executable(test.parallel_scheduler_replacement
test_main.cpp
stdexec/schedulers/test_parallel_scheduler_replacement.cpp)
add_compile_diagnostics(test.parallel_scheduler_replacement)
target_link_libraries(test.parallel_scheduler_replacement
PUBLIC
STDEXEC::stdexec
STDEXEC::parallel_scheduler
stdexec_executable_flags
Catch2::Catch2
PRIVATE
common_test_settings)
endif()
add_executable(test.scratch test_main.cpp test_scratch.cpp)
add_compile_diagnostics(test.scratch)
target_link_libraries(test.scratch
PUBLIC
STDEXEC::stdexec
$<TARGET_NAME_IF_EXISTS:STDEXEC::tbbexec>
stdexec_executable_flags
Catch2::Catch2
PRIVATE
common_test_settings)
# Discover the Catch2 test built by the application
include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake)
# For testing that builds fail as expected
include(${icm_SOURCE_DIR}/icm_build_failure_testing.cmake)
catch_discover_tests(test.stdexec PROPERTIES TIMEOUT 30)
catch_discover_tests(test.scratch PROPERTIES TIMEOUT 30)
if(STDEXEC_BUILD_PARALLEL_SCHEDULER AND NOT STDEXEC_ENABLE_CUDA)
catch_discover_tests(test.parallel_scheduler_replacement PROPERTIES TIMEOUT 30)
endif()
add_subdirectory(exec)
if(STDEXEC_ENABLE_CUDA)
add_subdirectory(nvexec)
endif()
# build failure tests: tests which parse a source file for an expected error
# message
icm_add_build_failure_test(
NAME test_let_fail1
TARGET test_let_fail1
SOURCES PARSE stdexec/algos/adaptors/test_let_fail1.cpp
LIBRARIES stdexec
FOLDER test
)
icm_add_build_failure_test(
NAME test_then_fail1
TARGET test_then_fail1
SOURCES PARSE stdexec/algos/adaptors/test_then_fail1.cpp
LIBRARIES stdexec
FOLDER test
)
if(STDEXEC_BUILD_RELACY_TESTS)
add_subdirectory(rrd)
endif()
# # Adding multiple tests with a glob
# icm_glob_build_failure_tests(
# PATTERN *_fail*.cpp
# LIBRARIES stdexec
# PREFIX stdexec
# FOLDER test/stdexec/algos/adaptors
# )