aboutsummaryrefslogtreecommitdiff
path: root/clang/CMakeLists.txt
AgeCommit message (Collapse)Author
2018-11-29inhereit LLVM_ENABLE_LIBXML2David Callahan
Summary: When building in an LLVM context, we should respect its LLVM_ENABLE_LIBXML2 option. Reviewers: vitalybuka, mspertus, modocache Reviewed By: modocache Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D53212 llvm-svn: 347870
2018-11-18cmake: z3: Remove EXACT from 4.7.1 after being compatible with 4.8.1Jan Kratochvil
After check-in of D54391 a comment there by @mikhail.ramalho says: Since we're supporting version 4.8.1 now, the cmake file should be changed to "minimum" instead of "exact". Differential Revision: https://reviews.llvm.org/D54535 llvm-svn: 347152
2018-11-16[CMake] Support cross-compiling with multi-stage buildsPetr Hosek
When using multi-stage builds, we would like support cross-compilation. Example is 2-stage build when the first stage is compiled for host while the second stage is compiled for the target. Normally, the second stage would be also used for compiling runtimes, but that's not possible when cross-compiling, so we use the first stage compiler instead. However, we still want to use the second stage paths. To do so, we set the -resource-dir of the first stage compiler to point to the resource directory of the second stage. We also need compiler tools that support the target architecture. These tools are not guaranteed to be present on the host, but in case of multi-stage build, we can build these tools in the first stage. Differential Revision: https://reviews.llvm.org/D54461 llvm-svn: 347025
2018-11-13CMake: Deprecate using llvm-config to detect llvm installationTom Stellard
Summary: clang currently uses llvm-config to determine the installation paths for llvm's headers and binaries. clang is also using LLVM's cmake files to determine other information about the LLVM build, like LLVM_LIBDIR_SUFFIX, LLVM_VERSION_*, etc. Since the installation paths are also available via the cmake files, we can simplify the code by only relying on information from cmake about the LLVM install and dropping the use of llvm-config altogether. In addition to simplifying the code, the cmake files have more accurate information about the llvm installation paths. llvm-config assumes that the lib, bin, and cmake directories are always located in the same place relative to the path of the llvm-config executable. This can be wrong if a user decides to install headers, binaries or libraries to a non-standard location: e.g. static libraries installed to /usr/lib/llvm6.0/ This patch takes the first step towards dropping llvm-config by removing the automatic detection of llvm-config (users can still manually supply a path to llvm-config by passing -DLLVM_CONFIG=/usr/bin/llvm-config to cmake) and adding a deprecation warning when users try to use this option. Reviewers: chandlerc, beanz, mgorny, chapuni Subscribers: mehdi_amini, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D51714 llvm-svn: 346732
2018-11-13CMake: Replace open-coded find_packageTom Stellard
Reviewers: beanz, mgorny Reviewed By: mgorny Subscribers: cfe-commits, chapuni, llvm-commits Differential Revision: https://reviews.llvm.org/D32577 llvm-svn: 346731
2018-11-08[clang] Set CMP0075 to newShoaib Meenai
Make the check_include_file* macros honor CMAKE_REQUIRED_LIBRARIES. This shouldn't cause any of the configuration checks to give different results, and I verified that a clean configure before and after this change resulted in identical CMake caches on my machine. The same change was done for LLVM in r346377. llvm-svn: 346378
2018-10-13[analyzer] Improved cmake configuration for Z3Enrico Steffinlongo
Summary: Enhanced support for Z3 in the cmake configuration of clang; now it is possible to specify any arbitrary Z3 install prefix (CLANG_ANALYZER_Z3_PREFIX) to cmake with lib (or bin) and include folders. Before the patch only in cmake default locations were searched (https://cmake.org/cmake/help/v3.4/command/find_path.html). Specifying any CLANG_ANALYZER_Z3_PREFIX will force also CLANG_ANALYZER_BUILD_Z3 to ON. Removed also Z3 4.5 version requirement since it was not checked, and now Clang works with Z3 4.7 Reviewers: NoQ, george.karpenkov, mikhail.ramalho Reviewed By: george.karpenkov Subscribers: rnkovacs, NoQ, esteffin, george.karpenkov, delcypher, ddcc, mgorny, xazax.hun, szepet, a.sidorin, Szelethus Tags: #clang Differential Revision: https://reviews.llvm.org/D50818 llvm-svn: 344464
2018-10-11[tests] Include Python binding tests in CMake rulesMichal Gorny
Add a new CMake rule check-clang-python to run the Python bindings' test suite, and include it in check-all. Differential Revision: https://reviews.llvm.org/D52840 llvm-svn: 344258
2018-10-11Revert r344241 as it broke multiple bots.Aaron Ballman
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/10814 http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/20613 llvm-svn: 344244
2018-10-11[tests] Include Python binding tests in CMake rulesMichal Gorny
Add a new CMake rule check-clang-python to run the Python bindings' test suite, and include it in check-all. Differential Revision: https://reviews.llvm.org/D52840 llvm-svn: 344241
2018-08-30Remove vestiges of configure buildsystemStephen Kelly
Summary: Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D50738 llvm-svn: 341146
2018-08-20libclang: add install/distribution targets for pythonSaleem Abdulrasool
Add installation support for the python bindings for libclang. Add an additional CMake configuration variable to enumerate the python versions for which the bindings should be installed. This allows for a LLVM/clang distribution to distribute the python bindings for libclang as part of the image. Because the python versions need to be explicitly stated by the user, the default image remains unchanged. llvm-svn: 340228
2018-06-28[CMake] Make bootstrap and compiler-rt depend on cxx-headers.Ahmed Bougacha
Since r334468, we no longer always copy the libcxx headers by virtue of their presence when cmake runs. This makes some of the later stages (compiler-rt, and the bootstrapped stages) depend on them being copied, via the cxx-headers target. Differential Revision: https://reviews.llvm.org/D48700 llvm-svn: 335898
2018-06-21Re-apply: Add python tool to dump and construct header mapsBruno Cardoso Lopes
Header maps are binary files used by Xcode, which are used to map header names or paths to other locations. Clang has support for those since its inception, but there's not a lot of header map testing around. Since it's a binary format, testing becomes pretty much brittle and its hard to even know what's inside if you don't have the appropriate tools. Add a python based tool that allows creating and dumping header maps based on a json description of those. While here, rewrite tests to use the tool and remove the binary files from the tree. This tool was initially written by Daniel Dunbar. Thanks to Stella Stamenova for helping make this work on Windows. Differential Revision: https://reviews.llvm.org/D46485 rdar://problem/39994722 llvm-svn: 335295
2018-06-21Revert "Add python tool to dump and construct header maps"Bruno Cardoso Lopes
This reverts commit fcfa2dd517ec1a6045a81e8247e346d630a22618. Broke bots: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315 http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio llvm-svn: 335196
2018-06-20Add python tool to dump and construct header mapsBruno Cardoso Lopes
Header maps are binary files used by Xcode, which are used to map header names or paths to other locations. Clang has support for those since its inception, but there's not a lot of header map testing around. Since it's a binary format, testing becomes pretty much brittle and its hard to even know what's inside if you don't have the appropriate tools. Add a python based tool that allows creating and dumping header maps based on a json description of those. While here, rewrite tests to use the tool and remove the binary files from the tree. This tool was initially written by Daniel Dunbar. Differential Revision: https://reviews.llvm.org/D46485 rdar://problem/39994722 llvm-svn: 335177
2018-06-11[CMake] Allow specifying extra dependencies of bootstrap stagePetr Hosek
This allows adding additional bootstrap dependencies to the bootstrap compiler that may be needed by later stages. Differential Revision: https://reviews.llvm.org/D47355 llvm-svn: 334437
2018-04-06CMake option to allow enabling experimental new pass manager by defaultPetr Hosek
This CMake flag allows setting the default value for the -f[no]-experimental-new-pass-manager flag. Differential Revision: https://reviews.llvm.org/D44330 llvm-svn: 329366
2018-03-29Rename clang link from clang-X.Y to clang-XSylvestre Ledru
Summary: As we are only doing X.0.Z releases (not using the minor version), there is no need to keep -X.Y in the version. So, instead, I propose the following: Instead of having clang-7.0 in bin/, we will have clang-7 Since also matches was gcc is doing. Reviewers: tstellar, dlj, dim, hans Reviewed By: dim, hans Subscribers: dim, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D41808 llvm-svn: 328769
2018-03-06[FrontEnd] Allow overriding the default C/C++ -std via CMake varsMichal Gorny
Provide two new CMake cache variables -- CLANG_DEFAULT_STD_C and CLANG_DEFAULT_STD_CXX -- that can be used to override the default C/ObjC and C++/ObjC++ standards appropriately. They can be set to one of the identifiers from LangStandards.def, or left unset (the default) to respect the current platform default. This option is mostly intended for compiler vendors that may wish to adjust the defaults their compilers are using. For example, Gentoo planned to use it to set clang and gcc to matching standards, so that we could maintain as much compatibility between different compilers as possible. The code relies on explicit identifiers rather than the string aliases for simplicity. This saves us from the necessity of parsing aliases at build-time or adding additional processing at runtime. For the latter case, it also adds trivial value check -- if incorrect value is passed, the code simply fails to compile through referencing an undefined constant. If the variable is used to redefine the default standard, the explicit value overrides the special case for PS4. It is done this way mostly following other kinds of variables where 'platform defaults' are redefined. Differential Revision: https://reviews.llvm.org/D34365 llvm-svn: 326836
2018-01-19[cmake] Also pass CMAKE_ASM_COMPILER_ID to next stage when bootstrappingDon Hinton
Summary: When setting CMAKE_ASM_COMPILER=clang, we also need to set CMAKE_ASM_COMPILER_ID=Clang. This is needed because cmake won't set CMAKE_ASM_COMPILER_ID if CMAKE_ASM_COMPILER is already set. Without CMAKE_ASM_COMPILER_ID, cmake can't set CMAKE_ASM_COMPILER_OPTIONS_TARGET either, which means CMAKE_ASM_COMPILER_TARGET is ignored, causing cross compiling to fail, i.e., `--target=${CMAKE_ASM_COMPILER_TARGET}` isn't passed. Differential Revision: https://reviews.llvm.org/D42232 llvm-svn: 322977
2017-12-07[OpenMP] NVPTX: Set default/minimum compute capability to sm_35George Rokos
The current implementation of the nvptx runtime (to be upstreamed shortly) uses the atomicMax operation on 64-bit integers. This is only supported in compute capabilities 3.5 and later. I've changed the clang default to sm_35. Differential Revision: https://reviews.llvm.org/D40977 llvm-svn: 320082
2017-12-05[CMake] Don't use comma as an alternate separatorPetr Hosek
Using comma can break in cases when we're passing flags that already use comma as a separator. Fixes PR35504. Differential Revision: https://reviews.llvm.org/D40762 llvm-svn: 319720
2017-11-29[CMake] Support side-by-side checkouts in multi-stage buildPetr Hosek
Passthrough LLVM_ENABLE_{PROJECTS,RUNTIMES} to followup stages to support the side-by-side checkouts (aka monorepo layout). Differential Revision: https://reviews.llvm.org/D40258 llvm-svn: 319267
2017-11-29[CMake] Use LIST_SEPARATOR rather than escaping in ExternalProject_AddPetr Hosek
Escaping ; in list arguments passed to ExternalProject_Add doesn't seem to be working in newer versions of CMake (see https://public.kitware.com/Bug/view.php?id=16137 for more details). Use a custom LIST_SEPARATOR instead which is the officially supported way. Differential Revision: https://reviews.llvm.org/D40257 llvm-svn: 319264
2017-11-17[cmake] Use llvm-lit directory when provided for stand-alone buildMichal Gorny
After the recent lit test changes, clang attempts to run its tests via llvm-lit by default. However, the llvm-lit binary is not present when performing stand-alone build resulting in a failure out of the box. To solve that, add the llvm-lit directory to CMake when performing a stand-alone build and LLVM sources are provided. This includes the CMake rules generating the llvm-lit binary and effectively makes it possible for clang to use it. Differential Revision: https://reviews.llvm.org/D40142 llvm-svn: 318562
2017-11-11Add CLANG_DEFAULT_OBJCOPY to allow Clang to use llvm-objcopy for dwarf fissionJake Ehrlich
llvm-objcopy is getting to where it can be used in non-trivial ways (such as for dwarf fission in clang). It now supports dwarf fission but this feature hasn't been thoroughly tested yet. This change allows people to optionally build clang to use llvm-objcopy rather than GNU objcopy. By default GNU objcopy is still used so nothing should change. Differential Revision: https://reviews.llvm.org/D39029 llvm-svn: 317960
2017-11-04Move the clang-tblgen-targets project into the Misc folder on IDEs like ↵Aaron Ballman
Visual Studio rather than leave it in the root directory. NFC. llvm-svn: 317419
2017-10-17[CMake][OpenMP] Customize default offloading archJonas Hahnfeld
For the shuffle instructions in reductions we need at least sm_30 but the user may want to customize the default architecture. Differential Revision: https://reviews.llvm.org/D38883 llvm-svn: 315996
2017-09-02Don't search libxml2 if using msan. LLVM already has similar check.Vitaly Buka
llvm-svn: 312407
2017-08-27CMake: only try to find the Z3 package when `CLANG_ANALYZER_BUILD_Z3` is ONMehdi Amini
This avoids the spurious message: Could NOT find Z3 (missing: Z3_LIBRARIES Z3_INCLUDE_DIR) (Required is at least version "4.5") llvm-svn: 311858
2017-08-08Integrate Kostya's clang-proto-fuzzer with LLVM.Matt Morehouse
Summary: The clang-proto-fuzzer models a subset of C++ as a protobuf and uses libprotobuf-mutator to generate interesting mutations of C++ programs. Clang-proto-fuzzer has already found several bugs in Clang (e.g., https://bugs.llvm.org/show_bug.cgi?id=33747, https://bugs.llvm.org/show_bug.cgi?id=33749). As with clang-fuzzer, clang-proto-fuzzer requires the following cmake flags: - CMAKE_C_COMPILER=clang - CMAKE_CXX_COMPILER=clang++ - LLVM_USE_SANITIZE_COVERAGE=YES // needed for libFuzzer - LLVM_USE_SANITIZER=Address // needed for libFuzzer In addition, clang-proto-fuzzer requires: - CLANG_ENABLE_PROTO_FUZZER=ON clang-proto-fuzzer also requires the following dependencies: - binutils // needed for libprotobuf-mutator - liblzma-dev // needed for libprotobuf-mutator - libz-dev // needed for libprotobuf-mutator - docbook2x // needed for libprotobuf-mutator - Recent version of protobuf [3.3.0 is known to work] A working version of libprotobuf-mutator will automatically be downloaded and built as an external project. Implementation of clang-proto-fuzzer provided by Kostya Serebryany. https://bugs.llvm.org/show_bug.cgi?id=33829 Reviewers: kcc, vitalybuka, bogner Reviewed By: kcc, vitalybuka Subscribers: thakis, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D36324 llvm-svn: 310408
2017-07-28[CMake] NFC. Add clang-tablegen-targets utility targetChris Bieneman
By creating this target other projects that depend on clang-generated headers (like LLDB) will no longer be order-dependent on Clang being processed by CMake first. Also, by creating a dummy of this target in ClangConfig.cmake, projects that can build against out-of-tree clang can freely depend on the target without needing to have conditionals for if clang is in-tree or out-of-tree. llvm-svn: 309390
2017-07-26Clang and LLVM search for different versions of libxml2, reset foundEric Beckmann
variable before each search so that they don't conflict. llvm-svn: 309189
2017-07-23[Modules] Rework r274270. Let Clang targets depend on intrinsics_gen.NAKAMURA Takumi
This gets rid of almost LLVM targets unconditionally depending on intrinsic_gen. Clang's modules still have weird dependencies and hard to remove intrinsics_gen in better way. Then, it'd be better to give whole clang targets depend on intrinsic_gen. llvm-svn: 308844
2017-07-18[CMake] Move CLANG_ENABLE_(ARCMT|OBJC_REWRITER|STATIC_ANALYZER) into ↵NAKAMURA Takumi
clang/Config/config.h. LLVM_ENABLE_MODULES is sensitive of -D. Move them into config.h. FIXME: It'd be better that they are #cmakedefine01 rather than #cmakedefine. (#if FOO rather than #if defined(FOO)) Then we can find missing #include "clang/Config/config.h" in the future. Differential Revision: https://reviews.llvm.org/D35527 llvm-svn: 308277
2017-05-23[GSoC] Shell autocompletion for clangYuka Takahashi
Summary: This is a first patch for GSoC project, bash-completion for clang. To use this on bash, please run `source clang/utils/bash-autocomplete.sh`. bash-autocomplete.sh is code for bash-completion. Simple flag completion and path completion is available in this patch. Reviewers: teemperor, v.g.vassilev, ruiu, Bigcheese, efriedma Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D33237 llvm-svn: 303670
2017-05-11Fix two-stage build on windows using DistributionExample cmake cacheNAKAMURA Takumi
Thanks to Matthew Larionov <matthewtff@gmail.com> llvm-svn: 302795
2017-04-04[analyzer] Add new Z3 constraint manager backendDominic Chen
Summary: Implement new Z3 constraint manager backend. Reviewers: zaks.anna, dcoughlin, NoQ, xazax.hun Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D28952 llvm-svn: 299463
2017-03-07Define LLVM_ENABLE_WARNINGS when building standalone clang to ensure ↵Eric Fiselier
warnings get enabled llvm-svn: 297106
2017-02-19clang/CMakeLists.txt: Rework r294954 -- use file(TO_CMAKE_PATH).NAKAMURA Takumi
llvm-svn: 295592
2017-02-13Fix r291495 -- Normalize LLVM_CMAKE_PATH in clang standalone build.NAKAMURA Takumi
CMake handles paths with slashes. It caused cmake/install failure on msbuild.exe. Note, Other llvm-config-oriented variables have been normalized since they are stored in the cache attributed with PATH. llvm-svn: 294954
2017-01-25[test] Port clang tests to canonicalized booleansMichal Gorny
Use the new llvm_canonicalize_cmake_booleans() function to canonicalize booleans for lit tests. Replace the duplicate ENABLE_CLANG* variables used to hold canonicalized values with in-place canonicalization. Use implicit logic in Python code to avoid overrelying on exact 0/1 values. Differential Revision: https://reviews.llvm.org/D28529 llvm-svn: 293052
2017-01-18[CMake] Separate LLVM_ENABLE_LTO and LLVM_ENABLE_LLDPetr Hosek
These two are independent: it's possible to use LLD without LTO, and it's possible to do LTO build without LLD. Differential Revision: https://reviews.llvm.org/D28821 llvm-svn: 292343
2017-01-09[cmake] Obtain LLVM_CMAKE_PATH from llvm-configMichal Gorny
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from llvm-config instead of reconstructing it locally. Differential Revision: https://reviews.llvm.org/D26900 llvm-svn: 291495
2016-12-31[clang] Fix clean build of generate-order-fileAlexander Shaposhnikov
This diff fixes the clean build of the target generate-order-file. In llvm/tools/clang/CMakeLists.txt add_subdirectory(utils/perf-training) should go after the block where the value of the variable CLANG_ORDER_FILE is set - otherwise (tested with cmake's version 3.6.2) the arguments of perf-helper.py gen-order-file will be ill-formed (CLANG_ORDER_FILE will be empty). Differential revision: https://reviews.llvm.org/D28153 llvm-svn: 290781
2016-12-14[Driver] Allow setting the default linker during buildPetr Hosek
This change allows setting the default linker used by the Clang driver when configuring the build. Differential Revision: https://reviews.llvm.org/D25263 llvm-svn: 289668
2016-11-16[CMake] Support lld with LTO bootstrapPetr Hosek
lld has LTO support, if requested we should add a dependency on lld rather than LLVMgold when doing LTO bootstrap build. Differential Revision: https://reviews.llvm.org/D26649 llvm-svn: 287179
2016-10-19[CMake] Add clang-bootstrap-deps targetChris Bieneman
Having this target allows other parts of the build system to add to the bootstrap dependencies without needing to be defined before the bootstrap targets are created. This will specifically be used connect the builtins build from the LLVM runtimes directory as a dependency of the next build stage. llvm-svn: 284648
2016-10-18[cmake] Update lit search to match the one in LLVMMichal Gorny
Update the lit search logic to support all names supported in LLVM (since r283029). The search order (i.e. PATHS vs HINTS) does no really matter since the established path is not used, except for determining whether lit is available. Differential Revision: https://reviews.llvm.org/D23745 llvm-svn: 284496