Add build rules for the GSL
This provides many helpful things, such as span.
Change-Id: I4d2a88b0a7cb93fe36a98f21f4a6874e335e063e
diff --git a/third_party/GSL/tests/BUILD b/third_party/GSL/tests/BUILD
new file mode 100644
index 0000000..503a29f
--- /dev/null
+++ b/third_party/GSL/tests/BUILD
@@ -0,0 +1,65 @@
+licenses(["notice"])
+
+_copts = [
+ "-fno-strict-aliasing",
+ "-Wall",
+ "-Wcast-align",
+ "-Wconversion",
+ "-Wctor-dtor-privacy",
+ "-Werror",
+ "-Wextra",
+ "-Wno-missing-braces",
+ "-Wnon-virtual-dtor",
+ "-Wold-style-cast",
+ "-Woverloaded-virtual",
+ "-Wpedantic",
+ "-Wshadow",
+ "-Wsign-conversion",
+]
+
+[cc_test(
+ name = filename[:-5],
+ srcs = [filename],
+ copts = _copts + [
+ "-DNO_SELFTEST=true",
+ "-fexceptions",
+ "-frtti",
+ "-DGSL_THROW_ON_CONTRACT_VIOLATION",
+ ],
+ deps = [
+ ":test",
+ "//third_party/Catch2",
+ "//third_party/GSL",
+ ],
+) for filename in glob(
+ include = ["*_tests.cpp"],
+ exclude = ["no_exception*"],
+)]
+
+[cc_test(
+ name = filename[:-5],
+ srcs = [filename],
+ copts = _copts + [
+ "-DGSL_TERMINATE_ON_CONTRACT_VIOLATION",
+ ],
+ deps = [
+ ":test",
+ "//third_party/Catch2",
+ "//third_party/GSL",
+ ],
+) for filename in glob(["no_exception*_tests.cpp"])]
+
+cc_library(
+ name = "test",
+ srcs = ["test.cpp"],
+ copts = _copts + [
+ "-DNO_SELFTEST=true",
+ "-fexceptions",
+ "-frtti",
+ "-DGSL_THROW_ON_CONTRACT_VIOLATION",
+ ],
+ deps = [
+ "//third_party/Catch2",
+ "//third_party/GSL",
+ ],
+)