Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
yukawa committed Nov 8, 2024
1 parent 9d3e823 commit c002fff
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions src/bazel/windows_sdk_rules.win32.template.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c002fff

Please sign in to comment.