提交 c59be5ae 编写于 作者: Y yejianwu

update copts in bazel

上级 42160b31
...@@ -16,7 +16,7 @@ cc_library( ...@@ -16,7 +16,7 @@ cc_library(
srcs = ["statistics.cc"], srcs = ["statistics.cc"],
hdrs = ["statistics.h"], hdrs = ["statistics.h"],
linkstatic = 1, linkstatic = 1,
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
"//mace/kernels", "//mace/kernels",
"//mace/utils", "//mace/utils",
...@@ -28,8 +28,12 @@ cc_binary( ...@@ -28,8 +28,12 @@ cc_binary(
srcs = [ srcs = [
"benchmark_model.cc", "benchmark_model.cc",
], ],
copts = if_android(["-DMACE_ENABLE_OPENCL"]), copts = [
linkopts = ["-Werror"] + if_openmp_enabled(["-fopenmp"]), "-Werror",
"-Wextra",
"-Wno-missing-field-initializers",
] + if_android(["-DMACE_ENABLE_OPENCL"]),
linkopts = if_openmp_enabled(["-fopenmp"]),
linkstatic = 1, linkstatic = 1,
deps = [ deps = [
":statistics", ":statistics",
...@@ -41,7 +45,6 @@ cc_binary( ...@@ -41,7 +45,6 @@ cc_binary(
cc_library( cc_library(
name = "libmace_merged", name = "libmace_merged",
copts = ["-Werror"],
srcs = [ srcs = [
"libmace_merged.a", "libmace_merged.a",
], ],
...@@ -53,7 +56,7 @@ cc_binary( ...@@ -53,7 +56,7 @@ cc_binary(
srcs = ["model_throughput_test.cc"], srcs = ["model_throughput_test.cc"],
linkopts = if_openmp_enabled(["-fopenmp"]), linkopts = if_openmp_enabled(["-fopenmp"]),
linkstatic = 1, linkstatic = 1,
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
":libmace_merged", ":libmace_merged",
"//external:gflags_nothreads", "//external:gflags_nothreads",
......
...@@ -10,7 +10,7 @@ cc_library( ...@@ -10,7 +10,7 @@ cc_library(
srcs = glob(["models/*/*.cc"]), srcs = glob(["models/*/*.cc"]),
hdrs = glob(["models/*/*.h"]), hdrs = glob(["models/*/*.h"]),
linkstatic = 1, linkstatic = 1,
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
"//mace/core", "//mace/core",
"//mace/ops", "//mace/ops",
...@@ -20,28 +20,28 @@ cc_library( ...@@ -20,28 +20,28 @@ cc_library(
cc_library( cc_library(
name = "generated_opencl", name = "generated_opencl",
srcs = glob(["opencl/*.cc"]), srcs = glob(["opencl/*.cc"]),
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
linkstatic = 1, linkstatic = 1,
) )
cc_library( cc_library(
name = "generated_tuning_params", name = "generated_tuning_params",
srcs = ["tuning/tuning_params.cc"], srcs = ["tuning/tuning_params.cc"],
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
linkstatic = 1, linkstatic = 1,
) )
cc_library( cc_library(
name = "generated_version", name = "generated_version",
srcs = ["version/version.cc"], srcs = ["version/version.cc"],
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
linkstatic = 1, linkstatic = 1,
) )
cc_library( cc_library(
name = "generated_mace_engine_factory", name = "generated_mace_engine_factory",
hdrs = ["engine/mace_engine_factory.h"], hdrs = ["engine/mace_engine_factory.h"],
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
"//mace/public", "//mace/public",
], ],
......
...@@ -44,6 +44,8 @@ cc_library( ...@@ -44,6 +44,8 @@ cc_library(
)) + if_hexagon_enabled(glob(["runtime/hexagon/*.h"])), )) + if_hexagon_enabled(glob(["runtime/hexagon/*.h"])),
copts = [ copts = [
"-Werror", "-Werror",
"-Wextra",
"-Wno-missing-field-initializers",
] + if_openmp_enabled([ ] + if_openmp_enabled([
"-fopenmp", "-fopenmp",
"-DMACE_ENABLE_OPENMP", "-DMACE_ENABLE_OPENMP",
...@@ -77,7 +79,7 @@ cc_library( ...@@ -77,7 +79,7 @@ cc_library(
hdrs = glob([ hdrs = glob([
"runtime/opencl/*.h", "runtime/opencl/*.h",
]), ]),
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
"@opencl_clhpp//:opencl_clhpp", "@opencl_clhpp//:opencl_clhpp",
"@opencl_headers//:opencl20_headers", "@opencl_headers//:opencl20_headers",
...@@ -94,7 +96,7 @@ cc_library( ...@@ -94,7 +96,7 @@ cc_library(
hdrs = [ hdrs = [
"testing/test_benchmark.h", "testing/test_benchmark.h",
], ],
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
":core", ":core",
"//external:gflags_nothreads", "//external:gflags_nothreads",
......
...@@ -6,7 +6,7 @@ cc_binary( ...@@ -6,7 +6,7 @@ cc_binary(
srcs = ["example.cc"], srcs = ["example.cc"],
linkopts = if_openmp_enabled(["-fopenmp"]), linkopts = if_openmp_enabled(["-fopenmp"]),
linkstatic = 1, linkstatic = 1,
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
"//external:gflags_nothreads", "//external:gflags_nothreads",
"//mace/codegen:generated_models", "//mace/codegen:generated_models",
......
...@@ -38,7 +38,7 @@ cc_library( ...@@ -38,7 +38,7 @@ cc_library(
"opencl/*.h", "opencl/*.h",
"buffer_to_image.h", "buffer_to_image.h",
])), ])),
copts = ["-Werror"] + copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"] +
if_openmp_enabled(["-fopenmp"]) + if_openmp_enabled(["-fopenmp"]) +
if_neon_enabled(["-DMACE_ENABLE_NEON"]) + if_neon_enabled(["-DMACE_ENABLE_NEON"]) +
if_android_armv7(["-mfpu=neon"]) + if_android_armv7(["-mfpu=neon"]) +
...@@ -62,7 +62,7 @@ cc_test( ...@@ -62,7 +62,7 @@ cc_test(
"opencl/*_test.cc", "opencl/*_test.cc",
], ],
), ),
copts = ["-Werror"] + copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"] +
if_openmp_enabled(["-fopenmp"]) + if_openmp_enabled(["-fopenmp"]) +
if_neon_enabled(["-DMACE_ENABLE_NEON"]) + if_neon_enabled(["-DMACE_ENABLE_NEON"]) +
if_android_armv7(["-mfpu=neon"]) + if_android_armv7(["-mfpu=neon"]) +
......
...@@ -15,7 +15,7 @@ cc_library( ...@@ -15,7 +15,7 @@ cc_library(
hdrs = [ hdrs = [
"ops_test_util.h", "ops_test_util.h",
], ],
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
"//mace/core", "//mace/core",
"@gtest//:gtest", "@gtest//:gtest",
...@@ -41,7 +41,7 @@ cc_library( ...@@ -41,7 +41,7 @@ cc_library(
["*.h"], ["*.h"],
exclude = ["ops_test_util.h"], exclude = ["ops_test_util.h"],
), ),
copts = ["-Werror"] + copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"] +
if_openmp_enabled(["-fopenmp"]) + if_openmp_enabled(["-fopenmp"]) +
if_neon_enabled(["-DMACE_ENABLE_NEON"]) + if_neon_enabled(["-DMACE_ENABLE_NEON"]) +
if_android_armv7(["-mfpu=neon"]) + if_android_armv7(["-mfpu=neon"]) +
...@@ -60,7 +60,7 @@ cc_test( ...@@ -60,7 +60,7 @@ cc_test(
srcs = glob( srcs = glob(
["*_test.cc"], ["*_test.cc"],
), ),
copts = ["-Werror"] + copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"] +
if_openmp_enabled(["-fopenmp"]) + if_openmp_enabled(["-fopenmp"]) +
if_neon_enabled(["-DMACE_ENABLE_NEON"]) + if_neon_enabled(["-DMACE_ENABLE_NEON"]) +
if_android_armv7(["-mfpu=neon"]) + if_android_armv7(["-mfpu=neon"]) +
...@@ -80,7 +80,7 @@ cc_test( ...@@ -80,7 +80,7 @@ cc_test(
name = "ops_benchmark", name = "ops_benchmark",
testonly = 1, testonly = 1,
srcs = glob(["*_benchmark.cc"]), srcs = glob(["*_benchmark.cc"]),
copts = ["-Werror"] + copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"] +
if_openmp_enabled(["-fopenmp"]) + if_openmp_enabled(["-fopenmp"]) +
if_neon_enabled(["-DMACE_ENABLE_NEON"]) + if_neon_enabled(["-DMACE_ENABLE_NEON"]) +
if_android_armv7(["-mfpu=neon"]) + if_android_armv7(["-mfpu=neon"]) +
......
...@@ -13,7 +13,7 @@ cc_library( ...@@ -13,7 +13,7 @@ cc_library(
"mace.h", "mace.h",
"mace_runtime.h", "mace_runtime.h",
], ],
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
"//mace/proto:mace_cc", "//mace/proto:mace_cc",
], ],
......
...@@ -13,7 +13,7 @@ cc_test( ...@@ -13,7 +13,7 @@ cc_test(
name = "mace_api_test", name = "mace_api_test",
testonly = 1, testonly = 1,
srcs = ["mace_api_test.cc"], srcs = ["mace_api_test.cc"],
copts = ["-Werror"] + copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"] +
if_openmp_enabled(["-fopenmp"]) + if_openmp_enabled(["-fopenmp"]) +
if_neon_enabled(["-DMACE_ENABLE_NEON"]) + if_neon_enabled(["-DMACE_ENABLE_NEON"]) +
if_android_armv7(["-mfpu=neon"]) + if_android_armv7(["-mfpu=neon"]) +
...@@ -34,7 +34,7 @@ cc_test( ...@@ -34,7 +34,7 @@ cc_test(
name = "mace_api_mt_test", name = "mace_api_mt_test",
testonly = 1, testonly = 1,
srcs = ["mace_api_mt_test.cc"], srcs = ["mace_api_mt_test.cc"],
copts = ["-Werror"] + copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"] +
if_openmp_enabled(["-fopenmp"]) + if_openmp_enabled(["-fopenmp"]) +
if_neon_enabled(["-DMACE_ENABLE_NEON"]) + if_neon_enabled(["-DMACE_ENABLE_NEON"]) +
if_android_armv7(["-mfpu=neon"]) + if_android_armv7(["-mfpu=neon"]) +
......
...@@ -28,7 +28,7 @@ cc_library( ...@@ -28,7 +28,7 @@ cc_library(
linkopts = if_android([ linkopts = if_android([
"-llog", "-llog",
]), ]),
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
"//mace/public", "//mace/public",
"//mace/proto:mace_cc", "//mace/proto:mace_cc",
...@@ -40,7 +40,7 @@ cc_library( ...@@ -40,7 +40,7 @@ cc_library(
srcs = [ srcs = [
"tuner_development.cc", "tuner_development.cc",
], ],
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
":utils", ":utils",
], ],
...@@ -51,7 +51,7 @@ cc_library( ...@@ -51,7 +51,7 @@ cc_library(
srcs = [ srcs = [
"tuner_production.cc", "tuner_production.cc",
], ],
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
deps = [ deps = [
":utils", ":utils",
"//mace/codegen:generated_tuning_params", "//mace/codegen:generated_tuning_params",
...@@ -64,7 +64,7 @@ cc_test( ...@@ -64,7 +64,7 @@ cc_test(
srcs = [ srcs = [
"tuner_test.cc", "tuner_test.cc",
], ],
copts = ["-Werror"], copts = ["-Werror", "-Wextra", "-Wno-missing-field-initializers"],
linkopts = if_android([ linkopts = if_android([
"-pie", "-pie",
"-lm", # Required by unordered_map "-lm", # Required by unordered_map
......
...@@ -287,8 +287,6 @@ def bazel_build(target, ...@@ -287,8 +287,6 @@ def bazel_build(target,
target, target,
"--copt=-std=c++11", "--copt=-std=c++11",
"--copt=-D_GLIBCXX_USE_C99_MATH_TR1", "--copt=-D_GLIBCXX_USE_C99_MATH_TR1",
"--copt=-Wextra",
"--copt=-Wno-missing-field-initializers",
"--copt=-O3", "--copt=-O3",
"--define", "--define",
"openmp=%s" % str(enable_openmp).lower(), "openmp=%s" % str(enable_openmp).lower(),
...@@ -315,8 +313,6 @@ def bazel_build(target, ...@@ -315,8 +313,6 @@ def bazel_build(target,
"--cpu=%s" % abi, "--cpu=%s" % abi,
"--copt=-std=c++11", "--copt=-std=c++11",
"--copt=-D_GLIBCXX_USE_C99_MATH_TR1", "--copt=-D_GLIBCXX_USE_C99_MATH_TR1",
"--copt=-Wextra",
"--copt=-Wno-missing-field-initializers",
"--copt=-DMACE_OBFUSCATE_LITERALS", "--copt=-DMACE_OBFUSCATE_LITERALS",
"--copt=-O3", "--copt=-O3",
"--define", "--define",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册