From e5c101edd5a4082792c7fd416850b3639097805f Mon Sep 17 00:00:00 2001 From: Liangliang He Date: Thu, 14 Sep 2017 13:46:11 +0800 Subject: [PATCH] Fix docker bazel build --- mace/examples/BUILD | 9 ++++++--- mace/kernels/BUILD | 8 ++------ mace/ops/BUILD | 9 ++++++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/mace/examples/BUILD b/mace/examples/BUILD index 82915d74..93303bfe 100644 --- a/mace/examples/BUILD +++ b/mace/examples/BUILD @@ -6,20 +6,23 @@ cc_binary( srcs = [ "helloworld.cc", ], - copts = ["-std=c++11"], deps = [ "//mace/core", "//mace/ops", ], + copts = ["-std=c++11"], + linkopts = if_android(["-ldl"]), ) cc_test( name = "benchmark_example", srcs = ["benchmark_example.cc"], - copts = ["-std=c++11"], - linkstatic = 1, deps = [ "//mace/core", "//mace/core:test_benchmark_main", ], + copts = ["-std=c++11"], + linkopts = if_android(["-ldl"]), + linkstatic = 1, + testonly = 1, ) diff --git a/mace/kernels/BUILD b/mace/kernels/BUILD index 098e80a9..ea70ff22 100644 --- a/mace/kernels/BUILD +++ b/mace/kernels/BUILD @@ -18,9 +18,7 @@ cc_library( "//mace/core:core", ], copts = ['-std=c++11'], - linkopts = ["-fopenmp"] + if_android([ - "-lm", - ]), + linkopts = ["-fopenmp"] + if_android(["-lm"]), ) cc_test( @@ -32,9 +30,7 @@ cc_test( "//mace/core:core", ], copts = ['-std=c++11'], - linkopts = if_android([ - "-pie", - ]), + linkopts = if_android(["-pie"]), linkstatic = 1, testonly = 1, ) diff --git a/mace/ops/BUILD b/mace/ops/BUILD index ed251b51..eaaa11d3 100644 --- a/mace/ops/BUILD +++ b/mace/ops/BUILD @@ -31,12 +31,12 @@ cc_library( ["*.h"], exclude = ["ops_test_util.h"], ), - copts = ["-std=c++11"], deps = [ "//mace/core", "//mace/kernels", "//mace/proto:cc_proto", ], + copts = ["-std=c++11"], alwayslink = 1, ) @@ -45,13 +45,15 @@ cc_test( srcs = glob( ["*_test.cc"], ), - copts = ["-std=c++11"], - linkstatic = 1, deps = [ ":ops", ":test", "@gtest//:gtest_main", ], + copts = ["-std=c++11"], + linkopts = if_android(["-ldl"]), + linkstatic = 1, + testonly = 1, ) cc_test( @@ -64,6 +66,7 @@ cc_test( "//mace/core:test_benchmark_main", ], copts = ['-std=c++11'], + linkopts = if_android(["-ldl"]), linkstatic = 1, testonly = 1, ) -- GitLab