summaryrefslogtreecommitdiffstats
path: root/llvm/utils/gn/build
Commit message (Collapse)AuthorAgeFilesLines
...
* gn build: Stop passing -DLLVM_LIBXML2_ENABLED to some targetsNico Weber2019-01-211-1/+0
| | | | | | | | | | | | | | | | This is a remnant from before the gn build had a working config.h. Defining LLVM_LIBXML2_ENABLED only for targets that depend on build/libs/xml is nice in that only some of the codebase needs to be rebuilt when llvm_enable_libxml2 changes -- but config.h already defines it and defining it there and then redundantly a second time for some targets is worse than having it just in config.h. No behavior change. Differential Revision: https://reviews.llvm.org/D56908 llvm-svn: 351758
* gn build: unbreak mac (and maybe win) after r351258, r351277Nico Weber2019-01-181-2/+6
| | | | | | | | | | | | | The check-hwasan build files assert that current_os == "linux" || current_os == "android", so pull it in only there. ar is unused on mac, so don't set it in the stage2 toolchain. (It'd be nicer to use llvm-libtool on mac instead of host libtool, but llvm-libtool doesn't seem to understand the -no_warning_for_no_symbols flag.) Differential Revision: https://reviews.llvm.org/D56898 llvm-svn: 351519
* gn build: Add a stage2 host toolchain and make the hwasan runtime buildable ↵Peter Collingbourne2019-01-151-2/+16
| | | | | | | | on x86_64 Linux. Differential Revision: https://reviews.llvm.org/D56711 llvm-svn: 351258
* gn build: Move target flags from toolchain to a .gni file.Peter Collingbourne2019-01-154-29/+54
| | | | | | | | | While here, add a use_lld flag and default it to true when using clang on non-mac. Differential Revision: https://reviews.llvm.org/D56710 llvm-svn: 351248
* gn build: Add build files for ↵Peter Collingbourne2019-01-151-0/+9
| | | | | | | | | | compiler-rt/lib/{hwasan,interception,sanitizer_common,ubsan}. This allows the hwasan runtime to be built for Android aarch64. Differential Revision: https://reviews.llvm.org/D56628 llvm-svn: 351246
* gn build: Rename llvm_host_triple to llvm_current_triple and have it use ↵Peter Collingbourne2019-01-152-0/+10
| | | | | | | | | | | | | | | | | | current_{cpu,os}. This makes e.g. ToolChain::isCrossCompiling() in clang/lib/Driver/ToolChain.cpp return the correct result if the compiler was cross-compiled. This change also affects llvm_default_target_triple, so cross-compiled compilers default to targeting the cross-compilation target, which makes more sense than the host that the compiler was compiled on. This change will also be necessary in order for the correct triples to appear in generated lit files for non-native targets. Differential Revision: https://reviews.llvm.org/D56696 llvm-svn: 351168
* gn build: Make a couple of improvements to the unix toolchain.Peter Collingbourne2019-01-151-2/+12
| | | | | | | | | | Add an asm tool (will be required for building sanitizer_common on x64) and set a soname for DSOs so that anything that links against them gets the correct DT_NEEDED. Differential Revision: https://reviews.llvm.org/D56705 llvm-svn: 351167
* gn build: Split no-RTTI flag into a config.Peter Collingbourne2019-01-152-5/+10
| | | | | | | | | Some of the sanitizer runtime code needs to be built with RTTI; this allows that code to opt in to RTTI. Differential Revision: https://reviews.llvm.org/D56627 llvm-svn: 351155
* gn build: Stop defining LLVM_ON_UNIX globally.Peter Collingbourne2019-01-151-5/+0
| | | | | | | | This macro is already being defined in llvm-config.h. Differential Revision: https://reviews.llvm.org/D56626 llvm-svn: 351154
* gn build: Unbreak mac build after r350977Nico Weber2019-01-141-1/+3
| | | | llvm-svn: 351090
* gn build: Add a stage2 toolchain for Android.Peter Collingbourne2019-01-114-11/+61
| | | | | | | | | This makes it possible to build llvm-symbolizer for Android, which is one of the prerequisites for running the sanitizer tests on Android. Differential Revision: https://reviews.llvm.org/D56577 llvm-svn: 350979
* gn build: Create a template for unix toolchains.Peter Collingbourne2019-01-111-96/+112
| | | | | | | | | | Also change the toolchain description to use current_os instead of host_os so that the template can be used for cross builds, and add a current_os to the win toolchain to match the unix toolchain. Differential Revision: https://reviews.llvm.org/D56576 llvm-svn: 350977
* gn build: Create a variable for the host toolchain and start using it in the ↵Peter Collingbourne2019-01-111-2/+4
| | | | | | | | tblgen template. Differential Revision: https://reviews.llvm.org/D56575 llvm-svn: 350964
* gn build: s/root_out_dir/root_build_dir/g in ↵Peter Collingbourne2019-01-111-2/+2
| | | | | | | | | | llvm/utils/gn/build/write_cmake_config.gni. This makes the generated files go to the right place when using a non-default toolchain. Differential Revision: https://reviews.llvm.org/D56427 llvm-svn: 350963
* gn build: Add a template for calling write_cmake_config.pyNico Weber2019-01-101-0/+54
| | | | | | | | No behavior change. Differential Revision: https://reviews.llvm.org/D56487 llvm-svn: 350905
* gn build: Use "git rev-parse --git-dir" to discover the path to the .git ↵Peter Collingbourne2019-01-101-7/+8
| | | | | | | | | | directory. This makes it compatible with worktrees. Differential Revision: https://reviews.llvm.org/D56422 llvm-svn: 350897
* [gn build] Run `git ls-files '*.gn' '*.gni' | xargs -n 1 gn format`Nico Weber2019-01-091-2/+1
| | | | | | Looks like I forgot to do that for the PowerPC target. llvm-svn: 350711
* Make the write_cmake_config.py script python3-compatibleAlexander Kornienko2019-01-091-1/+1
| | | | llvm-svn: 350700
* gn build: Copy file permissions from input file in configure_file() emulation.Peter Collingbourne2019-01-091-0/+1
| | | | | | | | | Most significantly, this makes bin/llvm-lit executable so that it can be run in the usual way. Differential Revision: https://reviews.llvm.org/D56423 llvm-svn: 350688
* gn build: Fix a Python2ism in write_vcsrevision.py.Peter Collingbourne2019-01-091-2/+2
| | | | | | | | | | | | Convert the output of "git rev-parse --short HEAD" to a string before substituting it into the output file. Without this the output file will look like this on Python 3: #define LLVM_REVISION "git-b'6a4895a025f'" Differential Revision: https://reviews.llvm.org/D56459 llvm-svn: 350686
* [gn build] Make sync_source_lists_from_cmake.py check that all LLVM ↵Nico Weber2019-01-081-2/+1
| | | | | | | | | | unittests are present Now that the PowerPC and WebAssembly targets are added, this check passes. Differential Revision: https://reviews.llvm.org/D56417 llvm-svn: 350631
* gn build: Stop passing -o to ar.Peter Collingbourne2019-01-081-1/+1
| | | | | | | | | The -o flag means something different to ar than what appears to be intended here. Also, llvm-ar doesn't accept the flag in this position. Differential Revision: https://reviews.llvm.org/D56426 llvm-svn: 350604
* [gn build] Start adding build files for LLVM unittestsNico Weber2019-01-041-2/+8
| | | | | | | | | | | | | | | Adds build files for //llvm/unittest/[A-D]. Also teach sync_source_lists_from_cmake.py to not complain about missing BUILD.gn files for CMakeLists.txt files that just call add_subdirectory() without calling add_.+_unittest, like e.g. llvm/unittests/Target/CMakeLists.txt. (Omits CodeGen/GlobalISel and DebugInfo/PDB because their build files are somewhat interesting, and this patch is already on the larger side.) Differential Revision: https://reviews.llvm.org/D56212 llvm-svn: 350411
* [gn build] Add build files for llvm/lib/{LineEditor,Testing/Support,TextAPI}Nico Weber2019-01-042-0/+15
| | | | | | | | | | | Nothing pulls them in yet, but they will be needed for check-llvm. LineEditor depends on libedit, so create a gn/build/lib for it, following the usual pattern. Differential Revision: https://reviews.llvm.org/D56316 llvm-svn: 350407
* [gn build] Make write_cmake_config.py check that each key passed is uniqueNico Weber2019-01-041-0/+3
| | | | | | | | I got that wrong once while locally while working on check-llvm. Reviewed as part of https://reviews.llvm.org/D56195 llvm-svn: 350394
* [gn build] Add fuzzers in llvm/tools that are needed for check-llvmNico Weber2019-01-021-0/+49
| | | | | | | | | | | | Also add a fuzzer() template for defining fuzzers that's similar to add_llvm_fuzzer in the CMake build, and a build file for dependency llvm/lib/FuzzMutate. Also make `assert(defined(...` error strings a bit more self-consistent. Differential Revision: https://reviews.llvm.org/D56194 llvm-svn: 350238
* [gn build] Make `ninja check-clang` also run Clang's unit testsNico Weber2018-12-312-8/+32
| | | | | | | | | | | | | | | | | | | | Also add a build file for clang/lib/ASTMatchers/Dynamic, which is only needed by tests (and clang/tools/extra). Also make llvm/utils/gn/build/sync_source_lists_from_cmake.py check that every CMakeLists.txt file below {lld,clang}/unittests has a corresponding BUILD.gn file, so we notice if new test binaries get added (since the failure mode for missing GN build files for tests is just the tests silently not running in the GN build). Also add a unittest() macro for defining unit test targets, and add a lengthy comment there about where the unit test binaries go and why. With this, the build files for //clang are complete. Differential Revision: https://reviews.llvm.org/D56116 llvm-svn: 350171
* [gn build] Add check-lld target and make it workNico Weber2018-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | Also add a build file for llvm-lit, which in turn needs llvm/tools/llvm-config. With this, check-lld runs and passes all of lld's lit tests. It doesn't run any of its unit tests yet. 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-lld will build prerequisites if needed and run the tests. The check-lld target never becomes clean and runs tests every time. llvm-config's build file is a bit gnarly: Everything not needed to run tests is basically stubbed out. Also, to generate LibraryDependencies.inc we shell out to llvm-build at build-time. It would be much nicer to get the library dependencies by using the dependency data the GN build contains (http://llvm-cs.pcc.me.uk/gen/tools/llvm-config/LibraryDependencies.inc#1). Differential Revision: https://reviews.llvm.org/D55836 llvm-svn: 349702
* [gn build] Add build files for llvm-ar, llvm-nm, llvm-objdump, llvm-readelfNico Weber2018-12-182-0/+15
| | | | | | | | | | | | | | | Also add build files for deps DebugInfo/Symbolize, ToolDrivers/dll-tool. Also add gn/build/libs/xar (needed by llvm-objdump). Also delete an incorrect part of the symlink description in //BUILD.gn (it used to be true before I made the symlink step write a stamp file; now it's no longer true). These are all binaries needed by check-lld that need symlinks. Differential Revision: https://reviews.llvm.org/D55743 llvm-svn: 349486
* [gn build] Add infrastructure to create symlinks and use it to create lld's ↵Nico Weber2018-12-142-0/+67
| | | | | | | | | | | | symlinks This is slightly involved, see the comments in the code. The GN build now builds a functional lld! Differential Revision: https://reviews.llvm.org/D55606 llvm-svn: 349096
* [gn build] Fix defines define on WindowsShoaib Meenai2018-12-121-1/+3
| | | | | | | | | | | On Windows, we won't go into the `host_os != "win"` block, so `defines` won't have been defined, and we'll run into an undefined identifier error when we try to later append to it. Unconditionally define it at the start and append to it everywhere else. Differential Revision: https://reviews.llvm.org/D55617 llvm-svn: 348993
* [gn build] Add all non-test build files for lldNico Weber2018-12-121-1/+1
| | | | | | | | | | | | Version.inc.in processing has a potentially interesting part which I've punted on for now (LLD_REVISION and LLD_REPOSITORY are set to empty strings for now). lld now builds in the gn build. But no symlinks to it are created yet, so it can't be meaningfully run yet. Differential Revision: https://reviews.llvm.org/D55593 llvm-svn: 348945
* [gn build] Process .def.in files in llvm/Config and add lib/Target/BUILD.gnNico Weber2018-12-061-12/+13
| | | | | | | | | | | | | | | Tweak write_cmake_config.py to also handle variable references looking @FOO@ (matching CMake's configure_file() function), and make it replace '\' 'n' in values with a newline literal since there's no good portable way of passing a real newline literal on a command line. Use that to process all the .def.in files in llvm/include/Config and add llvm/lib/Target/BUILD.gn, which (indirectly, through llvm-c/Target.h) includes them. Differential Revision: https://reviews.llvm.org/D55184 llvm-svn: 348503
* [gn build] Use print_function in write_cmake_config.pyNico Weber2018-12-031-3/+5
| | | | | | | | | No behavior change, just makes the script match the other scripts in llvm/utils/gn/build. Differential Revision: https://reviews.llvm.org/D55183 llvm-svn: 348190
* [gn build] Fix cosmetic bug in write_cmake_config.pyNico Weber2018-12-021-4/+4
| | | | | | | | | | | | Before, #cmakedefine FOO resulted in #define FOO with a trailing space if FOO was set to something truthy. Make it so that it's just #define FOO without a trailing space. No functional difference. Differential Revision: https://reviews.llvm.org/D55172 llvm-svn: 348107
* [gn build] Slightly simplify write_cmake_config.Nico Weber2018-12-021-27/+18
| | | | | | | | | | | | | | | | | | | Before, the script had a bunch of special cases for #cmakedefine and #cmakedefine01 and then did general variable substitution. Now, the script always does general variable substitution for all lines and handles the special cases afterwards. This has no observable effect for the inputs we use, but is easier to explain and slightly easier to implement. Also mention to link to CMake's configure_file() in the docstring. (The new behavior doesn't quite match CMake on lines like #cmakedefine ${FOO}, but nobody does that.) Differential Revision: https://reviews.llvm.org/D55171 llvm-svn: 348106
* [gn build] Add action to generate VCSRevision.h and use it to add ↵Nico Weber2018-12-011-0/+77
| | | | | | | | llvm/lib/Object/BUILD.gn Differential Revision: https://reviews.llvm.org/D55090 llvm-svn: 348054
* [gn build] Set +x bit on .py files in llvm/utils/gn/build.Nico Weber2018-11-293-0/+1
| | | | | | Also add a shebang line to write_cmake_config.py. llvm-svn: 347928
* [gn build] Add template for running llvm-tblgen and use it to add build file ↵Nico Weber2018-11-291-0/+8
| | | | | | | | | | | | | | | | | | | for llvm/lib/IR. Also adds a boring build file for llvm/lib/BinaryFormat (needed by llvm/lib/IR). lib/IR marks Attributes and IntrinsicsEnum as public_deps (because IR's public headers include the generated .inc files), so projects depending on lib/IR will implicitly depend on them being generated. As a consequence, most targets won't have to explicitly list a dependency on these tablegen steps (contrast with intrinsics_gen in the cmake build). This doesn't yet have the optimization where tablegen's output is only updated if it's changed. Differential Revision: https://reviews.llvm.org/D55028#inline-486755 llvm-svn: 347927
* [gn build] Add a script checking if sources in BUILD.gn and CMakeLists.txt ↵Nico Weber2018-11-291-0/+54
| | | | | | | | | | | | | | | | | files match. Also fix a missing file in lib/Support/BUILD.gn found by the script. The script is very stupid and assumes that CMakeLists.txt follow the standard LLVM CMakeLists.txt formatting with one cpp source file per line. Despite its simplicity, it works well in practice. It would be nice if it also checked deps and maybe automatically applied its suggestions. Differential Revision: https://reviews.llvm.org/D54930 llvm-svn: 347925
* Move a file I forgot to move in r347636.Nico Weber2018-11-271-0/+0
| | | | llvm-svn: 347638
* [gn build] Create abi-breaking.h, config.h, llvm-config.h, and add a build ↵Nico Weber2018-11-2710-13/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | file for llvm/lib/Support. The comments at the top of llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn and llvm/utils/gn/build/write_cmake_config.py should explain the main bits happening in this patch. The main parts here are that these headers are generated at build time, not gn time, and that currently they don't do any actual feature checks but just hardcode most things based on the current OS, which seems to work well enough. If this stops being enough, the feature checks should each be their own action writing the result to somewhere, and the config write step should depend on those checks (so that they can run in parallel and as part of the build) -- utils/llvm/gn/README.rst already has some more words on that in "Philosophy". (write_cmake_config.py is also going to be used to write clang's clang/include/clang/Config/config.h) This also adds a few files for linking to system libraries in a consistent way if needed in llvm/utils/gn/build/libs (and moves pthread to that model).0 I'm also adding llvm/utils/gn/secondary/llvm/lib/Target/targets.gni in this patch because $native_arch is needed for writing llvm-config.h -- the rest of it will be used later, when the build files for llvm/lib/Target get added. That file describes how to select which archs to build. As a demo, also add a build file for llvm-undname and make it the default build target (it depends on everything that can currently be built). Differential Revision: https://reviews.llvm.org/D54678 llvm-svn: 347636
* Add initial scaffolding for the GN build.Nico Weber2018-11-177-0/+452
See "GN build roundtable summary; adding GN build files to the repo" on llvm-dev and cfe-dev for discussion. In particular, this build is completely unsupported. People adding new files to LLVM are not expected to update the GN build files, and reviewers are not supposed to request the gn build files to be updated. This adds just enough to be able to build llvm/lib/Demangle. It requires using a monorepo. This adds a few build config options you can set in args.gn (`gn args out/foo --list` for all): - is_debug = true to enable debug builds (defaults to release) - llvm_enable_assertions to toggle assertions (defaults to true) - clang_base_path, if set an absolute path to a locally-built clang to be used as host compiler Differential Revision: https://reviews.llvm.org/D54345 llvm-svn: 347128
OpenPOWER on IntegriCloud