summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly/CMakeLists.txt
blob: 32940eb157c475b4fd7b89f59bfaf31f64537bee (plain)
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
macro (add_cuda_test_macro name)
  add_test_macro("${name}" ${ARGN})
  set_property(TEST "${name}" APPEND
    PROPERTY LABELS "CUDA")
endmacro ()

add_cuda_test_macro(CudaOnly.Architecture Architecture)
add_cuda_test_macro(CudaOnly.ArchSpecial CudaOnlyArchSpecial)
add_cuda_test_macro(CudaOnly.CompileFlags CudaOnlyCompileFlags)
add_cuda_test_macro(CudaOnly.EnableStandard CudaOnlyEnableStandard)
add_cuda_test_macro(CudaOnly.ExportPTX CudaOnlyExportPTX)
add_cuda_test_macro(CudaOnly.SharedRuntimePlusToolkit CudaOnlySharedRuntimePlusToolkit)
add_cuda_test_macro(CudaOnly.StaticRuntimePlusToolkit CudaOnlyStaticRuntimePlusToolkit)
add_cuda_test_macro(CudaOnly.Standard98 CudaOnlyStandard98)
add_cuda_test_macro(CudaOnly.Toolkit CudaOnlyToolkit)
add_cuda_test_macro(CudaOnly.ToolkitBeforeLang CudaOnlyToolkitBeforeLang)
add_cuda_test_macro(CudaOnly.ToolkitMultipleDirs CudaOnlyToolkitMultipleDirs)
add_cuda_test_macro(CudaOnly.TryCompileTargetStatic CudaOnlyTryCompileTargetStatic)
add_cuda_test_macro(CudaOnly.WithDefs CudaOnlyWithDefs)
add_cuda_test_macro(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine)
add_cuda_test_macro(CudaOnly.ResolveDeviceSymbols CudaOnlyResolveDeviceSymbols)
add_cuda_test_macro(CudaOnly.SeparateCompilation main/CudaOnlySeparateCompilation)
add_cuda_test_macro(CudaOnly.SeparateCompilationPTX CudaOnlySeparateCompilationPTX)
add_cuda_test_macro(CudaOnly.SeparateCompilationTargetObjects CudaOnlySeparateCompilationTargetObjects)

if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang")
  # Clang doesn't have flags for selecting the runtime.
  add_cuda_test_macro(CudaOnly.SharedRuntimeViaCUDAFlags CudaOnlySharedRuntimeViaCUDAFlags)

  # Only NVCC defines __CUDACC_DEBUG__ when compiling in debug mode.
  add_cuda_test_macro(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag)
  add_cuda_test_macro(CudaOnly.CUBIN CudaOnlyCUBIN)
  add_cuda_test_macro(CudaOnly.Fatbin CudaOnlyFatbin)
  add_cuda_test_macro(CudaOnly.OptixIR CudaOnlyOptixIR)
endif()

add_cuda_test_macro(CudaOnly.DeviceLTO CudaOnlyDeviceLTO)

if(MSVC)
  # Tests for features that only work with MSVC
  add_cuda_test_macro(CudaOnly.PDB CudaOnlyPDB)
endif()

add_test(NAME CudaOnly.DontResolveDeviceSymbols COMMAND
  ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
  --build-and-test
  "${CMAKE_CURRENT_SOURCE_DIR}/DontResolveDeviceSymbols/"
  "${CMAKE_CURRENT_BINARY_DIR}/DontResolveDeviceSymbols/"
  ${build_generator_args}
  --build-project DontResolveDeviceSymbols
  --build-options ${build_options}
  --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
set_property(TEST "CudaOnly.DontResolveDeviceSymbols" APPEND
  PROPERTY LABELS "CUDA")

add_test(NAME CudaOnly.RuntimeControls COMMAND
  ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
  --build-and-test
  "${CMAKE_CURRENT_SOURCE_DIR}/RuntimeControls/"
  "${CMAKE_CURRENT_BINARY_DIR}/RuntimeControls/"
  --build-two-config
    ${build_generator_args}
  --build-project RuntimeControls
  --build-options ${build_options}
  --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
  )
set_property(TEST "CudaOnly.RuntimeControls" APPEND
  PROPERTY LABELS "CUDA")