xref: /aosp_15_r20/external/angle/third_party/clspv/gn/README.md (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1# CLSPV GN Build
2
3The clspv official build system is CMake and as such have no GN build infra. The
4files in here enable building `clspv` using the ANGLE GN build infra.
5
6The top-level build file is `BUILD.gn` with all the auxiliary build files
7located in the `gn` folder. The `clspv` build is heavily dependent on the LLVM
8build. The LLVM settings and targets needed for `clspv` are captured in the
9`gn/llvm` location. These utilize the LLVM experimental GN build infra [1].
10
11## Build Instructions
12
13The GN build in here is setup to function within the ANGLE GN build
14infrastructure and as such follows the same setup as of ANGLE project. Please
15refer top level ANGLE readme file.
16
17Add the following to `args.gn` file
18
19```
20angle_enable_cl = true
21```
22
23Note: Only the `linux/x86{,_64}` and `android/arm{64}` combination of `os/cpu`
24are setup for now.
25
26## Updating the LLVM build targets
27
28The LLVM targets required for clspv are housed in the `gn/llvm` location. In the
29case of source files getting added/removed in the upstream LLVM, the relavant
30target sources needs to be modified in `gn/llvm/sources/BUILD.gn`.
31
32The LLVM targets are named in the format `clspv_<llvm/clang>_<folder path
33slug with _>`.
34
35For instance `clspv_llvm_lib_frontend_offloading` refers to the LLVM
36target in `third_party/llvm/src/llvm/lib/Frontend/Offloading`. The `sources`
37list in from the corresponding LLVM `BUILD.gn` file, here
38`third_party/llvm/src/llvm/utils/gn/secondary/llvm/lib/Frontend/Offloading` can
39be copied with prefix path "//$clspv_llvm_dir/llvm/lib/Frontend/Offloading/"
40applied to it.
41
42## References
43
44[1]: https://github.com/llvm/llvm-project/blob/main/llvm/utils/gn/README.rst
45