Added BUILD rules for blasfeo and hpipm

These are needed for the controls toolbox ct.

Change-Id: I50608f01abfdf24ad52f1dda5a4c81fd079afb16
diff --git a/third_party/blasfeo/BUILD b/third_party/blasfeo/BUILD
new file mode 100644
index 0000000..92be2d4
--- /dev/null
+++ b/third_party/blasfeo/BUILD
@@ -0,0 +1,84 @@
+licenses(["notice"])  # lgpl
+
+cc_library(
+    name = "blasfeo",
+    hdrs = [
+        "include/blasfeo_block_size.h",
+        "include/blasfeo_common.h",
+        "include/blasfeo_d_aux.h",
+        "include/blasfeo_d_kernel.h",
+        "include/blasfeo_s_aux.h",
+        "include/blasfeo_s_kernel.h",
+        "include/blasfeo_target.h",
+        "include/blasfeo_d_blas.h",
+        "include/blasfeo_m_aux.h",
+        "include/blasfeo_s_blas.h",
+    ],
+    includes = [
+        "include",
+    ],
+    srcs = [
+        # ext
+        "auxiliary/d_aux_lib4.c",
+        "auxiliary/avx/kernel_dgecp_lib4.c",
+        "auxiliary/avx/kernel_dgetr_lib4.c",
+        "auxiliary/s_aux_lib8.c",
+        "auxiliary/m_aux_lib48.c",
+        # kernels
+        "kernel/avx/kernel_dgemm_8x4_lib4.S",
+        "kernel/avx/kernel_dgemm_4x4_lib4.S",
+        "kernel/avx/kernel_dgemm_diag_lib4.c",
+        "kernel/avx/kernel_dgemv_12_lib4.S",
+        "kernel/avx/kernel_dgemv_8_lib4.S",
+        "kernel/avx/kernel_dgemv_4_lib4.S",
+        "kernel/avx/kernel_dsymv_6_lib4.S",
+        "kernel/avx/kernel_dgetrf_pivot_4_lib4.c",
+        "kernel/avx/kernel_dgeqrf_4_lib4.c",
+        "kernel/avx/kernel_dgebp_lib4.S",
+        "kernel/avx/kernel_sgemm_16x4_lib8.S",
+        "kernel/avx/kernel_sgemm_8x8_lib8.S",
+        "kernel/avx/kernel_sgemm_8x4_lib8.S",
+        "kernel/avx/kernel_sgecp_lib8.S",
+        "kernel/avx/kernel_sgemm_diag_lib8.c",
+        "kernel/avx/kernel_sgetr_lib8.S",
+        "kernel/avx/kernel_sgead_lib8.S",
+        "kernel/avx/kernel_sgesc_lib8.S",
+        "kernel/avx/kernel_sgemv_8_lib8.S",
+        "kernel/avx/kernel_sgemv_4_lib8.S",
+        # blas
+        "blas/d_blas1_lib4.c",
+        "blas/d_blas2_lib4.c",
+        "blas/d_blas2_diag_lib.c",
+        "blas/d_blas3_lib4.c",
+        "blas/d_blas3_diag_lib4.c",
+        "blas/d_lapack_lib4.c",
+        "blas/s_blas1_lib8.c",
+        "blas/s_blas2_lib8.c",
+        "blas/s_blas2_diag_lib.c",
+        "blas/s_blas3_lib8.c",
+        "blas/s_blas3_diag_lib8.c",
+        "blas/s_lapack_lib8.c",
+        # ext_dep
+        "auxiliary/d_aux_ext_dep_lib.c",
+        "auxiliary/s_aux_ext_dep_lib.c",
+        "auxiliary/v_aux_ext_dep_lib.c",
+        "auxiliary/i_aux_ext_dep_lib.c",
+    ],
+    copts = [
+        "-mavx",
+        "-DTARGET_X64_INTEL_SANDY_BRIDGE",
+        "-DLA_HIGH_PERFORMANCE",
+        "-DOS_LINUX",
+        "-DEXT_DEP",
+        "-Wno-unused-variable",
+        "-Wno-uninitialized",
+        "-Wno-unused-parameter",
+        "-Wno-unused-label",
+        "-Wno-cast-align",
+    ],
+    textual_hdrs = [
+        "blas/x_blas2_diag_lib.c",
+    ],
+    visibility = ["//visibility:public"],
+    restricted_to = ["//tools:k8"],
+)
diff --git a/third_party/blasfeo/include/blasfeo_target.h b/third_party/blasfeo/include/blasfeo_target.h
new file mode 100644
index 0000000..f0022ea
--- /dev/null
+++ b/third_party/blasfeo/include/blasfeo_target.h
@@ -0,0 +1,9 @@
+#ifndef TARGET_X64_INTEL_HASWELL
+#define TARGET_X64_INTEL_HASWELL
+#endif
+#ifndef LA_HIGH_PERFORMANCE
+#define LA_HIGH_PERFORMANCE
+#endif
+#ifndef EXT_DEP
+#define EXT_DEP
+#endif