Link cuda.lib using a preprocessor macro only for non-CMake (#8173)

Debian CUDA packages don't ship a shim for the Windows SO cuda.lib, so compilation fails.
For CMake it's actually linked using targets, so avoid the preprocessor macro in that case.
This commit is contained in:
Raul Tambre 2021-10-24 19:04:17 +03:00 committed by GitHub
parent aef928cc0c
commit 04b0b15ee4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -18,14 +18,13 @@ int gpu_index = 0;
#include <cuda.h> #include <cuda.h>
#include <stdio.h> #include <stdio.h>
#ifndef USE_CMAKE_LIBS
#pragma comment(lib, "cuda.lib") #pragma comment(lib, "cuda.lib")
#ifdef CUDNN #ifdef CUDNN
#ifndef USE_CMAKE_LIBS
#pragma comment(lib, "cudnn.lib") #pragma comment(lib, "cudnn.lib")
#endif // USE_CMAKE_LIBS
#endif // CUDNN #endif // CUDNN
#endif // USE_CMAKE_LIBS
#if defined(CUDNN_HALF) && !defined(CUDNN) #if defined(CUDNN_HALF) && !defined(CUDNN)
#error "If you set CUDNN_HALF=1 then you must set CUDNN=1" #error "If you set CUDNN_HALF=1 then you must set CUDNN=1"