Debian Codegraph @

bazel/external/README.md

raw
1 This folder is where we put `BUILD.bazel` files for external (e.g. third party) dependencies.
2
3 If a dependency supports Bazel, we should use those rules, but if the dependency does not, we
4 need to create our own rules in a subdirectory.
5
6 We generally compile third_party deps from source. If we do, we clone the repository and use
7 the given BUILD.bazel file to build it. This is specified in the `WORKSPACE.bazel` (e.g.
8 `new_local_repository` or `new_git_repository`) and we refer to those targets using labels like
9 `@freetype`, or `@libpng`.
10
11 Some third_party deps we only link against prebuilt versions. For those, we do not involve
12 WORKSPACE.bazel and link to them directly, e.g. `//bazel/external/fontconfig`.
13
14 Notes
15 -----
16
17 Avoid strip_include_prefix
18 ==========================
19 [strip_include_prefix](https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.strip_include_prefix)
20 causes the header path for the library to be added to the compiler include search path with `-I`,
21 which means Clang will treat it like a file in Skia proper. This means if those headers have
22 issues that Clang's diagnostic warnings catch (e.g. missing `override`), we will see those warnings
23 and the build will fail.
24
25 Generally, we do not want to have to fix third_party code's warnings, so instead of
26 using `strip_include_prefix`, use `includes` instead. This is more ergonomic, as it can let us
27 expose header files from multiple locations (e.g. `freetype` has its API in `includes` and the
28 customization headers in `builds`) and adds these to the search path with `-isystem`. Clang ignores
29 warnings in these "system" headers, which means our warnings will be focused to the Skia code base.