Make optional build

Change-Id: I57b2f5de0e922c876166443899c355366720a5b8
diff --git a/third_party/optional/BUILD b/third_party/optional/BUILD
new file mode 100644
index 0000000..3599d61
--- /dev/null
+++ b/third_party/optional/BUILD
@@ -0,0 +1,47 @@
+licenses(["notice"])
+
+load("//tools:environments.bzl", "mcu_cpus")
+
+cc_library(
+    name = "optional",
+    hdrs = [
+        "tl/optional.hpp",
+    ],
+    compatible_with = mcu_cpus,
+    includes = ["."],
+    visibility = ["//visibility:public"],
+)
+
+cc_library(
+    name = "catch",
+    hdrs = [
+        "tests/catch.hpp",
+    ],
+)
+
+# Create a small wrapper because the tests want to #include "optional.hpp"
+# directly.
+cc_library(
+    name = "optional_test_wrapper",
+    includes = [
+        "./tl/",
+    ],
+    deps = [
+        ":optional",
+    ],
+)
+
+cc_test(
+    name = "optional_test",
+    srcs = glob([
+        "tests/*.cpp",
+    ]),
+    copts = [
+        "-fexceptions",
+        "-Wno-unused-parameter",
+    ],
+    deps = [
+        ":catch",
+        ":optional_test_wrapper",
+    ],
+)