Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 1 | import("//clang/lib/ARCMigrate/enable.gni") |
| 2 | import("//clang/lib/StaticAnalyzer/Frontend/enable.gni") |
| 3 | import("//llvm/utils/gn/build/toolchain/compiler.gni") |
| 4 | |
| 5 | group("default") { |
| 6 | deps = [ |
Chih-Hung Hsieh | 0860053 | 2019-12-19 15:55:38 -0800 | [diff] [blame] | 7 | "//clang-tools-extra/clangd/test", |
| 8 | "//clang-tools-extra/test", |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 9 | "//clang/test", |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 10 | "//clang/tools/scan-build", |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame^] | 11 | "//compiler-rt", |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 12 | "//compiler-rt/include", |
Jeff Vander Stoep | 247d86b | 2020-08-11 14:27:44 +0200 | [diff] [blame] | 13 | "//compiler-rt/lib/scudo", |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 14 | "//lld/test", |
| 15 | "//llvm/test", |
| 16 | ] |
Chih-Hung Hsieh | 0860053 | 2019-12-19 15:55:38 -0800 | [diff] [blame] | 17 | if (current_os == "linux") { |
| 18 | deps += [ |
Chih-Hung Hsieh | 0860053 | 2019-12-19 15:55:38 -0800 | [diff] [blame] | 19 | "//libcxx", |
| 20 | "//libcxxabi", |
Chih-Hung Hsieh | 0860053 | 2019-12-19 15:55:38 -0800 | [diff] [blame] | 21 | ] |
| 22 | } |
| 23 | if (current_os == "linux" || current_os == "android") { |
| 24 | deps += [ "//compiler-rt/test/hwasan" ] |
| 25 | } |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame^] | 26 | if (current_os == "linux" || current_os == "mac") { |
| 27 | deps += [ "//libunwind" ] |
| 28 | } |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 29 | |
| 30 | testonly = true |
| 31 | } |
| 32 | |
| 33 | # Symlink handling. |
| 34 | # On POSIX, symlinks to the target can be created before the target exist, |
| 35 | # and the target can depend on the symlink targets, so that building the |
| 36 | # target ensures the symlinks exist. |
| 37 | # However, symlinks didn't exist on Windows until recently, so there the |
| 38 | # binary needs to be copied -- which requires it to exist. So the symlink step |
| 39 | # needs to run after the target that creates the binary. |
| 40 | # In the cmake build, this is done via a "postbuild" on the target, which just |
| 41 | # tacks on "&& copy out.exe out2.exe" to the link command. |
| 42 | # GN doesn't have a way to express postbuild commands. It could probably be |
| 43 | # emulated by having the link command in the toolchain be a wrapper script that |
| 44 | # reads a ".symlinks" file next to the target, and have an action write that |
| 45 | # and make the target depend on that, but then every single link has to use the |
| 46 | # wrapper (unless we do further acrobatics to use a different toolchain for |
| 47 | # targets that need symlinks) even though most links don't need symlinks. |
| 48 | # Instead, have a top-level target for each target that needs symlinks, and |
| 49 | # make that depend on the symlinks. Then the symlinks can depend on the |
| 50 | # executable. This has the effect that `ninja lld` builds lld and then creates |
| 51 | # symlinks (via this target), while `ninja bin/lld` only builds lld and doesn't |
| 52 | # update symlinks (in particular, on Windows it doesn't copy the new lld to its |
| 53 | # new locations). |
| 54 | # That seems simpler, more explicit, and good enough. |
| 55 | group("clang") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 56 | deps = [ "//clang/tools/driver:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 57 | } |
| 58 | group("lld") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 59 | deps = [ "//lld/tools/lld:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 60 | } |
| 61 | group("llvm-ar") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 62 | deps = [ "//llvm/tools/llvm-ar:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 63 | } |
| 64 | group("llvm-dwp") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 65 | deps = [ "//llvm/tools/llvm-dwp:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 66 | } |
| 67 | group("llvm-nm") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 68 | deps = [ "//llvm/tools/llvm-nm:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 69 | } |
| 70 | group("llvm-cxxfilt") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 71 | deps = [ "//llvm/tools/llvm-cxxfilt:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 72 | } |
| 73 | group("llvm-objcopy") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 74 | deps = [ "//llvm/tools/llvm-objcopy:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 75 | } |
| 76 | group("llvm-objdump") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 77 | deps = [ "//llvm/tools/llvm-objdump:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 78 | } |
Chris Wailes | bcf972c | 2021-10-21 11:03:28 -0700 | [diff] [blame^] | 79 | group("llvm-rc") { |
| 80 | deps = [ "//llvm/tools/llvm-rc:symlinks" ] |
| 81 | } |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 82 | group("llvm-readobj") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 83 | deps = [ "//llvm/tools/llvm-readobj:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 84 | } |
| 85 | group("llvm-size") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 86 | deps = [ "//llvm/tools/llvm-size:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 87 | } |
| 88 | group("llvm-strings") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 89 | deps = [ "//llvm/tools/llvm-strings:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 90 | } |
| 91 | group("llvm-symbolizer") { |
Thiébaud Weksteen | e40e736 | 2020-10-28 15:03:00 +0100 | [diff] [blame] | 92 | deps = [ "//llvm/tools/llvm-symbolizer:symlinks" ] |
Inna Palant | ff3f07a | 2019-07-11 16:15:26 -0700 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | # A pool called "console" in the root BUILD.gn is magic and represents ninja's |
| 96 | # built-in console pool. (Requires a GN with `gn --version` >= 552353.) |
| 97 | pool("console") { |
| 98 | depth = 1 |
| 99 | } |