Skip to content

Commit

Permalink
Automated rollback of commit 64a1326.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

Broke many targets in nightly TGP.

*** Original change description ***

Recognize CUDA and OpenCL file types (.cu, .cl, .inl, .cuh) and compile them with a C++ compiler. This will allow CUDA and OpenCL files to be compiled with clang, which supports both natively.

Change taken from #6578 (comment)

RELNOTES: Treat .cu and .cl files as C++ source. CUDA or OpenCL are not natively supported and will require custom flags to compile with e.g. clang.
PiperOrigin-RevId: 293324316
  • Loading branch information
joeleba authored and copybara-github committed Feb 5, 2020
1 parent 5071206 commit 250647b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
* C++-related file type definitions.
*/
public final class CppFileTypes {
// .cu and .cl are CUDA and OpenCL source extensions, respectively. They are expected to only be
// supported with clang. Bazel is not officially supporting these targets, and the extensions are
// listed only as long as they work with the existing C++ actions.
public static final FileType CPP_SOURCE =
FileType.of(".cc", ".cpp", ".cxx", ".c++", ".C", ".cu", ".cl");
public static final FileType CPP_SOURCE = FileType.of(".cc", ".cpp", ".cxx", ".c++", ".C");
public static final FileType C_SOURCE = FileType.of(".c");
public static final FileType OBJC_SOURCE = FileType.of(".m");
public static final FileType OBJCPP_SOURCE = FileType.of(".mm");
Expand All @@ -49,8 +45,7 @@ public final class CppFileTypes {

public static final FileType CPP_HEADER =
FileType.of(
".h", ".hh", ".hpp", ".ipp", ".hxx", ".h++", ".inc", ".inl", ".tlh", ".tli", ".H", ".inl",
".cuh");
".h", ".hh", ".hpp", ".ipp", ".hxx", ".h++", ".inc", ".inl", ".tlh", ".tli", ".H");
public static final FileType PCH = FileType.of(".pch");
public static final FileTypeSet OBJC_HEADER = FileTypeSet.of(CPP_HEADER, PCH);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ class Constants {
// Please keep in sync with the extensions in CppFileTypes.
static final ImmutableList<String> CC_EXTENSIONS =
ImmutableList.of(
".cc", ".cpp", ".cxx", ".c++", ".C", ".c", ".cu", ".cl", ".h", ".hh", ".hpp", ".ipp",
".hxx", ".inc", ".inl", ".tlh", ".tli", ".H", ".cuh");
".cc", ".cpp", ".cxx", ".c++", ".C", ".c", ".h", ".hh", ".hpp", ".ipp", ".hxx", ".inc",
".inl", ".tlh", ".tli", ".H");
}

0 comments on commit 250647b

Please sign in to comment.