mirror of
https://github.com/reactos/CMake.git
synced 2024-11-27 21:41:03 +00:00
CUDA: Test that CUDA flags are used when device linking executables.
This commit is contained in:
parent
728820f3ea
commit
dc5051f1c1
@ -2,3 +2,4 @@
|
||||
ADD_TEST_MACRO(Cuda.Complex CudaComplex)
|
||||
ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures)
|
||||
ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary)
|
||||
ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
|
||||
|
20
Tests/Cuda/ProperLinkFlags/CMakeLists.txt
Normal file
20
Tests/Cuda/ProperLinkFlags/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
project (ProperLinkFlags CUDA CXX)
|
||||
|
||||
#Goal for this example:
|
||||
#Verify that when we have CXX and CUDA enabled and we link an executable that
|
||||
#has CUDA and CXX we use the CUDA link flags when doing the device link
|
||||
#step
|
||||
|
||||
#Specify a set of valid CUDA flags and an invalid set of CXX flags ( for CUDA )
|
||||
#to make sure we don't use the CXX flags when linking CUDA executables
|
||||
set(CMAKE_CUDA_FLAGS "-arch=sm_35 --use_fast_math")
|
||||
set(CMAKE_CXX_FLAGS "-Wall")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CUDA_STANDARD 11)
|
||||
add_executable(ProperLinkFlags file1.cu main.cxx)
|
||||
|
||||
set_target_properties( ProperLinkFlags
|
||||
PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
|
11
Tests/Cuda/ProperLinkFlags/file1.cu
Normal file
11
Tests/Cuda/ProperLinkFlags/file1.cu
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
#include "file1.h"
|
||||
|
||||
result_type __device__ file1_func(int x)
|
||||
{
|
||||
__ldg(&x);
|
||||
result_type r;
|
||||
r.input = x;
|
||||
r.sum = x*x;
|
||||
return r;
|
||||
}
|
7
Tests/Cuda/ProperLinkFlags/file1.h
Normal file
7
Tests/Cuda/ProperLinkFlags/file1.h
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
#pragma once
|
||||
struct result_type
|
||||
{
|
||||
int input;
|
||||
int sum;
|
||||
};
|
9
Tests/Cuda/ProperLinkFlags/main.cxx
Normal file
9
Tests/Cuda/ProperLinkFlags/main.cxx
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "file1.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user