mirror of
https://github.com/reactos/CMake.git
synced 2024-11-23 11:39:48 +00:00
CUDA: Add CudaOnly.CompileFlags test
Covers passing compile flags explicitly for both NVCC and Clang.
This commit is contained in:
parent
f0931b0790
commit
21131ca60c
@ -1,6 +1,7 @@
|
||||
|
||||
ADD_TEST_MACRO(CudaOnly.Architecture Architecture)
|
||||
ADD_TEST_MACRO(CudaOnly.CircularLinkLine CudaOnlyCircularLinkLine)
|
||||
ADD_TEST_MACRO(CudaOnly.CompileFlags CudaOnlyCompileFlags)
|
||||
ADD_TEST_MACRO(CudaOnly.EnableStandard CudaOnlyEnableStandard)
|
||||
ADD_TEST_MACRO(CudaOnly.ExportPTX CudaOnlyExportPTX)
|
||||
ADD_TEST_MACRO(CudaOnly.GPUDebugFlag CudaOnlyGPUDebugFlag)
|
||||
|
16
Tests/CudaOnly/CompileFlags/CMakeLists.txt
Normal file
16
Tests/CudaOnly/CompileFlags/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.17)
|
||||
cmake_policy(SET CMP0104 OLD)
|
||||
project(CompileFlags CUDA)
|
||||
|
||||
# Clear defaults.
|
||||
set(CMAKE_CUDA_ARCHITECTURES)
|
||||
|
||||
add_executable(CudaOnlyCompileFlags main.cu)
|
||||
|
||||
# Try passing CUDA architecture flags explicitly.
|
||||
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
|
||||
target_compile_options(CudaOnlyCompileFlags PRIVATE
|
||||
-gencode arch=compute_50,code=compute_50
|
||||
--compiler-options=-DHOST_DEFINE
|
||||
)
|
||||
endif()
|
16
Tests/CudaOnly/CompileFlags/main.cu
Normal file
16
Tests/CudaOnly/CompileFlags/main.cu
Normal file
@ -0,0 +1,16 @@
|
||||
#ifdef __CUDA_ARCH__
|
||||
# if __CUDA_ARCH__ != 500
|
||||
# error "Passed architecture 50, but got something else."
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Check HOST_DEFINE only for nvcc
|
||||
#ifndef __CUDA__
|
||||
# ifndef HOST_DEFINE
|
||||
# error "HOST_DEFINE not defined!"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue
Block a user