basic bazel project structure
Express skcms' project structure in Bazel.
bazel build ... and bazel test ... work for me on WSL2 Ubuntu 20.04.
Everything was reassuringly sandboxed by default:
- tests binary needed our profiles/ directory declared as
a data dependency when run under bazel test
- visibility all defaulted to something locked down,
I think "visible to targets declared in this BUILD file"
- (not in this CL) to build with ccache, I had to set in .bazelrc
`build --sandbox_writable_path=/home/mtklein/.ccache`
buildifier seems to work ok for formatting.
(go get github.com/bazelbuild/buildtools/buildifier)
Change-Id: I70d0de71ef91dbfd8bb2e3d0700c2df125cb4f7f
Reviewed-on: https://skia-review.googlesource.com/c/skcms/+/304849
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
diff --git a/.gitignore b/.gitignore
index cfe87f4..d0c0792 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
out
*.swp
+bazel-*
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..0f8b948
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,45 @@
+cc_library(
+ name = "skcms",
+ srcs = [
+ "skcms.cc",
+ "skcms_internal.h",
+ "src/Transform_inl.h",
+ ],
+ hdrs = ["skcms.h"],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "test_only",
+ testonly = True,
+ srcs = ["test_only.c"],
+ hdrs = ["test_only.h"],
+ deps = [":skcms"],
+)
+
+cc_test(
+ name = "tests",
+ srcs = ["tests.c"],
+ data = glob(["profiles/**"]),
+ deps = [
+ ":skcms",
+ ":test_only",
+ ],
+)
+
+cc_binary(
+ name = "iccdump",
+ testonly = True,
+ srcs = ["iccdump.c"],
+ linkopts = ["-ldl"],
+ deps = [
+ ":skcms",
+ ":test_only",
+ ],
+)
+
+cc_binary(
+ name = "bench",
+ srcs = ["bench.c"],
+ deps = [":skcms"],
+)
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/WORKSPACE
diff --git a/fuzz/BUILD b/fuzz/BUILD
new file mode 100644
index 0000000..60b8f84
--- /dev/null
+++ b/fuzz/BUILD
@@ -0,0 +1,31 @@
+cc_library(
+ name = "fuzz_main",
+ srcs = ["fuzz_main.c"],
+)
+
+cc_binary(
+ name = "fuzz_iccprofile_atf",
+ srcs = ["fuzz_iccprofile_atf.c"],
+ deps = [
+ ":fuzz_main",
+ "//:skcms",
+ ],
+)
+
+cc_binary(
+ name = "fuzz_iccprofile_info",
+ srcs = ["fuzz_iccprofile_info.c"],
+ deps = [
+ ":fuzz_main",
+ "//:skcms",
+ ],
+)
+
+cc_binary(
+ name = "fuzz_iccprofile_transform",
+ srcs = ["fuzz_iccprofile_transform.c"],
+ deps = [
+ ":fuzz_main",
+ "//:skcms",
+ ],
+)