[WIP/Review] Add basic CUDA support (for CMake projects) #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The way CMake compiles cuda files happens in a way that makes it hard for
cclsto parse the command and extract the relevant flags to makeclangwork correctly. I've added a few changes tocclsto add explicit CUDA support in both the file detection and.cclsconfiguration to make basic things like code completion and jump-to-definition mostly work.The nvcc command looks like this (notice two step command)
A similar clang command should look something like this:
I wanted this for myself and my work, but I know there are others who would like this as well. I wanted to make sure to contribute back, given how much I've been using
cclsin the last year. Most of the additions are pretty simple, but the changes I made atproject.cc:437feel a bit hacky, and I wanted your feedback to streamline them into something better, if that is possible. Basically I implemented a whitelist which only allows (-I, -isystem, -std=) type flags. This basically works, but maybe you have a better idea.Additionally it requires the user to make their
.cclslook something like:The
--cuda-gpu-arch=sm_70and--cuda-path=/usr/local/cuda-9.2/could possibly be added automatically.Anyway, thanks for
cclsand I look forward to your feedback.