139 lines · plain
1import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")2import("//llvm/utils/gn/build/toolchain/compiler.gni")3 4# `exec_script_allowlist` was added in GN version 2207, so that's the minimum5# version of GN we require.6assert(gn_version >= 2207,7 "Your GN is too old! Update it, perhaps by running llvm/utils/gn/get.py")8 9group("default") {10 deps = [11 "//clang-tools-extra/clangd/test",12 "//clang-tools-extra/test",13 "//clang/test",14 "//clang/tools/scan-build",15 "//compiler-rt",16 "//compiler-rt/include",17 "//compiler-rt/lib/scudo",18 "//compiler-rt/test/builtins",19 "//lld/test",20 "//lldb/test",21 "//llvm/test",22 ]23 if (current_os == "linux") {24 deps += [25 "//libcxx",26 "//libcxxabi",27 ]28 }29 if (current_os == "linux" || current_os == "win" || current_os == "mac") {30 deps += [ "//compiler-rt/test/asan" ]31 }32 33 if (current_os == "linux" || current_os == "mac") {34 deps += [ "//compiler-rt/test/lsan" ]35 }36 37 if (current_os == "linux" || current_os == "android") {38 deps += [ "//compiler-rt/test/hwasan" ]39 }40 if (current_os == "linux" || current_os == "mac") {41 deps += [ "//libunwind" ]42 }43 44 # FIXME: Add this on win after testing that it builds.45 if (current_os != "win") {46 deps += [ "//bolt/test" ]47 }48 49 testonly = true50}51 52# Symlink handling.53# On POSIX, symlinks to the target can be created before the target exist,54# and the target can depend on the symlink targets, so that building the55# target ensures the symlinks exist.56# However, symlinks didn't exist on Windows until recently, so there the57# binary needs to be copied -- which requires it to exist. So the symlink step58# needs to run after the target that creates the binary.59# In the cmake build, this is done via a "postbuild" on the target, which just60# tacks on "&& copy out.exe out2.exe" to the link command.61# GN doesn't have a way to express postbuild commands. It could probably be62# emulated by having the link command in the toolchain be a wrapper script that63# reads a ".symlinks" file next to the target, and have an action write that64# and make the target depend on that, but then every single link has to use the65# wrapper (unless we do further acrobatics to use a different toolchain for66# targets that need symlinks) even though most links don't need symlinks.67# Instead, have a top-level target for each target that needs symlinks, and68# make that depend on the symlinks. Then the symlinks can depend on the69# executable. This has the effect that `ninja lld` builds lld and then creates70# symlinks (via this target), while `ninja bin/lld` only builds lld and doesn't71# update symlinks (in particular, on Windows it doesn't copy the new lld to its72# new locations).73# That seems simpler, more explicit, and good enough.74group("clang") {75 deps = [ "//clang/tools/driver:symlinks" ]76}77group("lld") {78 deps = [ "//lld/tools/lld:symlinks" ]79}80group("llvm-ar") {81 deps = [ "//llvm/tools/llvm-ar:symlinks" ]82}83if (current_os == "mac") {84 group("llvm-bolt") {85 deps = [ "//bolt/tools/driver:symlinks" ]86 }87}88group("llvm-dwp") {89 deps = [ "//llvm/tools/llvm-dwp:symlinks" ]90}91group("llvm-nm") {92 deps = [ "//llvm/tools/llvm-nm:symlinks" ]93}94group("llvm-cxxfilt") {95 deps = [ "//llvm/tools/llvm-cxxfilt:symlinks" ]96}97group("llvm-debuginfod") {98 deps = [ "//llvm/tools/llvm-debuginfod:symlinks" ]99}100group("llvm-debuginfod-find") {101 deps = [ "//llvm/tools/llvm-debuginfod-find:symlinks" ]102}103group("llvm-libtool-darwin") {104 deps = [ "//llvm/tools/llvm-libtool-darwin:symlinks" ]105}106group("llvm-lipo") {107 deps = [ "//llvm/tools/llvm-lipo:symlinks" ]108}109group("llvm-ml") {110 deps = [ "//llvm/tools/llvm-ml:symlinks" ]111}112group("llvm-objcopy") {113 deps = [ "//llvm/tools/llvm-objcopy:symlinks" ]114}115group("llvm-objdump") {116 deps = [ "//llvm/tools/llvm-objdump:symlinks" ]117}118group("llvm-rc") {119 deps = [ "//llvm/tools/llvm-rc:symlinks" ]120}121group("llvm-readobj") {122 deps = [ "//llvm/tools/llvm-readobj:symlinks" ]123}124group("llvm-size") {125 deps = [ "//llvm/tools/llvm-size:symlinks" ]126}127group("llvm-strings") {128 deps = [ "//llvm/tools/llvm-strings:symlinks" ]129}130group("llvm-symbolizer") {131 deps = [ "//llvm/tools/llvm-symbolizer:symlinks" ]132}133 134# A pool called "console" in the root BUILD.gn is magic and represents ninja's135# built-in console pool. (Requires a GN with `gn --version` >= 552353.)136pool("console") {137 depth = 1138}139