Soleil
Soleil

Reputation: 7459

How to update a regular C++ project to a CUDA runtime project in VS?

How can I update a regular VC++ project into a CUDA runtime project in Visual Studio 2019?

I tried to add the CUDA markups of the vcxproj project file, without success.

I'm expecting to see the CUDA/C++ tree in project properties.

Upvotes: 1

Views: 862

Answers (1)

Soleil
Soleil

Reputation: 7459

In <Project DefaultTargets="Build" there should be:

<PropertyGroup>
  <CUDAPropsPath Condition="'$(CUDAPropsPath)'==''">
     $(VCTargetsPath)\BuildCustomizations</CUDAPropsPath>
</PropertyGroup>

it defines the variable CUDAPropsPath used further. In the same <Project :

 <ImportGroup Label="ExtensionSettings">
   <Import Project="$(CUDAPropsPath)\CUDA 10.1.props" />
 </ImportGroup>

add the default parameters of CUDA/C++ and CUDA/linker in project properties.

For all the .cu files, we need in <ItemGroup> with the other cpp files:

<CudaCompile Include="MyKernel0.cu"/>

And in <ImportGroup Label="ExtensionTargets"> there must be:

<Import Project="$(CUDAPropsPath)\CUDA 10.1.targets" />

that adds the CUDA/C++ and CUDA/linker in project properties.

Upvotes: 2

Related Questions