using by bazel
To use gflags within a project which uses Bazel as build tool, add the following lines to your WORKSPACE file (see also Bazel documentation of git_repository):
git_repository(
name = "com_github_gflags_gflags",
remote = "https://github.com/gflags/gflags.git",
tag = "v2.2.2"
)
You can then add @com_github_gflags_gflags//:gflags
to the deps section of a cc_binary or cc_library rule, and #include "gflags/gflags.h"
to include it in your source code. This uses the shared gflags library with multi-threading enabled. In order to use the single-threaded shared gflags library, use the dependency @com_github_gflags_gflags//:gflags_nothreads
instead.
For example, see the following BUILD rule of the gflags/example project:
cc_binary(
name = "foo",
srcs = ["main.cc"],
deps = ["@com_github_gflags_gflags//:gflags"],
)
code example
Here are the types supported:
- DEFINE_bool: boolean
- DEFINE_int32: 32-bit integer
- DEFINE_int64: 64-bit integer
- DEFINE_uint64: unsigned 64-bit integer
- DEFINE_double: double
- DEFINE_string: C++ string
|
|