Skip to content

Commit

Permalink
Update README to Bzlmod usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Vertexwahn committed Jun 8, 2024
1 parent cc0de6c commit efe6d3b
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,20 @@ Bazel

To use glog within a project which uses the
`Bazel <https://bazel.build/>`__ build tool, add the following lines to
your ``WORKSPACE`` file:
your ``MODULE`` file:

.. code:: bazel
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
bazel_dep(name = "glog")
http_archive(
name = "gflags",
sha256 = "34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf",
strip_prefix = "gflags-2.2.2",
urls = ["https://github.com/gflags/gflags/archive/v2.2.2.tar.gz"],
archive_override(
module_name = "glog",
urls = "https://github.com/google/glog/archive/cc0de6c200375b33d907ee7632eee2f173b33a09.tar.gz",
strip_prefix = "glog-cc0de6c200375b33d907ee7632eee2f173b33a09", # Latest commit as of 2024-06-08.
integrity = "sha256-rUrv4EBkdc+4Wbhfxp+KoRstlj2Iw842/OpLfDq0ivg=",
)
http_archive(
name = "com_github_google_glog",
sha256 = "122fb6b712808ef43fbf80f75c52a21c9760683dae470154f02bddfc61135022",
strip_prefix = "glog-0.6.0",
urls = ["https://github.com/google/glog/archive/v0.6.0.zip"],
)
You can then add :bazel:`@com_github_google_glog//:glog` to the deps section
You can then add :bazel:`@glog//:glog` to the deps section
of a :bazel:`cc_binary` or :bazel:`cc_library` rule, and :code:`#include <glog/logging.h>`
to include it in your source code. Here’s a simple example:

Expand All @@ -117,7 +110,7 @@ to include it in your source code. Here’s a simple example:
cc_binary(
name = "main",
srcs = ["main.cc"],
deps = ["@com_github_google_glog//:glog"],
deps = ["@glog//:glog"],
)
CMake
Expand Down

0 comments on commit efe6d3b

Please sign in to comment.