Skip to content

Commit a0da83f

Browse files
Internal change
PiperOrigin-RevId: 484205078
1 parent 1f38510 commit a0da83f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tensorflow/tensorflow.bzl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,7 @@ def tf_cc_binary(
974974
kernels = [],
975975
per_os_targets = False, # Generate targets with SHARED_LIBRARY_NAME_PATTERNS
976976
visibility = None,
977+
default_copts = [],
977978
**kwargs):
978979
if kernels:
979980
added_data_deps = tf_binary_dynamic_kernel_dsos()
@@ -992,7 +993,7 @@ def tf_cc_binary(
992993
for name_os in names:
993994
cc_binary(
994995
name = name_os,
995-
copts = copts,
996+
copts = default_copts + copts,
996997
srcs = srcs + tf_binary_additional_srcs(),
997998
deps = deps + tf_binary_dynamic_kernel_deps(kernels) + mkl_dep + if_static(
998999
extra_deps = [],
@@ -1246,7 +1247,8 @@ def tf_gen_op_wrapper_py(
12461247
cc_linkopts = lrt_if_needed(),
12471248
api_def_srcs = [],
12481249
compatible_with = [],
1249-
testonly = False):
1250+
testonly = False,
1251+
copts = []):
12501252
_ = require_shape_functions # Unused.
12511253
if op_whitelist and op_allowlist:
12521254
fail("op_whitelist is deprecated. Only use op_allowlist.")
@@ -1266,7 +1268,7 @@ def tf_gen_op_wrapper_py(
12661268
deps = [str(Label("//tensorflow/core:" + name + "_op_lib"))]
12671269
tf_cc_binary(
12681270
name = tool_name,
1269-
copts = tf_copts(),
1271+
copts = copts + tf_copts(),
12701272
linkopts = if_not_windows(["-lm", "-Wl,-ldl"]) + cc_linkopts,
12711273
linkstatic = 1, # Faster to link this one-time-use binary dynamically
12721274
visibility = [clean_dep("//tensorflow:internal")],

tensorflow/tsl/platform/default/build_config.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def pyx_library(
5555
srcs = [],
5656
testonly = None,
5757
srcs_version = "PY3",
58+
copts = [],
5859
**kwargs):
5960
"""Compiles a group of .pyx / .pxd / .py files.
6061
@@ -71,6 +72,7 @@ def pyx_library(
7172
srcs: .py, .pyx, or .pxd files to either compile or pass through.
7273
testonly: If True, the target can only be used with tests.
7374
srcs_version: Version of python source files.
75+
copts: List of copts to pass to cc rules.
7476
**kwargs: Extra keyword arguments passed to the py_library.
7577
"""
7678

@@ -112,6 +114,7 @@ def pyx_library(
112114
deps = cc_deps + ["@org_tensorflow//third_party/python_runtime:headers"],
113115
linkshared = 1,
114116
testonly = testonly,
117+
copts = copts,
115118
)
116119
shared_objects.append(shared_object_name)
117120

0 commit comments

Comments
 (0)