Skip to content

Commit

Permalink
Add .cl file support in cxx macro
Browse files Browse the repository at this point in the history
Summary: Add .cl file (OpenCL) support in cxx macro

Reviewed By: dmm-fb

Differential Revision: D66902535

fbshipit-source-id: c3b6a43984f393e6bb79a2eb2e7d88f5c8a7c649
  • Loading branch information
telezn authored and facebook-github-bot committed Dec 7, 2024
1 parent a10f680 commit 05c8216
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cxx/attr_selection.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def cxx_by_language_ext(x: dict[typing.Any, typing.Any], ext: str) -> list[typin
# And you can see them in java code, but somehow it works with
# this one, which is seem across the repo. Find out what's happening.
key_compiler = "c_cpp_output"
elif ext in (".cpp", ".cc", ".cxx", ".c++", ".bc"):
elif ext in (".cpp", ".cc", ".cl", ".cxx", ".c++", ".bc"):
key_pp = "cxx"
key_compiler = "cxx_cpp_output"
elif ext == ".m":
Expand Down
7 changes: 4 additions & 3 deletions cxx/compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ AsmExtensions = enum(
CxxExtension = enum(
".cpp",
".cc",
".cl",
".cxx",
".c++",
".c",
Expand Down Expand Up @@ -996,7 +997,7 @@ def _validate_target_headers(ctx: AnalysisContext, preprocessor: list[CPreproces

def _get_compiler_info(toolchain: CxxToolchainInfo, ext: CxxExtension) -> typing.Any:
compiler_info = None
if ext.value in (".cpp", ".cc", ".mm", ".cxx", ".c++", ".h", ".hpp", ".hh", ".h++", ".hxx", ".bc"):
if ext.value in (".cpp", ".cc", ".cl", ".mm", ".cxx", ".c++", ".h", ".hpp", ".hh", ".h++", ".hxx", ".bc"):
compiler_info = toolchain.cxx_compiler_info
elif ext.value in (".c", ".m"):
compiler_info = toolchain.c_compiler_info
Expand All @@ -1018,7 +1019,7 @@ def _get_compiler_info(toolchain: CxxToolchainInfo, ext: CxxExtension) -> typing
return compiler_info

def _get_category(ext: CxxExtension) -> str:
if ext.value in (".cpp", ".cc", ".cxx", ".c++", ".h", ".hpp", ".hh", ".h++", ".hxx"):
if ext.value in (".cpp", ".cc", ".cl", ".cxx", ".c++", ".h", ".hpp", ".hh", ".h++", ".hxx"):
return "cxx_compile"
if ext.value == ".c":
return "c_compile"
Expand Down Expand Up @@ -1063,7 +1064,7 @@ def _dep_file_type(ext: CxxExtension) -> [DepFileType, None]:
return None

# Return the file type as well
if ext.value in (".cpp", ".cc", ".mm", ".cxx", ".c++", ".h", ".hpp", ".hh", ".h++", ".hxx"):
if ext.value in (".cpp", ".cc", ".cl", ".mm", ".cxx", ".c++", ".h", ".hpp", ".hh", ".h++", ".hxx"):
return DepFileType("cpp")
elif ext.value in (".c", ".m"):
return DepFileType("c")
Expand Down

0 comments on commit 05c8216

Please sign in to comment.