@@ -5,7 +5,7 @@ build systems for opentelemetry-cpp.
55
66## Build instructions using CMake
77
8- ### Prerequisites
8+ ### Prerequisites for CMake
99
1010- A supported platform (e.g. Windows, macOS or Linux). Refer to [ Platforms
1111 Supported] ( ./README.md#supported-development-platforms ) for more information.
@@ -133,4 +133,57 @@ target_link_libraries(foo PRIVATE ${OPENTELEMETRY_CPP_LIBRARIES})
133133
134134## Build instructions using Bazel
135135
136- TBD
136+ ### Prerequisites for Bazel
137+
138+ - A supported platform (e.g. Windows, macOS or Linux).
139+ Refer to [ Platforms Supported] ( ./README.md#supported-development-platforms )
140+ for more information.
141+ - A compatible C++ compiler supporting at least C++11.
142+ Major compilers are supported.
143+ Refer to [ Supported Compilers] ( ./README.md#supported-c-versions ) for more information.
144+ - [ Git] ( https://git-scm.com/ ) for fetching opentelemetry-cpp source code from repository.
145+ To install Git, consult the [ Set up Git] ( https://help.github.com/articles/set-up-git/ )
146+ guide on GitHub.
147+ - [ Bazel] ( https://www.bazel.build/ ) for building opentelemetry-cpp API,
148+ SDK with their unittests. We use 3.7.2 in our build system.
149+
150+ To install Bazel, consult the [ Installing Bazel] ( https://docs.bazel.build/versions/3.7.0/install.html ) guide.
151+
152+ ### Building as Standalone Bazel Project
153+
154+ 1 . Getting the opentelementry-cpp source:
155+
156+ ``` console
157+ # Change to the directory where you want to create the code repository
158+ $ cd ~
159+ $ mkdir source && cd source
160+ $ git clone https://github.com/open-telemetry/opentelemetry-cpp
161+ Cloning into 'opentelemetry-cpp'...
162+ ...
163+ Resolving deltas: 100% (3225/3225), done.
164+ $
165+ ```
166+
167+ 2 . Download the dependencies and build the source code:
168+
169+ ``` console
170+ $ bazel build //...
171+ bazel build -- //... -//exporters/otlp/... -//exporters/prometheus/...
172+ Extracting Bazel installation...
173+ Starting local Bazel server and connecting to it...
174+ INFO: Analyzed 121 targets (98 packages loaded, 3815 targets configured).
175+ INFO: Found 121 targets...
176+ INFO: From Compiling sdk/src/trace/tracer_context.cc:
177+ ...
178+
179+ ```
180+
181+ 3 . Once Bazel tests are built, run them with ` bazel test //... ` command
182+
183+ ``` console
184+ $ bazel test //...
185+ ..
186+ $
187+ ```
188+
189+ 4 . The build artifacts will be located under ` bazel-bin `
0 commit comments