2019-09-25 03:58:38 +08:00
# This package doesn't install CUDA. It instead verifies that CUDA is installed.
2017-02-08 09:04:24 +08:00
# 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.
2017-04-06 05:10:01 +08:00
find_program ( NVCC
N A M E S n v c c n v c c . e x e
P A T H S
E N V C U D A _ P A T H
E N V C U D A _ B I N _ P A T H
P A T H _ S U F F I X E S b i n b i n 6 4
D O C " T o o l k i t l o c a t i o n . "
2019-09-25 03:58:38 +08:00
N O _ D E F A U L T _ P A T H )
2017-04-06 05:10:01 +08:00
set ( error_code 1 )
if ( NVCC )
execute_process (
C O M M A N D $ { N V C C } - - v e r s i o n
2017-02-08 09:04:24 +08:00
O U T P U T _ V A R I A B L E N V C C _ O U T P U T
R E S U L T _ V A R I A B L E e r r o r _ c o d e )
2017-04-06 05:10:01 +08:00
endif ( )
2017-02-08 09:04:24 +08:00
2019-09-25 03:58:38 +08:00
#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" )
2017-02-08 09:04:24 +08:00
2017-04-06 05:10:01 +08:00
if ( error_code )
2019-09-25 03:58:38 +08:00
message ( FATAL_ERROR "Could not find CUDA. Before continuing, please download and install CUDA (${CUDA_REQUIRED_VERSION} or higher) from:"
" \ n h t t p s : / / d e v e l o p e r . n v i d i a . c o m / c u d a - d o w n l o a d s \ n " )
2017-02-08 09:04:24 +08:00
endif ( )
2018-02-16 09:42:35 +08:00
# Sample output:
# NVIDIA (R) Cuda compiler driver
# Copyright (c) 2005-2016 NVIDIA Corporation
# Built on Sat_Sep__3_19:05:48_CDT_2016
# Cuda compilation tools, release 8.0, V8.0.44
2017-02-08 09:04:24 +08:00
string ( REGEX MATCH "V([0-9]+)\\.([0-9]+)\\.([0-9]+)" CUDA_VERSION ${ NVCC_OUTPUT } )
message ( STATUS "Found CUDA ${CUDA_VERSION}" )
set ( CUDA_VERSION_MAJOR ${ CMAKE_MATCH_1 } )
2019-09-25 03:58:38 +08:00
set ( CUDA_VERSION_MINOR ${ CMAKE_MATCH_2 } )
set ( CUDA_VERSION_PATCH ${ CMAKE_MATCH_3 } )
2017-02-08 09:04:24 +08:00
2019-09-25 03:58:38 +08:00
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:"
2017-04-06 05:10:01 +08:00
" \ n h t t p s : / / d e v e l o p e r . n v i d i a . c o m / c u d a - d o w n l o a d s \ n " )
2017-02-08 09:04:24 +08:00
endif ( )
2019-09-25 03:58:38 +08:00
SET ( VCPKG_POLICY_EMPTY_PACKAGE enabled )