Conditionally use matplotlib for distance_spline_test

This lets us build and run the test on ARM

Change-Id: Ia53a5607c092df2cc3c9d9b947842af56b0401b7
diff --git a/frc971/control_loops/drivetrain/BUILD b/frc971/control_loops/drivetrain/BUILD
index 9bb335c..7e78c72 100644
--- a/frc971/control_loops/drivetrain/BUILD
+++ b/frc971/control_loops/drivetrain/BUILD
@@ -298,13 +298,24 @@
     srcs = [
         "distance_spline_test.cc",
     ],
-    restricted_to = ["//tools:k8"],
+    defines =
+        cpu_select({
+            "amd64": [
+                "SUPPORT_PLOT=1",
+            ],
+            "arm": [],
+        }),
+    linkstatic = True,
     deps = [
         ":distance_spline",
         "//aos/testing:googletest",
-        "//third_party/matplotlib-cpp",
         "@com_github_gflags_gflags//:gflags",
-    ],
+    ] + cpu_select({
+        "amd64": [
+            "//third_party/matplotlib-cpp",
+        ],
+        "arm": [],
+    }),
 )
 
 cc_library(
diff --git a/frc971/control_loops/drivetrain/distance_spline_test.cc b/frc971/control_loops/drivetrain/distance_spline_test.cc
index dd33214..86c6d8b 100644
--- a/frc971/control_loops/drivetrain/distance_spline_test.cc
+++ b/frc971/control_loops/drivetrain/distance_spline_test.cc
@@ -4,7 +4,9 @@
 
 #include "gflags/gflags.h"
 #include "gtest/gtest.h"
+#if defined(SUPPORT_PLOT)
 #include "third_party/matplotlib-cpp/matplotlibcpp.h"
+#endif
 
 DEFINE_bool(plot, false, "If true, plot");
 
@@ -72,6 +74,7 @@
     dpoint += distance_spline_.DDXY(distance) * ddistance;
   }
 
+#if defined(SUPPORT_PLOT)
   // Conditionally plot the functions and their integrals to aid debugging.
   if (FLAGS_plot) {
     matplotlibcpp::figure();
@@ -85,8 +88,13 @@
     matplotlibcpp::plot(distances_plot, idy_plot, {{"label", "idy"}});
     matplotlibcpp::legend();
 
+    matplotlibcpp::figure();
+    matplotlibcpp::plot(x_plot, y_plot, {{"label", "spline"}});
+    matplotlibcpp::legend();
+
     matplotlibcpp::show();
   }
+#endif
 }
 
 // Tests that the derivitives of xy integrate back up to the position.
@@ -126,6 +134,7 @@
     dtheta += distance_spline_.DDTheta(distance) * ddistance;
   }
 
+#if defined(SUPPORT_PLOT)
   // Conditionally plot the functions and their integrals to aid debugging.
   if (FLAGS_plot) {
     matplotlibcpp::figure();
@@ -137,6 +146,7 @@
 
     matplotlibcpp::show();
   }
+#endif
 }
 
 }  // namespace testing