Erik Smith
unread,Nov 7, 2024, 7:09:03 PM11/7/24Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to gn-dev, dpr...@google.com, gn-dev, Erik Smith
Here is the patch. There are just two things here: support for CUDA source, which must have the the .cu extension, and also support for a .cuh extension for CUDA code in a header. I don't think any additional tool types are needed as it otherwise works like a clang/gcc compiler and in fact those compilers accept these extensions.
Erik
diff --git a/src/gn/source_file.cc b/src/gn/source_file.cc
index 319adde9..7191b0f4 100644
--- a/src/gn/source_file.cc
+++ b/src/gn/source_file.cc
@@ -58,6 +58,8 @@ SourceFile::Type GetSourceFileType(const std::string& file) {
switch (TAG2(str[size - 2], str[size - 1])) {
case TAG2('c', 'c'):
return SourceFile::SOURCE_CPP; // .cc
+ case TAG2('c', 'u'):
+ return SourceFile::SOURCE_CPP; // .cu
case TAG2('g', 'o'):
return SourceFile::SOURCE_GO; // .go
case TAG2('h', 'h'):
@@ -87,6 +89,7 @@ SourceFile::Type GetSourceFileType(const std::string& file) {
case TAG3('i', 'n', 'c'):
case TAG3('i', 'p', 'p'):
case TAG3('i', 'n', 'l'):
+ case TAG3('c', 'u', 'h'):
return SourceFile::SOURCE_H;
case TAG3('a', 's', 'm'):
return SourceFile::SOURCE_S;