This repo is a simple demo for teaching how to use Bazel for C++ projects.
Please refer to the examples folder:
- example1: A single-file C++ program
- example2: Separating the main.cc and lib files
- example3: Using multiple libs
|
|
Running Example 1:
bazel run examples/example1:example1Check All dependencies of Example 1:
bazel query --noimplicit_deps \
"deps(//examples/example1:example1)" \
--output graph | dot -Tsvg > output.svgRunning Example 2:
bazel run examples/example2:example2Check All dependencies of Example 2:
bazel query --noimplicit_deps \
"deps(//examples/example2:example2)" \
--output graph | dot -Tsvg > output.svgRunning Example 3:
bazel run examples/example3:example3Check all dependencies of Example 3:
bazel query --noimplicit_deps \
"deps(//examples/example3:example3)" \
--output graph | dot -Tsvg > output.svgCheck all paths from lib1 to example3:
bazel query \
"allpaths(//examples/example3:example3, //examples/example3/lib1:lib1)" \
--output graph | dot -Tsvg > output.svg