-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows a `cuda_library` that was built with `rdc=True` to be depended upon by another such library. This is convenient as such a library can be consumed by either another `cuda_library` OR a `cc_library`. Change-Id: I1014d28a0ab3a9c76b788821211b13c4a9956d2a
- Loading branch information
Showing
3 changed files
with
55 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,52 @@ | ||
load("@rules_cuda//cuda:defs.bzl", "cuda_library", "cuda_objects") | ||
|
||
cuda_objects( | ||
name = "a", | ||
name = "a_objects", | ||
srcs = ["a.cu"], | ||
deps = [":b"], | ||
) | ||
|
||
cuda_objects( | ||
name = "b", | ||
name = "b_objects", | ||
srcs = ["b.cu"], | ||
hdrs = ["b.cuh"], | ||
) | ||
|
||
cuda_library( | ||
name = "librdc", | ||
rdc = 1, | ||
name = "lib_from_objects", | ||
rdc = True, | ||
deps = [ | ||
":a", | ||
":b", | ||
":a_objects", | ||
":b_objects", | ||
], | ||
) | ||
|
||
cc_binary( | ||
name = "main", | ||
name = "main_from_objects", | ||
deps = [ | ||
":librdc", | ||
":lib_from_objects", | ||
], | ||
) | ||
|
||
# Another way of doing it is to just use cuda_library | ||
cuda_library( | ||
name = "a", | ||
srcs = ["a.cu"], | ||
rdc = True, | ||
deps = [":b"], | ||
) | ||
|
||
cuda_library( | ||
name = "b", | ||
srcs = ["b.cu"], | ||
hdrs = ["b.cuh"], | ||
rdc = True, | ||
) | ||
|
||
cc_binary( | ||
name = "main_from_library", | ||
deps = [ | ||
":a", | ||
":b", | ||
], | ||
) |