Skip to content

Commit dc34ddc

Browse files
Updates Apple platform config settings. Sets default target to macos on Apple platforms in bazelrc.
PiperOrigin-RevId: 236380363
1 parent fc5a98c commit dc34ddc

28 files changed

Lines changed: 73 additions & 67 deletions

File tree

.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ build:android_arm64 --config=android
1010
build:android_arm64 --cpu=arm64-v8a
1111
build:android_arm64 --fat_apk_cpu=arm64-v8a
1212

13+
# Sets the default Apple platform to macOS.
14+
build --apple_platform_type=macos
15+
1316
# Config to use a mostly-static build and disable modular op registration
1417
# support (this will revert to loading TensorFlow with RTLD_GLOBAL in Python).
1518
# By default, TensorFlow will build with a dependence on

tensorflow/BUILD

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,6 @@ config_setting(
147147
visibility = ["//visibility:public"],
148148
)
149149

150-
config_setting(
151-
name = "darwin",
152-
values = {"cpu": "darwin"},
153-
visibility = ["//visibility:public"],
154-
)
155-
156150
config_setting(
157151
name = "windows",
158152
values = {"cpu": "x64_windows"},
@@ -165,9 +159,18 @@ config_setting(
165159
visibility = ["//visibility:public"],
166160
)
167161

162+
config_setting(
163+
name = "macos",
164+
values = {
165+
"apple_platform_type": "macos",
166+
"cpu": "darwin",
167+
},
168+
visibility = ["//visibility:public"],
169+
)
170+
168171
config_setting(
169172
name = "ios",
170-
values = {"crosstool_top": "//tools/osx/crosstool:crosstool"},
173+
values = {"apple_platform_type": "ios"},
171174
visibility = ["//visibility:public"],
172175
)
173176

@@ -467,7 +470,7 @@ tf_cc_shared_object(
467470
name = "libtensorflow_framework.so",
468471
framework_so = [],
469472
linkopts = select({
470-
"//tensorflow:darwin": [],
473+
"//tensorflow:macos": [],
471474
"//tensorflow:windows": [],
472475
"//conditions:default": [
473476
"-Wl,--version-script,$(location //tensorflow:tf_framework_version_script.lds)",
@@ -503,7 +506,7 @@ tf_cc_shared_object(
503506
tf_cc_shared_object(
504507
name = "tensorflow",
505508
linkopts = select({
506-
"//tensorflow:darwin": [
509+
"//tensorflow:macos": [
507510
"-Wl,-exported_symbols_list,$(location //tensorflow/c:exported_symbols.lds)",
508511
"-Wl,-install_name,@rpath/libtensorflow.so",
509512
],
@@ -535,7 +538,7 @@ tf_cc_shared_object(
535538
tf_cc_shared_object(
536539
name = "tensorflow_cc",
537540
linkopts = select({
538-
"//tensorflow:darwin": [
541+
"//tensorflow:macos": [
539542
"-Wl,-exported_symbols_list,$(location //tensorflow:tf_exported_symbols.lds)",
540543
],
541544
"//tensorflow:windows": [],

tensorflow/c/BUILD

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ tf_cuda_cc_test(
282282
],
283283
kernels = [":test_op_kernel"],
284284
linkopts = select({
285-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
285+
"//tensorflow:macos": ["-headerpad_max_install_names"],
286286
"//conditions:default": [],
287287
}),
288288
tags = [
@@ -331,7 +331,7 @@ tf_cc_test(
331331
srcs = ["c_api_experimental_test.cc"],
332332
data = ["testdata/tf_record"],
333333
linkopts = select({
334-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
334+
"//tensorflow:macos": ["-headerpad_max_install_names"],
335335
"//conditions:default": [],
336336
}),
337337
# We must ensure that the dependencies can be dynamically linked since
@@ -400,7 +400,7 @@ tf_cuda_cc_test(
400400
size = "small",
401401
srcs = ["env_test.cc"],
402402
linkopts = select({
403-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
403+
"//tensorflow:macos": ["-headerpad_max_install_names"],
404404
"//conditions:default": [],
405405
}),
406406
tags = ["noasan"],
@@ -421,7 +421,7 @@ tf_cuda_cc_test(
421421
size = "small",
422422
srcs = ["kernels_test.cc"],
423423
linkopts = select({
424-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
424+
"//tensorflow:macos": ["-headerpad_max_install_names"],
425425
"//conditions:default": [],
426426
}),
427427
tags = ["noasan"],

tensorflow/cc/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ tf_cc_binary(
686686
copts = tf_copts(),
687687
linkopts = select({
688688
"//tensorflow:windows": [],
689-
"//tensorflow:darwin": [
689+
"//tensorflow:macos": [
690690
"-lm",
691691
"-lpthread",
692692
],

tensorflow/compiler/aot/tfcompile.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,6 @@ def target_llvm_triple():
392392
"//tensorflow:android_x86": "i686-none-android",
393393
"//tensorflow:ios": "arm64-none-ios",
394394
"//tensorflow:linux_ppc64le": "ppc64le-ibm-linux-gnu",
395-
"//tensorflow:darwin": "x86_64-none-darwin",
395+
"//tensorflow:macos": "x86_64-none-darwin",
396396
"//conditions:default": "x86_64-pc-linux",
397397
})

tensorflow/compiler/xla/python/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ tf_py_wrap_cc(
119119
"//tensorflow/python:platform/base.i",
120120
],
121121
version_script = select({
122-
"//tensorflow:darwin": "pywrap_xla_exported_symbols.lds",
122+
"//tensorflow:macos": "pywrap_xla_exported_symbols.lds",
123123
"//tensorflow:windows": None,
124124
"//conditions:default": "pywrap_xla_version_script.lds",
125125
}),
@@ -143,7 +143,7 @@ tf_py_wrap_cc(
143143
"//tensorflow/python:platform/base.i",
144144
],
145145
version_script = select({
146-
"//tensorflow:darwin": "pywrap_xla_exported_symbols.lds",
146+
"//tensorflow:macos": "pywrap_xla_exported_symbols.lds",
147147
"//tensorflow:windows": None,
148148
"//conditions:default": "pywrap_xla_version_script.lds",
149149
}),

tensorflow/contrib/util/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ tf_cc_test(
4444
name = "convert_graphdef_memmapped_format_test",
4545
srcs = ["convert_graphdef_memmapped_format_test.cc"],
4646
linkopts = select({
47-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
47+
"//tensorflow:macos": ["-headerpad_max_install_names"],
4848
"//conditions:default": [],
4949
}),
5050
deps = [

tensorflow/core/BUILD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3918,7 +3918,7 @@ tf_cc_tests(
39183918
"util/work_sharder_test.cc",
39193919
],
39203920
linkopts = select({
3921-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
3921+
"//tensorflow:macos": ["-headerpad_max_install_names"],
39223922
"//conditions:default": [],
39233923
}),
39243924
linkstatic = tf_kernel_tests_linkstatic(),
@@ -3958,7 +3958,7 @@ tf_cc_tests(
39583958
"graph/graph_constructor_test.cc",
39593959
],
39603960
linkopts = select({
3961-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
3961+
"//tensorflow:macos": ["-headerpad_max_install_names"],
39623962
"//conditions:default": [],
39633963
}),
39643964
linkstatic = tf_kernel_tests_linkstatic(),

tensorflow/core/distributed_runtime/rpc/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ tf_cuda_cc_tests(
420420
"rpc_rendezvous_mgr_test.cc",
421421
],
422422
linkopts = select({
423-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
423+
"//tensorflow:macos": ["-headerpad_max_install_names"],
424424
"//conditions:default": [],
425425
}),
426426
linkstatic = tf_kernel_tests_linkstatic(),

tensorflow/core/kernels/BUILD

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ tf_cc_test(
17611761
size = "small",
17621762
srcs = ["slice_op_test.cc"],
17631763
linkopts = select({
1764-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
1764+
"//tensorflow:macos": ["-headerpad_max_install_names"],
17651765
"//conditions:default": [],
17661766
}),
17671767
deps = [
@@ -2688,7 +2688,7 @@ tf_cc_tests(
26882688
"scale_and_translate_op_test.cc",
26892689
],
26902690
linkopts = select({
2691-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
2691+
"//tensorflow:macos": ["-headerpad_max_install_names"],
26922692
"//conditions:default": [],
26932693
}),
26942694
deps = [
@@ -2918,7 +2918,7 @@ tf_kernel_library(
29182918
# and f2c helper functions in global namespace. Tell the compiler to
29192919
# allow multiple definitions when linking this.
29202920
linkopts = select({
2921-
"//tensorflow:darwin": [],
2921+
"//tensorflow:macos": [],
29222922
"//tensorflow:windows": [],
29232923
"//conditions:default": ["-Wl,-z,muldefs"],
29242924
}),
@@ -3554,7 +3554,7 @@ tf_cuda_cc_test(
35543554
size = "small",
35553555
srcs = ["scan_ops_test.cc"],
35563556
linkopts = select({
3557-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
3557+
"//tensorflow:macos": ["-headerpad_max_install_names"],
35583558
"//conditions:default": [],
35593559
}),
35603560
deps = [
@@ -3577,7 +3577,7 @@ tf_cuda_cc_test(
35773577
size = "small",
35783578
srcs = ["reduction_ops_test.cc"],
35793579
linkopts = select({
3580-
"//tensorflow:darwin": ["-headerpad_max_install_names"],
3580+
"//tensorflow:macos": ["-headerpad_max_install_names"],
35813581
"//conditions:default": [],
35823582
}),
35833583
deps = [

0 commit comments

Comments
 (0)