Skip to content

Commit

Permalink
Add option to add files to the toolchain configuration (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsharpe authored Jan 3, 2023
1 parent 004b388 commit da21c8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cuda/private/actions/compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def compile(
executable = cuda_compiler,
arguments = [args],
outputs = [obj_file],
inputs = depset([src], transitive = [common.headers, cc_toolchain.all_files]),
inputs = depset([src], transitive = [common.headers, cc_toolchain.all_files, cuda_toolchain.all_files]),
env = env,
mnemonic = "CudaCompile",
progress_message = "Compiling %s" % src.path,
Expand Down
2 changes: 1 addition & 1 deletion cuda/private/actions/dlink.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _compiler_device_link(
executable = cuda_compiler,
arguments = [args],
outputs = [obj_file],
inputs = depset(transitive = [objects, cc_toolchain.all_files]),
inputs = depset(transitive = [objects, cc_toolchain.all_files, cuda_toolchain.all_files]),
env = env,
mnemonic = "CudaDeviceLink",
progress_message = "Device linking %{output}",
Expand Down
2 changes: 2 additions & 0 deletions cuda/private/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def _cuda_toolchain_impl(ctx):
platform_common.ToolchainInfo(
name = ctx.label.name,
compiler_executable = ctx.attr.compiler_executable,
all_files = ctx.attr.compiler_files.files if ctx.attr.compiler_files else depset(),
selectables_info = selectables_info,
artifact_name_patterns = artifact_name_patterns,
cuda_toolkit = cuda_toolchain_config.cuda_toolkit,
Expand All @@ -33,6 +34,7 @@ cuda_toolchain = rule(
doc = "A target that provides a `CudaToolchainConfigInfo`.",
),
"compiler_executable": attr.string(mandatory = True, doc = "The path of the main executable of this toolchain."),
"compiler_files": attr.label(allow_files = True, cfg = "exec", doc = "The set of files that are needed when compiling using this toolchain."),
"_cc_toolchain": attr.label(default = "@bazel_tools//tools/cpp:current_cc_toolchain"),
},
)
Expand Down

0 comments on commit da21c8f

Please sign in to comment.