diff --git a/mace/examples/BUILD b/mace/examples/BUILD index 82915d74e05e02c0bbddc04163d7c4e53f12f22b..93303bfec49e58825b276b19514a2000ae9978b6 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 098e80a949d457406730e0f0146b45c03b75faee..ea70ff22add88aec5c0ce964fb53111c6f8fc2a8 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 ed251b51884016e01f8cc0dd56821bed3005a3ec..eaaa11d3339c0d2a7a7c2f534d68d830605f3daf 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, )