1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/utils/gn/secondary/BUILD.gn
Nico Weber 51b84418d4 [gn build] Add check-llvm target and make it work
With this, check-llvm runs and passes all of clang's lit tests. It doesn't run
any of its unit tests yet.

This is the only change in the GN build patch series that needs a change to a
file outside of llvm/utils/gn: llvm/test/tools/llvm-config/booleans.test checks
the result of llvm-config --build-system for some reason, so I'm updating the
test to accept "gn" as valid output in addition to "cmake". (The alternative
would be to let the gn build self-identify as cmake, which seems worse.)

Like with check-clang and check-lld, running just ninja -C out/gn will build
all prerequisites needed to run tests, but it won't run the tests (so that the
build becomes clean after one build). Running ninja -C out/gn check-llvm will
build prerequisites if needed and run the tests. The check-llvm target never
becomes clean and runs tests every time.

Differential Revision: https://reviews.llvm.org/D56195

llvm-svn: 350410
2019-01-04 17:13:33 +00:00

101 lines
2.7 KiB
Plaintext

import("//clang/lib/ARCMigrate/enable.gni")
import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
group("default") {
deps = [
"//clang/test",
"//lld/test",
"//llvm/test",
]
testonly = true
}
# Symlink handling.
# On POSIX, symlinks to the target can be created before the target exist,
# and the target can depend on the symlink targets, so that building the
# target ensures the symlinks exist.
# However, symlinks didn't exist on Windows until recently, so there the
# binary needs to be copied -- which requires it to exist. So the symlink step
# needs to run after the target that creates the binary.
# In the cmake build, this is done via a "postbuild" on the target, which just
# tacks on "&& copy out.exe out2.exe" to the link command.
# GN doesn't have a way to express postbuild commands. It could probably be
# emulated by having the link command in the toolchain be a wrapper script that
# reads a ".symlinks" file next to the target, and have an action write that
# and make the target depend on that, but then every single link has to use the
# wrapper (unless we do further acrobatics to use a different toolchain for
# targets that need symlinks) even though most links don't need symlinks.
# Instead, have a top-level target for each target that needs symlinks, and
# make that depend on the symlinks. Then the symlinks can depend on the
# executable. This has the effect that `ninja lld` builds lld and then creates
# symlinks (via this target), while `ninja bin/lld` only builds lld and doesn't
# update symlinks (in particular, on Windows it doesn't copy the new lld to its
# new locations).
# That seems simpler, more explicit, and good enough.
group("clang") {
deps = [
"//clang/tools/driver:symlinks",
]
}
group("lld") {
deps = [
"//lld/tools/lld:symlinks",
]
}
group("llvm-ar") {
deps = [
"//llvm/tools/llvm-ar:symlinks",
]
}
group("llvm-dwp") {
deps = [
"//llvm/tools/llvm-dwp:symlinks",
]
}
group("llvm-nm") {
deps = [
"//llvm/tools/llvm-nm:symlinks",
]
}
group("llvm-cxxfilt") {
deps = [
"//llvm/tools/llvm-cxxfilt:symlinks",
]
}
group("llvm-objcopy") {
deps = [
"//llvm/tools/llvm-objcopy:symlinks",
]
}
group("llvm-objdump") {
deps = [
"//llvm/tools/llvm-objdump:symlinks",
]
}
group("llvm-readobj") {
deps = [
"//llvm/tools/llvm-readobj:symlinks",
]
}
group("llvm-size") {
deps = [
"//llvm/tools/llvm-size:symlinks",
]
}
group("llvm-strings") {
deps = [
"//llvm/tools/llvm-strings:symlinks",
]
}
group("llvm-symbolizer") {
deps = [
"//llvm/tools/llvm-symbolizer:symlinks",
]
}
# A pool called "console" in the root BUILD.gn is magic and represents ninja's
# built-in console pool. (Requires a GN with `gn --version` >= 552353.)
pool("console") {
depth = 1
}