apollo
apollo copied to clipboard
Apollo8.0 add third-party opencl
Apollo8.0 add third-party library opencl,i created BUILD file,like this,
then use command “bazel build /path/to/...” build my cpp files , error: no such package '@opencl//': The repository '@opencl' could not be resolved. use command "buildtool build -p /path/" , error: can not find 3rd-opencl-dev.
And i used command "bazel build /third-party/opencl/..." to compile successfully.
I used command "buildtool build -p third-part/" , error: can not find 3rd-opencl-dev.
Please tell me what should I do?
I created the test.cc file in the Apollo root directory to test @opencl. It can be compiled normally. However, after placing the file in a folder in the root directory, the same error is reported, no such package @opencl//
what is the content of workspace.bzl?
what is the content of workspace.bzl?
"""Load the opencl library"""
Sanitize a dependency so that it works correctly from code that includes
Apollo as a submodule.
def clean_dep(dep): return str(Label(dep))
def repo(): native.new_local_repository( name = "opencl", build_file = clean_dep("//third_party/opencl:opencl.BUILD"), path = "/usr/include", )
As it stands, the simplest way to introduce it is to fill in the WORKSPACE file in /apollo_workspace with the following:
load("//third_party/opencl:workspace.bzl", opencl_init = "repo")
opencl_init()
after this, your can directly use buildtool build -p <path>
to build your code rather than opencl.
since opencl is imported in a 'bazel' way, thus the form '@opencl' is directly recognized by bazel.