Make tf_cc_test compilable by default for Android

This change adjusts the build options for tf_cc_test targets so that
they can be built for Android devices by default. Many targets will
still need additional options on a per-target basis.

Android requires that executables be compiled with `-pie`.

PiperOrigin-RevId: 179729092
This commit is contained in:
Austin Anderson 2017-12-20 13:53:00 -08:00 committed by TensorFlower Gardener
parent 3d01a46171
commit c4286420f9

View File

@ -589,7 +589,15 @@ def tf_cc_test(name,
name="%s%s" % (name, suffix), name="%s%s" % (name, suffix),
srcs=srcs + tf_binary_additional_srcs(), srcs=srcs + tf_binary_additional_srcs(),
copts=tf_copts() + extra_copts, copts=tf_copts() + extra_copts,
linkopts=["-lpthread", "-lm"] + linkopts + _rpath_linkopts(name), linkopts=select({
"//tensorflow:android": [
"-pie",
],
"//conditions:default": [
"-lpthread",
"-lm"
],
}) + linkopts + _rpath_linkopts(name),
deps=deps + if_mkl( deps=deps + if_mkl(
[ [
"//third_party/mkl:intel_binary_blob", "//third_party/mkl:intel_binary_blob",