From 6905fa768e38705d6ba0a5c30ac8e6de9704c62f Mon Sep 17 00:00:00 2001 From: Ivan Egorov Date: Sat, 15 Jun 2024 13:23:30 +0000 Subject: [PATCH] Bazel: Define a minimal Bazel module This defines the very minimal integration with Bazel build system. The definitions follow the spirit of README.md in that the build rules package the library such that it can be included with ```c ``` --- BUILD.bazel | 17 +++++++++++++++++ MODULE.bazel | 11 +++++++++++ 2 files changed, 28 insertions(+) create mode 100644 BUILD.bazel create mode 100644 MODULE.bazel diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..6879fb3 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,17 @@ +# This rule produces lib${name}.so and lib${name}.a +cc_library( + name = "spng", + srcs = ["spng/spng.c"], + hdrs = ["spng/spng.h"], + includes = ["spng"], + visibility = ["//visibility:public"], + deps = ["@zlib"], +) + +# This alias allows one to simply use "@libspng" as dependency, +# instead of "@libsnpg//:spng". +alias( + name = "libspng", + actual = ":spng", + visibility = ["//visibility:public"], +) diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000..d468c3c --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,11 @@ +""" +PNG decoding and encoding library +""" + +module( + name = "libspng", + version = "0.7.4", + compatibility_level = 1, +) + +bazel_dep(name = "zlib", version = "1.3.1")