Merge "Add ctre support for arm64"
diff --git a/WORKSPACE b/WORKSPACE
index 2371a75..99b76a7 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -180,6 +180,10 @@
patchelf_debs = "files",
)
load(
+ "//debian:phoenix6.bzl",
+ phoenix6_debs = "files",
+)
+load(
"//debian:postgresql_amd64.bzl",
postgresql_amd64_debs = "files",
)
@@ -239,6 +243,8 @@
generate_repositories_for_debs(clang_amd64_debs)
+generate_repositories_for_debs(phoenix6_debs)
+
local_repository(
name = "com_grail_bazel_toolchain",
path = "third_party/bazel-toolchain",
@@ -857,6 +863,49 @@
)
http_archive(
+ name = "ctre_phoenix6_arm64",
+ build_file_content = """
+filegroup(
+ name = 'shared_libraries',
+ srcs = [
+ 'usr/lib/phoenix6/libCTRE_PhoenixTools.so',
+ 'usr/lib/phoenix6/libCTRE_Phoenix6.so',
+ ],
+ visibility = ['//visibility:public'],
+ target_compatible_with = ['@platforms//cpu:arm64'],
+)
+
+# TODO(max): Use cc_import once they add a defines property.
+# See: https://github.com/bazelbuild/bazel/issues/19753
+cc_library(
+ name = "shared_libraries_lib",
+ visibility = ['//visibility:public'],
+ srcs = [
+ 'usr/lib/phoenix6/libCTRE_PhoenixTools.so',
+ 'usr/lib/phoenix6/libCTRE_Phoenix6.so',
+ ],
+ target_compatible_with = ['@platforms//cpu:arm64'],
+)
+
+cc_library(
+ name = 'headers',
+ visibility = ['//visibility:public'],
+ hdrs = glob(['usr/include/phoenix6/**/*.hpp', 'usr/include/phoenix6/**/*.h']),
+ includes = ["usr/include/phoenix6/"],
+ target_compatible_with = ['@platforms//cpu:arm64'],
+ defines = [
+ "UNIT_LIB_DISABLE_FMT",
+ "UNIT_LIB_ENABLE_IOSTREAM"
+ ],
+)
+""",
+ sha256 = "635b19f019d1283749fb23a95ad9e13ddd9d5013cff4c838303d898e7d9556bd",
+ urls = [
+ "https://software.frc971.org/Build-Dependencies/phoenix6_24.2.0_5.4.2024.tar.gz",
+ ],
+)
+
+http_archive(
name = "aspect_rules_js",
patch_args = [
"-p1",
diff --git a/debian/BUILD b/debian/BUILD
index 3aa05a3..80e1da1 100644
--- a/debian/BUILD
+++ b/debian/BUILD
@@ -60,6 +60,10 @@
patchelf_debs = "files",
)
load(
+ ":phoenix6.bzl",
+ phoenix6_debs = "files",
+)
+load(
":postgresql_amd64.bzl",
postgresql_amd64_debs = "files",
)
@@ -255,6 +259,12 @@
)
generate_deb_tarball(
+ name = "phoenix6",
+ files = phoenix6_debs,
+ target_compatible_with = ["@platforms//os:linux"],
+)
+
+generate_deb_tarball(
name = "apache2",
files = apache2_debs,
target_compatible_with = ["@platforms//os:linux"],
diff --git a/debian/phoenix6.bzl b/debian/phoenix6.bzl
new file mode 100644
index 0000000..7e267e1
--- /dev/null
+++ b/debian/phoenix6.bzl
@@ -0,0 +1,4 @@
+files = {
+ "can-utils_2020.11.0-1_arm64.deb": "f54269ea69e70dfecaf7f32fcaff375c2ce44918b7eb6f3ce37f05ef725525f8",
+ "phoenix6_24.2.0_arm64.deb": "9c70f5bfadd878eb9aa323241eee343dc943c8693f321790f0756dbcb314471f",
+}
diff --git a/frc971/wpilib/BUILD b/frc971/wpilib/BUILD
index be544ca..89bdcbf 100644
--- a/frc971/wpilib/BUILD
+++ b/frc971/wpilib/BUILD
@@ -499,16 +499,13 @@
hdrs = [
"talonfx.h",
],
- target_compatible_with = ["//tools/platforms/hardware:roborio"],
deps = [
"//aos:init",
"//aos:math",
"//aos/events:shm_event_loop",
"//aos/logging",
"//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
- "//third_party:phoenix",
"//third_party:phoenix6",
- "//third_party:wpilib",
"@com_github_google_glog//:glog",
],
)
diff --git a/third_party/BUILD b/third_party/BUILD
index 3a6284d..b017a18 100644
--- a/third_party/BUILD
+++ b/third_party/BUILD
@@ -43,14 +43,21 @@
"-Wl,-rpath",
"-Wl,.",
],
- target_compatible_with = ["//tools/platforms/hardware:roborio"],
visibility = ["//visibility:public"],
- deps = [
- "@ctre_phoenix6_api_cpp_athena//:api-cpp",
- "@ctre_phoenix6_api_cpp_headers//:api-cpp",
- "@ctre_phoenix6_tools_athena//:tools",
- "@ctre_phoenix6_tools_headers//:tools",
- ],
+ deps = select({
+ "//tools/platforms/hardware:roborio": [
+ "@ctre_phoenix6_api_cpp_headers//:api-cpp",
+ "@ctre_phoenix6_api_cpp_athena//:api-cpp",
+ "@ctre_phoenix6_tools_athena//:tools",
+ "@ctre_phoenix6_tools_headers//:tools",
+ "//third_party:wpilib"
+ ],
+ "@platforms//cpu:arm64": [
+ "@ctre_phoenix6_arm64//:headers",
+ "@ctre_phoenix6_arm64//:shared_libraries_lib",
+ ],
+ "//conditions:default": [":unavailable"],
+ }),
)
cc_library(