Enable Android lib bazel build for mips and mips64 (#11773)

This commit is contained in:
resec 2017-07-27 01:51:17 +08:00 committed by Vijay Vasudevan
parent b244912b2f
commit 2b4a0f9a48
5 changed files with 40 additions and 4 deletions

View File

@ -32,6 +32,9 @@ load("//tensorflow:workspace.bzl", "tf_workspace")
# name="androidndk", # name="androidndk",
# path="<PATH_TO_NDK>", # path="<PATH_TO_NDK>",
# # This needs to be 14 or higher to compile TensorFlow. # # This needs to be 14 or higher to compile TensorFlow.
# # Please specify API level to >= 21 to build for 64-bit
# # archtectures or the Android NDK will automatically select biggest
# # API level that it supports without notice.
# # Note that the NDK version is not the API level. # # Note that the NDK version is not the API level.
# api_level=14) # api_level=14)

View File

@ -63,6 +63,24 @@ config_setting(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
config_setting(
name = "android_mips",
values = {
"crosstool_top": "//external:android/crosstool",
"cpu": "mips",
},
visibility = ["//visibility:public"],
)
config_setting(
name = "android_mips64",
values = {
"crosstool_top": "//external:android/crosstool",
"cpu": "mips64",
},
visibility = ["//visibility:public"],
)
config_setting( config_setting(
name = "darwin", name = "darwin",
values = {"cpu": "darwin"}, values = {"cpu": "darwin"},

View File

@ -11,6 +11,7 @@ load(
"//tensorflow:tensorflow.bzl", "//tensorflow:tensorflow.bzl",
"tf_copts", "tf_copts",
"if_android", "if_android",
"if_android_mips",
) )
exports_files([ exports_files([
@ -85,7 +86,7 @@ cc_binary(
"-Wl,--gc-sections", "-Wl,--gc-sections",
"-Wl,--version-script", # This line must be directly followed by LINKER_SCRIPT. "-Wl,--version-script", # This line must be directly followed by LINKER_SCRIPT.
LINKER_SCRIPT, LINKER_SCRIPT,
]), ]) + if_android_mips(["-latomic"]),
linkshared = 1, linkshared = 1,
linkstatic = 1, linkstatic = 1,
tags = [ tags = [

View File

@ -64,6 +64,7 @@ load(
"//tensorflow:tensorflow.bzl", "//tensorflow:tensorflow.bzl",
"full_path", "full_path",
"if_android", "if_android",
"if_not_android_mips_and_mips64",
"if_ios", "if_ios",
"if_linux_x86_64", "if_linux_x86_64",
"if_not_mobile", "if_not_mobile",
@ -933,9 +934,7 @@ filegroup(
cc_library( cc_library(
name = "android_tensorflow_lib_lite", name = "android_tensorflow_lib_lite",
srcs = if_android(["//tensorflow/core:android_srcs"]), srcs = if_android(["//tensorflow/core:android_srcs"]),
copts = tf_copts() + [ copts = tf_copts() + if_not_android_mips_and_mips64(["-Os"]),
"-Os",
],
linkopts = ["-lz"], linkopts = ["-lz"],
tags = [ tags = [
"manual", "manual",

View File

@ -72,6 +72,13 @@ def if_android_arm64(a):
}) })
def if_android_mips(a):
return select({
clean_dep("//tensorflow:android_mips"): a,
"//conditions:default": [],
})
def if_not_android(a): def if_not_android(a):
return select({ return select({
clean_dep("//tensorflow:android"): [], clean_dep("//tensorflow:android"): [],
@ -79,6 +86,14 @@ def if_not_android(a):
}) })
def if_not_android_mips_and_mips64(a):
return select({
clean_dep("//tensorflow:android_mips"): [],
clean_dep("//tensorflow:android_mips64"): [],
"//conditions:default": a,
})
def if_android(a): def if_android(a):
return select({ return select({
clean_dep("//tensorflow:android"): a, clean_dep("//tensorflow:android"): a,