You must add files depending on this rule.
IIUC, you have the following structure:
tensorflow/ BUILD WORKSPACE tensorflow/ core/ BUILD third_party/ include -> /opt/opencl/CL
You want to open .h files so that Bazel can understand / depend, so open the tensorflow/BUILD file and add the following:
cc_library( name = "opencl", hdrs = glob(["third_party/include/*.h"]), visibility = ["//visibility:public"], )
This creates a C ++ library of .h files in the third_party / include file, on which you can depend from anywhere in the source tree.
Now go to your tensorflow/core/BUILD file and add the dependency to cc_library:
cc_library( name = "all_kernels", visibility = ["//visibility:public"], copts = tf_copts() + ["-Ithird_party/include"], deps = [ "//:opencl",
Configuring cops just changes flags when gcc starts. Adding //:opencl to the dependencies tells Bazel to make these files available when gcc starts.
source share