-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[workspace] Add reusable macro and documentation for vendor_cxx
Update yaml_cpp_internal to follow the new style.
- Loading branch information
1 parent
53571e1
commit a5c310f
Showing
4 changed files
with
70 additions
and
35 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# -*- python -*- | ||
|
||
def cc_library_vendored( | ||
name, | ||
hdrs = None, | ||
hdrs_vendored = None, | ||
edit_include = None, | ||
srcs = None, | ||
srcs_vendored = None, | ||
**kwargs): | ||
# XXX In the next few stanzas, we'll rewrite the upstream headers and sources to | ||
# use a different include paths and a private namespace. This gives Drake a | ||
# completely independent build of the upstream library, even when statically | ||
# linking other versions of the library into the same DSO. | ||
"""...""" | ||
hdrs = hdrs or [] | ||
hdrs_vendored = hdrs_vendored or [] | ||
edit_include = edit_include or {} | ||
srcs = srcs or [] | ||
srcs_vendored = srcs_vendored or [] | ||
if len(hdrs) != len(hdrs_vendored): | ||
fail("The hdrs= and hdrs_vendored= list lengths must match") | ||
if len(srcs) != len(srcs_vendored): | ||
fail("The srcs= and srcs_vendored= list lengths must match") | ||
native.genrule( | ||
name = "_{}_vendoring".format(name), | ||
srcs = hdrs + srcs, | ||
outs = hdrs_vendored + srcs_vendored, | ||
cmd = " ".join([ | ||
"$(execpath @drake//tools/workspace:vendor_cxx)", | ||
] + [ | ||
"'--edit-include={}:{}'".format(k, v) | ||
for k, v in edit_include.items() | ||
] + [ | ||
"$(execpath {}):$(execpath {})".format(old, new) | ||
for old, new in (zip(hdrs, hdrs_vendored) + | ||
zip(srcs, srcs_vendored)) | ||
]), | ||
tools = ["@drake//tools/workspace:vendor_cxx"], | ||
tags = ["manual"], | ||
visibility = ["//visibility:private"], | ||
) | ||
native.cc_library( | ||
name = name, | ||
hdrs = hdrs_vendored, | ||
srcs = srcs_vendored, | ||
**kwargs | ||
) |
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