From 0f266741c12ae46ea250a8a1765dbbc5c738935f Mon Sep 17 00:00:00 2001 From: Ivaylo Enchev Date: Mon, 25 Aug 2025 11:13:42 -0700 Subject: [PATCH] ET windows build flags Add compiler flags for windows msvc builds Differential Revision: [D78854132](https://our.internmc.facebook.com/intern/diff/D78854132/) [ghstack-poisoned] --- kernels/portable/cpu/pattern/targets.bzl | 5 +- kernels/portable/cpu/util/targets.bzl | 53 +++++++++++++++---- .../core/portable_type/c10/c10/targets.bzl | 2 +- 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/kernels/portable/cpu/pattern/targets.bzl b/kernels/portable/cpu/pattern/targets.bzl index 636c5d2127b..c03c5f4ceca 100644 --- a/kernels/portable/cpu/pattern/targets.bzl +++ b/kernels/portable/cpu/pattern/targets.bzl @@ -54,7 +54,10 @@ def define_common_targets(): exported_headers = [ "pattern.h", ], - compiler_flags = ["-Wno-missing-prototypes"], + compiler_flags = select({ + "DEFAULT":["-Wno-missing-prototypes"], + "ovr_config//compiler:msvc": [], + }), exported_deps = [ "//executorch/kernels/portable/cpu/util:broadcast_util", "//executorch/kernels/portable/cpu/util:functional_util", diff --git a/kernels/portable/cpu/util/targets.bzl b/kernels/portable/cpu/util/targets.bzl index 8194b37f319..c9a3271a04f 100644 --- a/kernels/portable/cpu/util/targets.bzl +++ b/kernels/portable/cpu/util/targets.bzl @@ -45,7 +45,10 @@ def define_common_targets(): exported_headers = [ "activation_ops_util.h", ], - compiler_flags = ["-Wno-missing-prototypes"], + compiler_flags = select({ + "DEFAULT":["-Wno-missing-prototypes"], + "ovr_config//compiler:msvc": [], + }), deps = [ "//executorch/runtime/core/exec_aten/util:tensor_shape_to_c_string", "//executorch/runtime/kernel:kernel_includes", @@ -95,7 +98,10 @@ def define_common_targets(): exported_headers = [ "dtype_util.h", ], - compiler_flags = ["-Wno-missing-prototypes"], + compiler_flags = select({ + "DEFAULT":["-Wno-missing-prototypes"], + "ovr_config//compiler:msvc": [], + }), deps = [ "//executorch/runtime/kernel:kernel_includes", ], @@ -107,7 +113,10 @@ def define_common_targets(): exported_headers = [ "elementwise_util.h", ], - compiler_flags = ["-Wno-missing-prototypes"], + compiler_flags = select({ + "DEFAULT":["-Wno-missing-prototypes"], + "ovr_config//compiler:msvc": [], + }), exported_deps = [ ":broadcast_indexes_range", ":broadcast_util", @@ -131,7 +140,10 @@ def define_common_targets(): exported_headers = [ "advanced_index_util.h", ], - compiler_flags = ["-Wno-missing-prototypes"], + compiler_flags = select({ + "DEFAULT":["-Wno-missing-prototypes"], + "ovr_config//compiler:msvc": [], + }), deps = [ ":broadcast_util", "//executorch/runtime/core/exec_aten/util:tensor_shape_to_c_string", @@ -146,8 +158,12 @@ def define_common_targets(): exported_headers = [ "copy_ops_util.h", ], - compiler_flags = ["-Wno-missing-prototypes"], - exported_deps = [ + + compiler_flags = select({ + "DEFAULT":["-Wno-missing-prototypes"], + "ovr_config//compiler:msvc": [], + }), +exported_deps = [ ":broadcast_util", ], deps = [ @@ -162,7 +178,10 @@ def define_common_targets(): exported_headers = [ "distance_util.h", ], - compiler_flags = ["-Wno-missing-prototypes"], + compiler_flags = select({ + "DEFAULT":["-Wno-missing-prototypes"], + "ovr_config//compiler:msvc": [], + }), deps = [ "//executorch/runtime/kernel:kernel_includes", ], @@ -175,7 +194,10 @@ def define_common_targets(): exported_headers = [ "kernel_ops_util.h", ], - compiler_flags = ["-Wno-missing-prototypes"], + compiler_flags = select({ + "DEFAULT":["-Wno-missing-prototypes"], + "ovr_config//compiler:msvc": [], + }), deps = [ "//executorch/runtime/kernel:kernel_includes", ], @@ -188,7 +210,10 @@ def define_common_targets(): exported_headers = [ "matmul_ops_util.h", ], - compiler_flags = ["-Wno-missing-prototypes"], + compiler_flags = select({ + "DEFAULT":["-Wno-missing-prototypes"], + "ovr_config//compiler:msvc": [], + }), deps = [ ":broadcast_util", "//executorch/runtime/kernel:kernel_includes", @@ -202,7 +227,10 @@ def define_common_targets(): exported_headers = [ "padding_util.h", ], - compiler_flags = ["-Wno-missing-prototypes"], + compiler_flags = select({ + "DEFAULT":["-Wno-missing-prototypes"], + "ovr_config//compiler:msvc": [], + }), deps = [ "//executorch/runtime/kernel:kernel_includes", ], @@ -215,7 +243,10 @@ def define_common_targets(): exported_headers = [ "normalization_ops_util.h", ], - compiler_flags = ["-Wno-missing-prototypes"], + compiler_flags = select({ + "DEFAULT":["-Wno-missing-prototypes"], + "ovr_config//compiler:msvc": [], + }), deps = [ "//executorch/runtime/kernel:kernel_includes", ], diff --git a/runtime/core/portable_type/c10/c10/targets.bzl b/runtime/core/portable_type/c10/c10/targets.bzl index c89212ce9d5..d717437f8b6 100644 --- a/runtime/core/portable_type/c10/c10/targets.bzl +++ b/runtime/core/portable_type/c10/c10/targets.bzl @@ -46,7 +46,7 @@ def get_sleef_deps(): "fbsource//third-party/sleef:sleef", ], }), - "ovr_config//os:windows": [], + "ovr_config//os:windows": ["fbsource//third-party/sleef:sleef"], }) def define_common_targets():