diff --git a/CMakeLists.txt b/CMakeLists.txt index d8ef0473..2a182a49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -347,12 +347,15 @@ IF(ENABLE_CUDA) SET(LIBFREENECT2_WITH_CUDA_SUPPORT 1) SET(HAVE_CUDA yes) - STRING(REPLACE "\\" "/" NVCUDASAMPLES_ROOT "$ENV{NVCUDASAMPLES_ROOT}") + IF(NOT DEFINED NVCUDASAMPLES_ROOT) + STRING(REPLACE "\\" "/" NVCUDASAMPLES_ROOT "$ENV{NVCUDASAMPLES_ROOT}") + ENDIF() STRING(REPLACE "\\" "/" NVCUDASAMPLES8_0_ROOT "$ENV{NVCUDASAMPLES8_0_ROOT}") CUDA_INCLUDE_DIRECTORIES( "${MY_DIR}/include/" "${CUDA_TOOLKIT_ROOT_DIR}/samples/common/inc" "${NVCUDASAMPLES_ROOT}/common/inc" + "${NVCUDASAMPLES_ROOT}/Common" "${NVCUDASAMPLES8_0_ROOT}/common/inc" ) SET(CUDA_FLAGS -use_fast_math) diff --git a/README.md b/README.md index 3bde4ceb..b7d84795 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,15 @@ When you report USB issues, please attach relevant debug log from running the pr ## Installation +### Enable CUDA (optional) + +Install the latest CUDA Toolkit. Add option `-DENABLE_CUDA=ON -DNVCUDASAMPLES_ROOT=` to cmake to enable CUDA. CUDA samples could be downloaded [here](https://github.com/NVIDIA/cuda-samples.git). Below is an example to build on Linux if you download CUDA samples under the same directory as libfreenect2: + +``` sh +cd libfreenect2 && mkdir build && cd build +cmake .. -DENABLE_CXX11=ON -DENABLE_CUDA=ON -DNVCUDASAMPLES_ROOT=`pwd`/../../cuda-samples && make -j4 +``` + ### Windows / Visual Studio * Install UsbDk driver