Closed cjds closed 4 years ago
Assigning to @jamiesnape for a first look -- please reassign if appropriate.
FYI https://github.com/RobotLocomotion/drake-external-examples/tree/master/drake_bazel_external serves as a template for how to do this.
What version of Bazel are you using?
Version 2.1.1. Looking at the example I managed to get over this hump by changing the WORKSPACE to
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "drake",
urls = ["https://github.com/RobotLocomotion/drake/archive/v0.16.1.tar.gz"],
sha256 = "f63940c274f90ffa4943d13865abc623455bec124c2dc15a9c8c9c4c67a209e1",
strip_prefix="drake-0.16.1"
)
load("@drake//tools/workspace:default.bzl", "add_default_workspace")
add_default_workspace()
But I still get issues while trying to use drake_cc_library
and drake_cc_vector_gen_library
in my build.
Specifically I get,
ERROR: Analysis of target '//test_drake:rod2d_state_vector' failed; build aborted: no such package 'tools': BUILD file not found in any of the following directories. Add a BUILD file to a directory to mark it
as a package.
I noticed that in the referenced package you stay away from the custom drake_cc_libs and vector_gen_libs. Are you not supposed to use those rules and use just refer to drake as a shared_library instead?
Ah, I see now.
Declaring deps like"@drake//common:essential"
is no problem. You may use :drake_shared_library
if you wish, but using the smaller targets is fine.
The problem is using drake_cc_library
-- that's only intended for use within drake. Downstream should use just cc_library
or cc_binary
.
I should update the docs (and visibility) to make this more clear.
I gotcha..Closing this based on above. Thanks
I'm trying to use Drake in a third party project that uses Bazel but there seem to be some issues that prevent me using it
This is my setup
WORKSPACE
test_drake/BUILD (this is a copy of the rod example in the Drake project)
This is the error that I get