Skip to content

Commit

Permalink
Trying more stuff out
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreiniger committed Jan 1, 2025
1 parent 22f9e2d commit 002bb32
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/defines_helper.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __helper(is_roborio, is_bullseye, is_raspi):

def defines_helper():
output = {
"@rules_bzlmodrio_toolchains//constraints/is_bullseye32:bullseye32": __helper(is_roborio = False, is_bullseye = True, is_raspi = False),
"@rules_bzlmodrio_toolchains//constraints/is_raspibookworm32:raspibookworm32": __helper(is_roborio = False, is_bullseye = False, is_raspi = True),
"@rules_bzlmodrio_toolchains//constraints/is_bullseye64:bullseye64": __helper(is_roborio = False, is_bullseye = True, is_raspi = False),
"@rules_bzlmodrio_toolchains//constraints/is_roborio:roborio": __helper(is_roborio = True, is_bullseye = False, is_raspi = False),
"//conditions:default": __helper(is_roborio = False, is_bullseye = False, is_raspi = False),
Expand Down
6 changes: 6 additions & 0 deletions toolchains/configure_cross_compiler.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def configure_cross_compiler_impl(repository_ctx):
"{sysroot}": repository_ctx.attr.sysroot_subfolder,
"{tool_platform_suffix}": "",
"{wrapper_extension}": "",
"{target_cpu}": repository_ctx.attr.target_cpu,
"{compiler_version}": repository_ctx.attr.compiler_version,
"{target_system_name}": repository_ctx.attr.target_system_name,
}

if repository_ctx.os.name.startswith("windows"):
Expand Down Expand Up @@ -81,5 +84,8 @@ configure_cross_compiler = repository_rule(
"repo_shortname": attr.string(mandatory = True),
"sysroot_include_folder": attr.string(mandatory = True),
"sysroot_subfolder": attr.string(mandatory = True),
"target_cpu": attr.string(mandatory = True),
"compiler_version": attr.string(mandatory = True),
"target_system_name": attr.string(mandatory = True),
},
)
5 changes: 4 additions & 1 deletion toolchains/cross_compiler/BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ cc_toolchain_config(
name = cc_toolchain_config_name,
toolchain_identifier = toolchain_name,
wrapper_extension = "{wrapper_extension}",
cxx_builtin_include_directories=cxx_builtin_include_directories
cxx_builtin_include_directories=cxx_builtin_include_directories,
target_cpu = "{target_cpu}",
compiler_version = "{compiler_version}",
target_system_name = "{target_system_name}",
)

filegroup(
Expand Down
14 changes: 10 additions & 4 deletions toolchains/cross_compiler/cc-toolchain-config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -167,17 +167,20 @@ def _impl(ctx):
archive_param_file_feature,
]

print(ctx.attr.target_cpu)
print(ctx.attr.compiler_version)
print(ctx.attr.target_system_name)
return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
features = features,
toolchain_identifier = ctx.attr.toolchain_identifier,
host_system_name = "local",
target_system_name = "arm-frc2023-linux-gnueabi",
target_cpu = "armv7",
target_system_name = ctx.attr.target_system_name,
target_cpu = ctx.attr.target_cpu,
target_libc = "glibc-2.24",
cc_target_os = "linux",
compiler = "gcc-12.1.0",
abi_version = "gcc-12.1.0",
compiler = "gcc-" + ctx.attr.compiler_version,
abi_version = "gcc-" + ctx.attr.compiler_version,
abi_libc_version = "glibc-2.24",
tool_paths = tool_paths,
cxx_builtin_include_directories = cxx_builtin_include_directories,
Expand All @@ -189,6 +192,9 @@ cc_toolchain_config = rule(
"cxx_builtin_include_directories": attr.string_list(mandatory = True),
"toolchain_identifier": attr.string(mandatory = True),
"wrapper_extension": attr.string(mandatory = True),
"target_cpu": attr.string(mandatory = True),
"compiler_version": attr.string(mandatory = True),
"target_system_name": attr.string(mandatory = True),
},
provides = [CcToolchainConfigInfo],
implementation = _impl,
Expand Down
21 changes: 21 additions & 0 deletions toolchains/load_toolchains.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ def load_toolchains():
bin_prefix = "armv7-bookworm-linux-gnueabihf-",
sysroot_subfolder = "bookworm/arm-linux-gnueabihf/sysroot",
cxx_version = "12",
compiler_version = "12.1.0",
sysroot_include_folder = "arm-linux-gnueabihf",
repo_shortname = "bookworm_32",
target_cpu = "armv7",
target_system_name = "arm-frc2023-linux-gnueabi",
)
configure_cross_compiler(
name = "local_bookworm_64",
Expand All @@ -18,8 +21,11 @@ def load_toolchains():
bin_prefix = "aarch64-bookworm-linux-gnu-",
sysroot_subfolder = "bookworm/aarch64-linux-gnu/sysroot",
cxx_version = "12",
compiler_version = "12.1.0",
sysroot_include_folder = "aarch64-linux-gnu",
repo_shortname = "bookworm_64",
target_cpu = "armv7",
target_system_name = "arm-frc2023-linux-gnueabi",
)
configure_cross_compiler(
name = "local_bullseye_32",
Expand All @@ -28,8 +34,11 @@ def load_toolchains():
bin_prefix = "armv7-bullseye-linux-gnueabihf-",
sysroot_subfolder = "bullseye/arm-linux-gnueabihf/sysroot",
cxx_version = "10",
compiler_version = "12.1.0",
sysroot_include_folder = "arm-linux-gnueabihf",
repo_shortname = "bullseye_32",
target_cpu = "armv7",
target_system_name = "arm-frc2023-linux-gnueabi",
)
configure_cross_compiler(
name = "local_bullseye_64",
Expand All @@ -38,8 +47,11 @@ def load_toolchains():
bin_prefix = "aarch64-bullseye-linux-gnu-",
sysroot_subfolder = "bullseye/aarch64-linux-gnu/sysroot",
cxx_version = "10",
compiler_version = "12.1.0",
sysroot_include_folder = "aarch64-linux-gnu",
repo_shortname = "bullseye_64",
target_cpu = "armv7",
target_system_name = "arm-frc2023-linux-gnueabi",
)
configure_cross_compiler(
name = "local_raspi_bookworm_32",
Expand All @@ -48,8 +60,11 @@ def load_toolchains():
bin_prefix = "armv6-bookworm-linux-gnueabihf-",
sysroot_subfolder = "raspi-bookworm/arm-linux-gnueabihf/sysroot",
cxx_version = "12",
compiler_version = "12.2.0",
sysroot_include_folder = "arm-linux-gnueabihf",
repo_shortname = "raspi_bookworm_32",
target_cpu = "armv6",
target_system_name = "arm-frc2023-linux-gnueabi",
)
configure_cross_compiler(
name = "local_raspi_bullseye_32",
Expand All @@ -58,8 +73,11 @@ def load_toolchains():
bin_prefix = "armv6-bullseye-linux-gnueabihf-",
sysroot_subfolder = "raspi-bullseye/arm-linux-gnueabihf/sysroot",
cxx_version = "10",
compiler_version = "12.1.0",
sysroot_include_folder = "arm-linux-gnueabihf",
repo_shortname = "raspi_bullseye_32",
target_cpu = "armv7",
target_system_name = "arm-frc2023-linux-gnueabi",
)
configure_cross_compiler(
name = "local_roborio",
Expand All @@ -68,6 +86,9 @@ def load_toolchains():
bin_prefix = "arm-frc2025-linux-gnueabi-",
sysroot_subfolder = "roborio-academic/arm-nilrt-linux-gnueabi/sysroot",
cxx_version = "12",
compiler_version = "12.1.0",
sysroot_include_folder = "arm-nilrt-linux-gnueabi",
repo_shortname = "roborio",
target_cpu = "armv7",
target_system_name = "arm-frc2023-linux-gnueabi",
)

0 comments on commit 002bb32

Please sign in to comment.