aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-04-05 14:10:01 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-04-05 14:10:01 -0700
commitcc338dcc8c7d047d0a3c4d923e4d4ebd1413bbfe (patch)
tree37b363a738c175b39418b77a9093e75bfb6bda2b
parentcf44582b9f234df47f0fc6347d06d0302a3f65da (diff)
downloadvcpkg-cc338dcc8c7d047d0a3c4d923e4d4ebd1413bbfe.tar.gz
vcpkg-cc338dcc8c7d047d0a3c4d923e4d4ebd1413bbfe.zip
[cuda] Add CUDA_PATH to environment whitelist.
-rw-r--r--ports/cuda/CONTROL2
-rw-r--r--ports/cuda/portfile.cmake29
-rw-r--r--toolsrc/src/vcpkg_System.cpp2
3 files changed, 24 insertions, 9 deletions
diff --git a/ports/cuda/CONTROL b/ports/cuda/CONTROL
index 00df3011c..0bf29b7b6 100644
--- a/ports/cuda/CONTROL
+++ b/ports/cuda/CONTROL
@@ -1,3 +1,3 @@
Source: cuda
-Version: 8.0
+Version: 8.0-1
Description: A parallel computing platform and programming model \ No newline at end of file
diff --git a/ports/cuda/portfile.cmake b/ports/cuda/portfile.cmake
index 3b20afe0f..348de92f1 100644
--- a/ports/cuda/portfile.cmake
+++ b/ports/cuda/portfile.cmake
@@ -2,10 +2,23 @@
# 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.
-execute_process(
- COMMAND nvcc --version
+find_program(NVCC
+ NAMES nvcc nvcc.exe
+ PATHS
+ ENV CUDA_PATH
+ ENV CUDA_BIN_PATH
+ PATH_SUFFIXES bin bin64
+ DOC "Toolkit location."
+ NO_DEFAULT_PATH
+ )
+
+set(error_code 1)
+if (NVCC)
+ execute_process(
+ COMMAND ${NVCC} --version
OUTPUT_VARIABLE NVCC_OUTPUT
RESULT_VARIABLE error_code)
+endif()
# Sample output
# NVIDIA (R) Cuda compiler driver
@@ -14,9 +27,10 @@ execute_process(
# Cuda compilation tools, release 8.0, V8.0.44
set(CUDA_REQUIRED_VERSION "V8.0.0")
-if (${error_code})
- message(FATAL_ERROR "CUDA is not installed. Before continuing, please download and install CUDA (${CUDA_REQUIRED_VERSION} or higher) from:"
- "\n https://developer.nvidia.com/cuda-downloads \n")
+if (error_code)
+ message(FATAL_ERROR "Could not find CUDA. Before continuing, please download and install CUDA (${CUDA_REQUIRED_VERSION} or higher) from:"
+ "\n https://developer.nvidia.com/cuda-downloads\n"
+ "\nAlso ensure vcpkg has been rebuilt with the latest version (Mar 5 2017 or later)")
endif()
string(REGEX MATCH "V([0-9]+)\\.([0-9]+)\\.([0-9]+)" CUDA_VERSION ${NVCC_OUTPUT})
@@ -25,10 +39,9 @@ set(CUDA_VERSION_MAJOR ${CMAKE_MATCH_1})
#set(CUDA_VERSION_MINOR ${CMAKE_MATCH_2})
#set(CUDA_VERSION_PATCH ${CMAKE_MATCH_3})
-
-if (${CUDA_VERSION_MAJOR} LESS 8)
+if (CUDA_VERSION_MAJOR LESS 8)
message(FATAL_ERROR "CUDA ${CUDA_VERSION} but ${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()
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) \ No newline at end of file
diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp
index 47e1842e3..f000b7317 100644
--- a/toolsrc/src/vcpkg_System.cpp
+++ b/toolsrc/src/vcpkg_System.cpp
@@ -59,6 +59,8 @@ namespace vcpkg::System
// Enables proxy information to be passed to Curl, the underlying download library in cmake.exe
L"HTTP_PROXY",
L"HTTPS_PROXY",
+ // Enables find_package(CUDA) in CMake
+ L"CUDA_PATH",
};
// Flush stdout before launching external process