-
Notifications
You must be signed in to change notification settings - Fork 359
Expand file tree
/
Copy pathLibcudacxxPublicHeaderTesting.cmake
More file actions
47 lines (40 loc) · 1.49 KB
/
LibcudacxxPublicHeaderTesting.cmake
File metadata and controls
47 lines (40 loc) · 1.49 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
# For every public header, build a translation unit containing `#include <header>`
# to let the compiler try to figure out warnings in that header if it is not otherwise
# included in tests, and also to verify if the headers are modular enough.
# .inl files are not globbed for, because they are not supposed to be used as public
# entrypoints.
# Meta target for all configs' header builds:
add_custom_target(libcudacxx.test.public_headers)
# Grep all public headers
file(
GLOB public_headers
LIST_DIRECTORIES false
RELATIVE "${libcudacxx_SOURCE_DIR}/include"
CONFIGURE_DEPENDS
"${libcudacxx_SOURCE_DIR}/include/cuda/*"
"${libcudacxx_SOURCE_DIR}/include/cuda/std/*"
)
# annotated_ptr does not work with clang cuda due to __nv_associate_access_property
if ("Clang" STREQUAL "${CMAKE_CUDA_COMPILER_ID}")
list(FILTER public_headers EXCLUDE REGEX "annotated_ptr")
endif()
function(libcudacxx_add_public_header_test_target target_name)
if (NOT ARGN)
return()
endif()
cccl_generate_header_tests(
${target_name}
libcudacxx/include
NO_METATARGETS
LANGUAGE CUDA
HEADER_TEMPLATE "${libcudacxx_SOURCE_DIR}/cmake/header_test.cpp.in"
HEADERS ${ARGN}
)
target_compile_definitions(${target_name} PRIVATE _CCCL_HEADER_TEST)
target_link_libraries(${target_name} PUBLIC libcudacxx.compiler_interface)
add_dependencies(libcudacxx.test.public_headers ${target_name})
endfunction()
libcudacxx_add_public_header_test_target(
libcudacxx.test.public_headers.base
${public_headers}
)