Skip to content

Commit e2b5bca

Browse files
authored
Add select for compiler_flags in kernels bzl files
Differential Revision: D65393523 Pull Request resolved: #6627
1 parent 8ab3385 commit e2b5bca

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

kernels/aten/cpu/util/targets.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ def define_common_targets():
1414
exported_headers = [
1515
"copy_ops_util.h",
1616
],
17-
compiler_flags = ["-Wno-missing-prototypes"],
17+
compiler_flags = select({
18+
"DEFAULT": ["-Wno-missing-prototypes"],
19+
"ovr_config//os:windows": [],
20+
}),
1821
deps = [
1922
"//executorch/runtime/kernel:kernel_includes_aten",
2023
"//executorch/runtime/core/exec_aten/util:tensor_util_aten",

kernels/prim_ops/targets.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def define_common_targets():
4848
# @lint-ignore BUCKLINT link_whole, need this to register prim ops.
4949
link_whole = True,
5050
# prim ops are registered through a global table so the ctor needs to be allowed
51-
compiler_flags = ["-Wno-global-constructors"],
51+
compiler_flags = select({
52+
"DEFAULT": ["-Wno-global-constructors"],
53+
"ovr_config//os:windows": [],
54+
}),
5255
deps = [
5356
":et_copy_index" + aten_suffix,
5457
":et_view" + aten_suffix,

shim/xplat/executorch/codegen/codegen.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,10 @@ def executorch_generated_lib(
630630
link_whole = True,
631631
visibility = visibility,
632632
# Operator Registration is done through static tables
633-
compiler_flags = ["-Wno-global-constructors"] + compiler_flags,
633+
compiler_flags = select({
634+
"DEFAULT": ["-Wno-global-constructors"],
635+
"ovr_config//os:windows": [],
636+
}) + compiler_flags,
634637
deps = [
635638
"//executorch/runtime/kernel:operator_registry",
636639
"//executorch/kernels/prim_ops:prim_ops_registry" + aten_suffix,

shim/xplat/executorch/kernels/portable/op_registration_util.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ def define_op_library(name, deps, android_deps, aten_target, _allow_third_party_
126126
fbandroid_platform_deps = android_deps,
127127
# kernels often have helpers with no prototypes just disabling the warning here as the headers
128128
# are codegend and linked in later
129-
compiler_flags = ["-Wno-missing-prototypes"] + (
129+
compiler_flags = select({
130+
"DEFAULT": ["-Wno-missing-prototypes"],
131+
"ovr_config//os:windows": [],
132+
}) + (
130133
# For shared library build, we don't want to expose symbols of
131134
# kernel implementation (ex torch::executor::native::tanh_out)
132135
# to library users. They should use kernels through registry only.

0 commit comments

Comments
 (0)