Skip to content

Commit

Permalink
pw_toolchain_bazel: Support Windows in toolchain template build files
Browse files Browse the repository at this point in the history
Changes toolchain template repositories to pick up *.exe tools when the
exec platform is Windows.

Change-Id: Ife629a12deadcc80c94428549fd7dd6f5e32904d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/194591
Reviewed-by: Anthony DiGirolamo <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Presubmit-Verified: CQ Bot Account <[email protected]>
Pigweed-Auto-Submit: Armando Montanez <[email protected]>
  • Loading branch information
armandomontanez authored and CQ Bot Account committed Feb 29, 2024
1 parent 6bbe359 commit f25eb6a
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 19 deletions.
51 changes: 40 additions & 11 deletions pw_toolchain_bazel/build_external/gcc_arm_none_eabi.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ pw_cc_action_files(

pw_cc_tool(
name = "arm-none-eabi-ar_tool",
tool = "//:bin/arm-none-eabi-ar",
tool = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-ar.exe",
"//conditions:default": "//:bin/arm-none-eabi-ar",
}),
)

pw_cc_action_config(
Expand All @@ -56,7 +59,10 @@ pw_cc_action_config(

pw_cc_tool(
name = "arm-none-eabi-g++_tool",
tool = "//:bin/arm-none-eabi-g++",
tool = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-g++.exe",
"//conditions:default": "//:bin/arm-none-eabi-g++",
}),
additional_files = glob([
"**/*.spec",
"**/*.specs",
Expand All @@ -75,17 +81,25 @@ pw_cc_action_config(

pw_cc_tool(
name = "arm-none-eabi-gcc_tool",
tool = "//:bin/arm-none-eabi-gcc",
tool = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-gcc.exe",
"//conditions:default": "//:bin/arm-none-eabi-gcc",
}),
additional_files = glob([
"**/*.spec",
"**/*.specs",
"arm-none-eabi/include/**",
"lib/gcc/arm-none-eabi/*/include/**",
"lib/gcc/arm-none-eabi/*/include-fixed/**",
"libexec/**",
]) + [
"arm-none-eabi/bin/as", # The assembler needs to be explicilty added.
],
]) +
# The assembler needs to be explicilty added. Note that the path is
# intentionally different here as `as` is called from arm-none-eabi-gcc.
# `arm-none-eabi-as` will not suffice for this context.
select({
"@platforms//os:windows": ["//:arm-none-eabi/bin/as.exe"],
"//conditions:default": ["//:arm-none-eabi/bin/as"],
}),
)

pw_cc_action_config(
Expand All @@ -101,7 +115,10 @@ pw_cc_action_config(
# tool differently to specify a different set of additional files.
pw_cc_tool(
name = "arm-none-eabi-ld_tool",
tool = "//:bin/arm-none-eabi-g++",
tool = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-g++.exe",
"//conditions:default": "//:bin/arm-none-eabi-g++",
}),
additional_files = glob([
"**/*.a",
"**/*.ld",
Expand All @@ -121,7 +138,10 @@ pw_cc_action_config(

pw_cc_tool(
name = "arm-none-eabi-gcov_tool",
tool = "//:bin/arm-none-eabi-gcov",
tool = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-gcov.exe",
"//conditions:default": "//:bin/arm-none-eabi-gcov",
}),
)

pw_cc_action_config(
Expand All @@ -132,7 +152,10 @@ pw_cc_action_config(

pw_cc_tool(
name = "arm-none-eabi-objcopy_tool",
tool = "//:bin/arm-none-eabi-objcopy",
tool = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-objcopy.exe",
"//conditions:default": "//:bin/arm-none-eabi-objcopy",
}),
)

pw_cc_action_config(
Expand All @@ -143,7 +166,10 @@ pw_cc_action_config(

pw_cc_tool(
name = "arm-none-eabi-objdump_tool",
tool = "//:bin/arm-none-eabi-objdump",
tool = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-objdump.exe",
"//conditions:default": "//:bin/arm-none-eabi-objdump",
}),
)

pw_cc_action_config(
Expand All @@ -154,7 +180,10 @@ pw_cc_action_config(

pw_cc_tool(
name = "arm-none-eabi-strip_tool",
tool = "//:bin/arm-none-eabi-strip",
tool = select({
"@platforms//os:windows": "//:bin/arm-none-eabi-strip.exe",
"//conditions:default": "//:bin/arm-none-eabi-strip",
}),
)

pw_cc_action_config(
Expand Down
40 changes: 32 additions & 8 deletions pw_toolchain_bazel/build_external/llvm_clang.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ filegroup(

pw_cc_tool(
name = "ar_tool",
tool = "//:bin/llvm-ar",
tool = select({
"@platforms//os:windows": "//:bin/llvm-ar.exe",
"//conditions:default": "//:bin/llvm-ar",
}),
)

pw_cc_tool(
Expand All @@ -61,7 +64,10 @@ pw_cc_action_config(

pw_cc_tool(
name = "clang++_tool",
tool = "//:bin/clang++",
tool = select({
"@platforms//os:windows": "//:bin/clang++.exe",
"//conditions:default": "//:bin/clang++",
}),
additional_files = glob([
"include/**",
"lib/clang/**/include/**",
Expand All @@ -76,7 +82,10 @@ pw_cc_action_config(

pw_cc_tool(
name = "clang_tool",
tool = "//:bin/clang",
tool = select({
"@platforms//os:windows": "//:bin/clang.exe",
"//conditions:default": "//:bin/clang",
}),
additional_files = glob([
"include/**",
"lib/clang/**/include/**",
Expand All @@ -96,7 +105,10 @@ pw_cc_action_config(
# tool differently to specify a different set of additional files.
pw_cc_tool(
name = "lld_tool",
tool = "//:bin/clang++",
tool = select({
"@platforms//os:windows": "//:bin/clang++.exe",
"//conditions:default": "//:bin/clang++",
}),
additional_files = glob([
"lib/**/*.a",
"lib/**/*.so*",
Expand All @@ -111,7 +123,10 @@ pw_cc_action_config(

pw_cc_tool(
name = "llvm_cov_tool",
tool = "//:bin/llvm-cov",
tool = select({
"@platforms//os:windows": "//:bin/llvm-cov.exe",
"//conditions:default": "//:bin/llvm-cov",
}),
)

pw_cc_action_config(
Expand All @@ -122,7 +137,10 @@ pw_cc_action_config(

pw_cc_tool(
name = "llvm_objcopy_tool",
tool = "//:bin/llvm-objcopy",
tool = select({
"@platforms//os:windows": "//:bin/llvm-objcopy.exe",
"//conditions:default": "//:bin/llvm-objcopy",
}),
)

pw_cc_action_config(
Expand All @@ -133,7 +151,10 @@ pw_cc_action_config(

pw_cc_tool(
name = "llvm_objdump_tool",
tool = "//:bin/llvm-objdump",
tool = select({
"@platforms//os:windows": "//:bin/llvm-objdump.exe",
"//conditions:default": "//:bin/llvm-objdump",
}),
)

pw_cc_action_config(
Expand All @@ -144,7 +165,10 @@ pw_cc_action_config(

pw_cc_tool(
name = "llvm_strip_tool",
tool = "//:bin/llvm-strip",
tool = select({
"@platforms//os:windows": "//:bin/llvm-strip.exe",
"//conditions:default": "//:bin/llvm-strip",
}),
)

pw_cc_action_config(
Expand Down

0 comments on commit f25eb6a

Please sign in to comment.