Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add easy CUDA support. #1171

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<cuda_samples_dir>` 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
Expand Down