提交 31773f0e 编写于 作者: 叶剑武

Merge branch 'static-cpu-lib' into 'master'

Add if_opencl_enabled_str for build static library without opencl.

See merge request !702
......@@ -15,6 +15,7 @@ load(
"if_android_armv7",
"if_hexagon_enabled",
"if_opencl_enabled",
"if_opencl_enabled_str",
)
cc_library(
......@@ -67,7 +68,6 @@ cc_library(
genrule(
name = "libmace_static",
srcs = [
"//mace/codegen:generated_opencl",
"//mace/codegen:generated_version",
"//mace/core",
"//mace/kernels",
......@@ -76,11 +76,12 @@ genrule(
"//mace/utils",
"//mace/proto:mace_cc",
"@com_google_protobuf//:protobuf_lite",
],
] + if_opencl_enabled([
"//mace/codegen:generated_opencl",
]),
outs = ["libmace.a"],
cmd = "tmp_mri_file=$$(mktemp mace-static-lib-mri.XXXXXXXXXX);" +
"mri_stream=$$(python $(location //mace/python/tools:archive_static_lib) " +
"$(locations //mace/codegen:generated_opencl) " +
"$(locations //mace/codegen:generated_version) " +
"$(locations //mace/core:core) " +
"$(locations //mace/kernels:kernels) " +
......@@ -89,6 +90,7 @@ genrule(
"$(locations //mace/utils:utils) " +
"$(locations //mace/proto:mace_cc) " +
"$(locations @com_google_protobuf//:protobuf_lite) " +
if_opencl_enabled_str("$(locations //mace/codegen:generated_opencl) ") +
"$@ " +
"$$tmp_mri_file);" +
"$(AR) -M <$$tmp_mri_file;" +
......
......@@ -54,6 +54,12 @@ def if_opencl_enabled(a):
"//conditions:default": [],
})
def if_opencl_enabled_str(a):
return select({
"//mace:opencl_enabled": a,
"//conditions:default": "",
})
def mace_version_genrule():
native.genrule(
name = "mace_version_gen",
......
......@@ -6,6 +6,7 @@ def _opencl_encrypt_kernel_impl(repository_ctx):
Label("//repository/opencl-kernel:BUILD.tpl"))
mace_root_path = str(repository_ctx.path(Label("@mace//:BUILD")))[:-len("BUILD")]
generated_files_path = repository_ctx.path("gen")
ret = repository_ctx.execute(
["test", "-f", "%s/.git/logs/HEAD" % mace_root_path])
......@@ -46,8 +47,6 @@ def _opencl_encrypt_kernel_impl(repository_ctx):
unused_var = repository_ctx.path(Label("//:mace/kernels/opencl/cl/space_to_batch.cl"))
unused_var = repository_ctx.path(Label("//:mace/kernels/opencl/cl/winograd_transform.cl"))
generated_files_path = repository_ctx.path("gen")
python_bin_path = repository_ctx.which("python")
repository_ctx.execute([
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册