Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bazel: Define a minimal Bazel module #269

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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"],
)
11 changes: 11 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -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")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with bazel, does this specify 1.3.1 and only 1.3.1 or the minimum version?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If libspng is the only user of zlib in a bazel workspace, then it would mean 1.3.1 exactly.
If there is another bazel_dep with, say, zlib 1.3.2 in its dependencies, then

Full details: