mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 03:13:03 +08:00
[cuda] Fix find cuda in UNIX (#10838)
* [cuda] Fix find cuda in UNIX * update baseline * [cuda] Add homepage * add newline to end of CONTROL * Update ports/cuda/portfile.cmake Co-authored-by: nicole mazzuca <mazzucan@outlook.com> Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
This commit is contained in:
parent
5890810241
commit
164284d86b
@ -1,3 +1,4 @@
|
|||||||
Source: cuda
|
Source: cuda
|
||||||
Version: 10.1
|
Version: 10.1-1
|
||||||
Description: A parallel computing platform and programming model
|
Description: A parallel computing platform and programming model
|
||||||
|
Homepage: https://developer.nvidia.com/cuda-toolkit
|
||||||
|
@ -2,14 +2,50 @@
|
|||||||
# Other packages can depend on this package to declare a dependency on CUDA.
|
# Other packages can depend on this package to declare a dependency on CUDA.
|
||||||
# If this package is installed, we assume that CUDA is properly installed.
|
# If this package is installed, we assume that CUDA is properly installed.
|
||||||
|
|
||||||
find_program(NVCC
|
#note: this port must be kept in sync with CUDNN port: every time one is upgraded, the other must be too
|
||||||
NAMES nvcc nvcc.exe
|
set(CUDA_REQUIRED_VERSION "10.1.0")
|
||||||
PATHS
|
|
||||||
ENV CUDA_PATH
|
if (VCPKG_TARGET_IS_WINDOWS)
|
||||||
ENV CUDA_BIN_PATH
|
find_program(NVCC
|
||||||
PATH_SUFFIXES bin bin64
|
NAMES nvcc.exe
|
||||||
DOC "Toolkit location."
|
PATHS
|
||||||
NO_DEFAULT_PATH)
|
ENV CUDA_PATH
|
||||||
|
ENV CUDA_BIN_PATH
|
||||||
|
PATH_SUFFIXES bin bin64
|
||||||
|
DOC "Toolkit location."
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
if (VCPKG_TARGET_IS_LINUX)
|
||||||
|
set(platform_base "/usr/local/cuda-")
|
||||||
|
else()
|
||||||
|
set(platform_base "/Developer/NVIDIA/CUDA-")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(GLOB possible_paths "${platform_base}*")
|
||||||
|
set(FOUND_PATH )
|
||||||
|
foreach (p ${possible_paths})
|
||||||
|
# Extract version number from end of string
|
||||||
|
string(REGEX MATCH "[0-9][0-9]?\\.[0-9]$" p_version ${p})
|
||||||
|
if (IS_DIRECTORY ${p} AND p_version)
|
||||||
|
if (p_version VERSION_GREATER_EQUAL CUDA_REQUIRED_VERSION)
|
||||||
|
set(FOUND_PATH ${p})
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
find_program(NVCC
|
||||||
|
NAMES nvcc
|
||||||
|
PATHS
|
||||||
|
ENV CUDA_PATH
|
||||||
|
ENV CUDA_BIN_PATH
|
||||||
|
PATHS ${FOUND_PATH}
|
||||||
|
PATH_SUFFIXES bin bin64
|
||||||
|
DOC "Toolkit location."
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(error_code 1)
|
set(error_code 1)
|
||||||
if (NVCC)
|
if (NVCC)
|
||||||
@ -19,11 +55,9 @@ if (NVCC)
|
|||||||
RESULT_VARIABLE error_code)
|
RESULT_VARIABLE error_code)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#note: this port must be kept in sync with CUDNN port: every time one is upgraded, the other must be too
|
|
||||||
set(CUDA_REQUIRED_VERSION "V10.1.0")
|
|
||||||
|
|
||||||
if (error_code)
|
if (error_code)
|
||||||
message(FATAL_ERROR "Could not find CUDA. Before continuing, please download and install CUDA (${CUDA_REQUIRED_VERSION} or higher) from:"
|
message(FATAL_ERROR "Could not find CUDA. Before continuing, please download and install CUDA (v${CUDA_REQUIRED_VERSION} or higher) from:"
|
||||||
"\n https://developer.nvidia.com/cuda-downloads\n")
|
"\n https://developer.nvidia.com/cuda-downloads\n")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -39,7 +73,7 @@ set(CUDA_VERSION_MINOR ${CMAKE_MATCH_2})
|
|||||||
set(CUDA_VERSION_PATCH ${CMAKE_MATCH_3})
|
set(CUDA_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||||
|
|
||||||
if (CUDA_VERSION_MAJOR LESS 10 AND CUDA_VERSION_MINOR LESS 1)
|
if (CUDA_VERSION_MAJOR LESS 10 AND CUDA_VERSION_MINOR LESS 1)
|
||||||
message(FATAL_ERROR "CUDA ${CUDA_VERSION} found, but ${CUDA_REQUIRED_VERSION} is required. Please download and install a more recent version of CUDA from:"
|
message(FATAL_ERROR "CUDA ${CUDA_VERSION} found, but v${CUDA_REQUIRED_VERSION} is required. Please download and install a more recent version of CUDA from:"
|
||||||
"\n https://developer.nvidia.com/cuda-downloads\n")
|
"\n https://developer.nvidia.com/cuda-downloads\n")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -301,7 +301,6 @@ ctemplate:arm64-windows=fail
|
|||||||
ctemplate:arm-uwp=fail
|
ctemplate:arm-uwp=fail
|
||||||
ctemplate:x64-linux=fail
|
ctemplate:x64-linux=fail
|
||||||
ctemplate:x64-osx=fail
|
ctemplate:x64-osx=fail
|
||||||
cuda:x64-linux=fail
|
|
||||||
cuda:x64-osx=fail
|
cuda:x64-osx=fail
|
||||||
cudnn:arm64-windows=fail
|
cudnn:arm64-windows=fail
|
||||||
cudnn:arm-uwp=fail
|
cudnn:arm-uwp=fail
|
||||||
|
Loading…
Reference in New Issue
Block a user