diff --git bazel/cython_library.bzl bazel/cython_library.bzl index 48b41d74e8..6084734f59 100644 --- bazel/cython_library.bzl +++ bazel/cython_library.bzl @@ -7,7 +7,7 @@ # been written at cython/cython and tensorflow/tensorflow. We branch from # Tensorflow's version as it is more actively maintained and works for gRPC # Python's needs. -def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs): +def pyx_library(name, deps=[], copts=[], py_deps=[], srcs=[], **kwargs): """Compiles a group of .pyx / .pxd / .py files. First runs Cython to create .cpp files for each input .pyx or .py + .pxd @@ -19,6 +19,7 @@ def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs): Args: name: Name for the rule. deps: C/C++ dependencies of the Cython (e.g. Numpy headers). + copts: C/C++ compiler options for Cython py_deps: Pure Python dependencies of the final library. srcs: .py, .pyx, or .pxd files to either compile or pass through. **kwargs: Extra keyword arguments passed to the py_library. @@ -58,6 +59,7 @@ def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs): native.cc_binary( name=shared_object_name, srcs=[stem + ".cpp"], + copts=copts, deps=deps + ["@local_config_python//:python_headers"], linkshared=1, ) --