فهرست منبع

CUDA: Add cu as default source file extension

Robert Maynard 7 سال پیش
والد
کامیت
81868e6bad

+ 2 - 2
Source/cmExtraCodeBlocksGenerator.cxx

@@ -371,10 +371,10 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
               continue;
               continue;
             }
             }
 
 
-            // check whether it is a C/C++ implementation file
+            // check whether it is a C/C++/CUDA implementation file
             bool isCFile = false;
             bool isCFile = false;
             std::string lang = s->GetLanguage();
             std::string lang = s->GetLanguage();
-            if (lang == "C" || lang == "CXX") {
+            if (lang == "C" || lang == "CXX" || lang == "CUDA") {
               std::string const& srcext = s->GetExtension();
               std::string const& srcext = s->GetExtension();
               isCFile = cm->IsSourceExtension(srcext);
               isCFile = cm->IsSourceExtension(srcext);
             }
             }

+ 2 - 2
Source/cmExtraCodeLiteGenerator.cxx

@@ -227,10 +227,10 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
       gt->GetSourceFiles(sources,
       gt->GetSourceFiles(sources,
                          makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
                          makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
       for (cmSourceFile* s : sources) {
       for (cmSourceFile* s : sources) {
-        // check whether it is a C/C++ implementation file
+        // check whether it is a C/C++/CUDA implementation file
         bool isCFile = false;
         bool isCFile = false;
         std::string lang = s->GetLanguage();
         std::string lang = s->GetLanguage();
-        if (lang == "C" || lang == "CXX") {
+        if (lang == "C" || lang == "CXX" || lang == "CUDA") {
           std::string const& srcext = s->GetExtension();
           std::string const& srcext = s->GetExtension();
           isCFile = cm->IsSourceExtension(srcext);
           isCFile = cm->IsSourceExtension(srcext);
         }
         }

+ 1 - 1
Source/cmMakefile.cxx

@@ -967,7 +967,7 @@ void cmMakefile::AddCustomCommandOldStyle(
   }
   }
 
 
   // Each output must get its own copy of this rule.
   // Each output must get its own copy of this rule.
-  cmsys::RegularExpression sourceFiles("\\.(C|M|c|c\\+\\+|cc|cpp|cxx|m|mm|"
+  cmsys::RegularExpression sourceFiles("\\.(C|M|c|c\\+\\+|cc|cpp|cxx|cu|m|mm|"
                                        "rc|def|r|odl|idl|hpj|bat|h|h\\+\\+|"
                                        "rc|def|r|odl|idl|hpj|bat|h|h\\+\\+|"
                                        "hm|hpp|hxx|in|txx|inl)$");
                                        "hm|hpp|hxx|in|txx|inl)$");
   for (std::string const& oi : outputs) {
   for (std::string const& oi : outputs) {

+ 2 - 1
Source/cmSourceFile.h

@@ -120,7 +120,8 @@ private:
 #define CM_HEADER_REGEX "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$"
 #define CM_HEADER_REGEX "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$"
 
 
 #define CM_SOURCE_REGEX                                                       \
 #define CM_SOURCE_REGEX                                                       \
-  "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|f|f90|for|fpp|ftn|m|mm|rc|def|r|odl|idl|hpj"  \
+  "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|cu|f|f90|for|fpp|ftn|m|mm|rc|def|r|odl|idl|"  \
+  "hpj"                                                                       \
   "|bat)$"
   "|bat)$"
 
 
 #define CM_RESOURCE_REGEX "\\.(pdf|plist|png|jpeg|jpg|storyboard|xcassets)$"
 #define CM_RESOURCE_REGEX "\\.(pdf|plist|png|jpeg|jpg|storyboard|xcassets)$"

+ 3 - 0
Source/cmSystemTools.cxx

@@ -1308,6 +1308,9 @@ cmSystemTools::FileFormat cmSystemTools::GetFileFormat(const char* cext)
   if (ext == "java" || ext == ".java") {
   if (ext == "java" || ext == ".java") {
     return cmSystemTools::JAVA_FILE_FORMAT;
     return cmSystemTools::JAVA_FILE_FORMAT;
   }
   }
+  if (ext == "cu" || ext == ".cu") {
+    return cmSystemTools::CUDA_FILE_FORMAT;
+  }
   if (ext == "H" || ext == ".H" || ext == "h" || ext == ".h" || ext == "h++" ||
   if (ext == "H" || ext == ".H" || ext == "h" || ext == ".h" || ext == "h++" ||
       ext == ".h++" || ext == "hm" || ext == ".hm" || ext == "hpp" ||
       ext == ".h++" || ext == "hm" || ext == ".hm" || ext == "hpp" ||
       ext == ".hpp" || ext == "hxx" || ext == ".hxx" || ext == "in" ||
       ext == ".hpp" || ext == "hxx" || ext == ".hxx" || ext == "in" ||

+ 1 - 0
Source/cmSystemTools.h

@@ -285,6 +285,7 @@ public:
     CXX_FILE_FORMAT,
     CXX_FILE_FORMAT,
     FORTRAN_FILE_FORMAT,
     FORTRAN_FILE_FORMAT,
     JAVA_FILE_FORMAT,
     JAVA_FILE_FORMAT,
+    CUDA_FILE_FORMAT,
     HEADER_FILE_FORMAT,
     HEADER_FILE_FORMAT,
     RESOURCE_FILE_FORMAT,
     RESOURCE_FILE_FORMAT,
     DEFINITION_FILE_FORMAT,
     DEFINITION_FILE_FORMAT,

+ 1 - 0
Source/cmake.cxx

@@ -196,6 +196,7 @@ cmake::cmake(Role role)
   this->SourceFileExtensions.push_back("cc");
   this->SourceFileExtensions.push_back("cc");
   this->SourceFileExtensions.push_back("cpp");
   this->SourceFileExtensions.push_back("cpp");
   this->SourceFileExtensions.push_back("cxx");
   this->SourceFileExtensions.push_back("cxx");
+  this->SourceFileExtensions.push_back("cu");
   this->SourceFileExtensions.push_back("m");
   this->SourceFileExtensions.push_back("m");
   this->SourceFileExtensions.push_back("M");
   this->SourceFileExtensions.push_back("M");
   this->SourceFileExtensions.push_back("mm");
   this->SourceFileExtensions.push_back("mm");

+ 2 - 2
Tests/RunCMake/interface_library/global-interface-stderr.txt

@@ -3,7 +3,7 @@ CMake Error at global-interface.cmake:2 \(add_library\):
 
 
     GLOBAL
     GLOBAL
 
 
-  Tried extensions \.c \.C \.c\+\+ \.cc \.cpp \.cxx \.m \.M \.mm \.h \.hh \.h\+\+ \.hm \.hpp
-  \.hxx \.in \.txx
+  Tried extensions( \.[A-Za-z+]+|
+ )*
 Call Stack \(most recent call first\):
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
   CMakeLists.txt:3 \(include\)