From c002fff3413d92f47a8df95612e16eb810209955 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Fri, 8 Nov 2024 13:48:01 -0800 Subject: [PATCH] WIP --- .../windows_sdk_rules.win32.template.bzl | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/bazel/windows_sdk_rules.win32.template.bzl b/src/bazel/windows_sdk_rules.win32.template.bzl index b2015613e..090bc85d8 100644 --- a/src/bazel/windows_sdk_rules.win32.template.bzl +++ b/src/bazel/windows_sdk_rules.win32.template.bzl @@ -161,12 +161,38 @@ _win32_res_rule = rule( ) def windows_resource(name, **kwargs): + + # Put {name} in the prefix to avoid name conflict. + name_prefix = name + "_cpu_" + + # Query "cpu" command line option as Windows builds are not yet migrated to + # platform concept. + # See https://github.com/google/mozc/issues/... for details. + + native.config_setting( + name = name_prefix + "arm64_windows", + values = {"cpu": "arm64_windows"}, + visibility = ["//visibility:private"], + ) + + native.config_setting( + name = name_prefix + "x64_windows", + values = {"cpu": "x64_windows"}, + visibility = ["//visibility:private"], + ) + + native.config_setting( + name = name_prefix + "x86_windows", + values = {"cpu": "x64_32_windows"}, + visibility = ["//visibility:private"], + ) + _win32_res_rule( name = name, arch_defines = select({ - "@platforms//cpu:arm64": ["_ARM64_", "_WIN64"], - "@platforms//cpu:x86_64": ["_AMD64_", "_WIN64"], - "@platforms//cpu:x86_32": ["_X86_"], + ":" + name_prefix + "arm64_windows": ["_ARM64_", "_WIN64"], + ":" + name_prefix + "x64_windows": ["_AMD64_", "_WIN64"], + ":" + name_prefix + "x86_windows": ["_X86_"], "//conditions:default": [""], }), **kwargs