
Understanding where compilers, build systems (Bazel, Unix Makefiles) and build systems generators (CMake) come in
What are the advantages of Bazel?
We are going to explore the public and private interface of libraries, exposed headers, and the layering_check option
We will see how to build .so (.dll) and .a (.lib) files using cc_library with linkstatic=True, cc_static_library and cc_shared_library
Understand the Bazel build phases: Loading, Analysis, Execution
xxHash example with Bazel's http_archive
Using the Bazel Central Registry to integrate Googletest in a Bazel project
This course is for C++ developers and students who want to learn Bazel, a powerful build system used in real-world software projects.
As software projects grow, managing dependencies, compiling code, and running tests can become increasingly complicated. A good build system helps you automate these tasks, improve build efficiency, and keep your projects organized.
Have you ever encountered Bazel at work and struggled to understand how it works? Or found yourself confused by BUILD files, dependencies, and unfamiliar commands?
Whether you're completely new to Bazel or have already used it without fully understanding what's happening behind the scenes, this course will help you understand Bazel and use it with confidence.
No previous experience with Bazel is required. Basic C++ knowledge and familiarity with the command line are recommended. Python knowledge can be helpful, but it is not required.
If you're completely new to Bazel, this course will guide you through the fundamentals. If you already have some experience, please explore the curriculum to see if there is anything new and of value for you.
Bazel is cross-platform. In this course, we'll work with:
Windows
Linux
The course includes explanations and hands-on coding examples. I strongly recommend that you try the examples yourself, experiment with them, and modify them to better understand how Bazel works.
Here's a brief overview of what you'll learn:
Getting started with Bazel
Installing Bazel on Windows and Linux
Creating and building your first C++ project
Understanding workspaces, modules, and BUILD files
Building C++ projects
Creating executables and libraries
Working with packages and dependencies
Static and shared libraries
Understanding build outputs and visibility
Managing external dependencies
Using the Bazel Central Registry (BCR)
Integrating external libraries
Working with http_archive and cc_import
Using OpenCV in a Bazel project
Automated testing
Creating tests with cc_test
Integrating Google Test
Organizing tests with test_suite
Macros and custom build rules
Understanding Starlark
Writing reusable macros
Generic rules with genrule
Creating custom build rules
Understanding Bazel's loading, analysis, and execution phases
Testing custom rules with analysis tests (Skylib)
By the end of this course, you'll have a solid understanding of how Bazel works and how to use it to build, test, and manage your own C++ projects.
Let's get started!