xref: /aosp_15_r20/external/toolchain-utils/compiler_wrapper/README.md (revision 760c253c1ed00ce9abd48f8546f08516e57485fe)
1Copyright 2023 The ChromiumOS Authors
2Use of this source code is governed by a BSD-style license that can be
3found in the LICENSE file.
4
5### What
6Toolchain utils compiler wrapper sources.
7
8Please note that there's a regular syncing operation between
9`chromiumos-overlay/sys-devel/llvm/files/compiler_wrapper` and
10`toolchain-utils/compiler_wrapper`. This sync is one way (from
11chromiumos-overlay to `toolchain-utils`). Syncing in this way helps the Android
12toolchain keep up-to-date with our wrapper easily, as they're a downstream
13consumer of it. For this reason, **please be sure to land all actual changes in
14chromeos-overlay**.
15
16### Build + Run Tests
171. Install the wrapper locally in chroot (builds as well)
18```
19(chroot) ./install_compiler_wrapper.sh
20```
21
22#### Running a manual test
23Test a manual build command with `-print-cmdline`
24```
25(chroot) x86_64-cros-linux-gnu-clang++ -o test_exec -f<some_flag_to_add>='some_value' -print-cmdline test.cc
26```
27-  `test.cc` doesn't actually have to exist.
28-  The command above will output the additional build flags that are added in by the wrapper.
29
30#### Testing your changes
311. Add tests to your wrapper changes
321. Run all the tests via:
33```
34go test -vet=all
35```
36
37### Build Only
38This is handy if you just want to test that the build works.
39
40Build the wrapper:
41```
42./build.py --config=<config name> --use_ccache=<bool> \
43  --use_llvm_next=<bool> --output_file=<file>
44  ```
45