From 370fcfb47b83599d8abf894b2c1e044624789993 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Sat, 24 Jan 2026 10:33:13 -0800 Subject: [PATCH] More fix --- .bazelrc | 6 +++++- python/tflite_micro/signal/BUILD | 14 ++++++++++++++ python/tflite_micro/signal/tflm_signal.bzl | 1 + python/tflite_micro/signal/utils/BUILD | 7 +++++++ signal/micro/kernels/BUILD | 17 +++++++++++++++++ 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index e32343bc7ba..472dea798b8 100644 --- a/.bazelrc +++ b/.bazelrc @@ -27,8 +27,12 @@ build --workspace_status_command=./tools/workspace_status.sh # TODO(b/315853820): Needed for Bazel 7.0, until migrated to bzlmod build --noenable_bzlmod +# Automatically enable the config matching the host OS +common --enable_platform_specific_config + # Use the following C++ standard -build --cxxopt=-std=c++17 +build:linux --cxxopt=-std=c++17 +build:macos --cxxopt=-std=c++17 build:windows --cxxopt=/std:c++17 # Common options for --config=ci diff --git a/python/tflite_micro/signal/BUILD b/python/tflite_micro/signal/BUILD index 31759fce8b2..f8941ca2c1f 100644 --- a/python/tflite_micro/signal/BUILD +++ b/python/tflite_micro/signal/BUILD @@ -62,6 +62,11 @@ py_tflm_signal_library( ], ) +TARGET_COMPATIBLE_WITH = select({ + "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], + "//conditions:default": [], +}) + py_test( name = "delay_op_test", size = "small", @@ -71,6 +76,7 @@ py_test( "nomsan", "noubsan", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":delay_op", requirement("numpy"), @@ -102,6 +108,7 @@ py_test( "nomsan", "noubsan", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":energy_op", requirement("numpy"), @@ -133,6 +140,7 @@ py_test( "nomsan", "noubsan", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":fft_ops", requirement("numpy"), @@ -170,6 +178,7 @@ py_test( "nomsan", "noubsan", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":filter_bank_ops", requirement("numpy"), @@ -201,6 +210,7 @@ py_test( "nomsan", "noubsan", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":framer_op", requirement("numpy"), @@ -229,6 +239,7 @@ py_test( "nomsan", "noubsan", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":overlap_add_op", requirement("absl_py"), @@ -261,6 +272,7 @@ py_test( "nomsan", "noubsan", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":pcan_op", requirement("numpy"), @@ -292,6 +304,7 @@ py_test( "nomsan", "noubsan", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":stacker_op", requirement("numpy"), @@ -322,6 +335,7 @@ py_test( "nomsan", "noubsan", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":window_op", requirement("numpy"), diff --git a/python/tflite_micro/signal/tflm_signal.bzl b/python/tflite_micro/signal/tflm_signal.bzl index 4178759776e..59fec51f80c 100644 --- a/python/tflite_micro/signal/tflm_signal.bzl +++ b/python/tflite_micro/signal/tflm_signal.bzl @@ -35,6 +35,7 @@ def py_tflm_signal_library( if srcs: binary_path_end_pos = srcs[0].rfind("/") binary_path = srcs[0][0:binary_path_end_pos] + binary_name = binary_path + "/_" + cc_op_kernels[0][1:] + ".so" if cc_op_defs: binary_name = "ops/_" + name + ".so" diff --git a/python/tflite_micro/signal/utils/BUILD b/python/tflite_micro/signal/utils/BUILD index f16e7b37699..e436cd43c39 100644 --- a/python/tflite_micro/signal/utils/BUILD +++ b/python/tflite_micro/signal/utils/BUILD @@ -11,6 +11,11 @@ package( licenses = ["notice"], ) +TARGET_COMPATIBLE_WITH = select({ + "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], + "//conditions:default": [], +}) + py_test( name = "freq_to_mel_test", srcs = ["freq_to_mel_test.py"], @@ -22,6 +27,7 @@ py_test( "nomsan", "noubsan", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, ) py_library( @@ -73,5 +79,6 @@ py_test( "nomsan", "noubsan", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, visibility = ["//visibility:public"], ) diff --git a/signal/micro/kernels/BUILD b/signal/micro/kernels/BUILD index e4fa11ebfd0..ffa4d625418 100644 --- a/signal/micro/kernels/BUILD +++ b/signal/micro/kernels/BUILD @@ -72,11 +72,17 @@ cc_library( ], ) +TARGET_COMPATIBLE_WITH = select({ + "@bazel_tools//src/conditions:windows": ["@platforms//:incompatible"], + "//conditions:default": [], +}) + cc_test( name = "fft_test", srcs = [ "fft_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":fft_flexbuffers_generated_data", ":register_signal_ops", @@ -104,6 +110,7 @@ cc_test( srcs = [ "window_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":register_signal_ops", ":window_flexbuffers_generated_data", @@ -130,6 +137,7 @@ cc_test( srcs = [ "framer_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":framer_flexbuffers_generated_data", ":register_signal_ops", @@ -156,6 +164,7 @@ cc_test( srcs = [ "overlap_add_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":overlap_add_flexbuffers_generated_data", ":register_signal_ops", @@ -182,6 +191,7 @@ cc_test( srcs = [ "delay_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":delay_flexbuffers_generated_data", "//tensorflow/lite/c:common", @@ -207,6 +217,7 @@ cc_test( srcs = [ "stacker_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":register_signal_ops", ":stacker_flexbuffers_generated_data", @@ -233,6 +244,7 @@ cc_test( srcs = [ "energy_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":energy_flexbuffers_generated_data", ":register_signal_ops", @@ -279,6 +291,7 @@ cc_test( srcs = [ "filter_bank_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":filter_bank_flexbuffers_generated_data", "//tensorflow/lite/c:common", @@ -294,6 +307,7 @@ cc_test( srcs = [ "filter_bank_log_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":filter_bank_log_flexbuffers_generated_data", "//tensorflow/lite/c:common", @@ -309,6 +323,7 @@ cc_test( srcs = [ "filter_bank_spectral_subtraction_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":filter_bank_spectral_subtraction_flexbuffers_generated_data", "//tensorflow/lite/c:common", @@ -324,6 +339,7 @@ cc_test( srcs = [ "filter_bank_square_root_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ "//tensorflow/lite/c:common", "//tensorflow/lite/micro:op_resolvers", @@ -348,6 +364,7 @@ cc_test( srcs = [ "pcan_test.cc", ], + target_compatible_with = TARGET_COMPATIBLE_WITH, deps = [ ":pcan_flexbuffers_generated_data", "//tensorflow/lite/c:common",