aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-02-07 17:04:24 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2017-02-07 17:04:24 -0800
commitd4fa0b34c08dcfb11bd285846ee5cc061885033d (patch)
tree7cfd317233e44b3b31e0f6640727af014a08286e
parentf9616c6994ccf66e2a64e2d62e6a1408694c190c (diff)
downloadvcpkg-d4fa0b34c08dcfb11bd285846ee5cc061885033d.tar.gz
vcpkg-d4fa0b34c08dcfb11bd285846ee5cc061885033d.zip
Add CUDA portfile
The intention of this package is for other packages to declare a dependency on CUDA
-rw-r--r--ports/cuda/CONTROL3
-rw-r--r--ports/cuda/portfile.cmake34
2 files changed, 37 insertions, 0 deletions
diff --git a/ports/cuda/CONTROL b/ports/cuda/CONTROL
new file mode 100644
index 000000000..00df3011c
--- /dev/null
+++ b/ports/cuda/CONTROL
@@ -0,0 +1,3 @@
+Source: cuda
+Version: 8.0
+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
new file mode 100644
index 000000000..3b20afe0f
--- /dev/null
+++ b/ports/cuda/portfile.cmake
@@ -0,0 +1,34 @@
+# Due to the complexity involved, this package doesn't install CUDA. It instead verifies that CUDA is installed.
+# 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
+ OUTPUT_VARIABLE NVCC_OUTPUT
+ RESULT_VARIABLE error_code)
+
+# 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
+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")
+endif()
+
+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})
+#set(CUDA_VERSION_MINOR ${CMAKE_MATCH_2})
+#set(CUDA_VERSION_PATCH ${CMAKE_MATCH_3})
+
+
+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")
+endif()
+
+SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) \ No newline at end of file