summaryrefslogtreecommitdiff
path: root/cmake/Modules
AgeCommit message (Collapse)Author
2017-01-05[gtest] Teach the sanitizer's custom gtest compilations to disableChandler Carruth
a warning that 'gtest-all.cc' directly triggers in the newer 1.8.0 version. This should fix a warning in folks' build and bring a couple of -Werror bots back to life. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291070 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-12[compiler-rt] Support building builtins for a single targetPetr Hosek
This is used when building builtins for multiple targets as part of LLVM runtimes. Differential Revision: https://reviews.llvm.org/D26653 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@289489 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25Remove a VS 2012 workaround, we require 2015 now.Nico Weber
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@285096 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22cfi: Fixes for check-cfi when configured as an external project.Peter Collingbourne
Differential Revision: https://reviews.llvm.org/D24817 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282189 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21[CMake] Rename back SIMPLE_SOURCE to compile as C++Jonas Hahnfeld
This was changed in rL276151 and causes problems if the C++ compiler does not support the same arches as the C compiler. For the builtins, only the C compiler is tested in try_compile_only. Additionally, -fno-exceptions is passed in (if available) to work around the case where no libunwind is available. Differential Revision: https://reviews.llvm.org/D23654 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282054 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20Revert "[CMake] Explicitly add --target option to compiler flags"Chris Bieneman
This reverts commit r282024. This broke some bots, and I'm going to revert while I figure it out. See: http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/21120 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282033 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20[CMake] Explicitly add --target option to compiler flagsChris Bieneman
Summary: Much of the non-Darwin build system assumes that COMPILER_RT_DEFAULT_TARGET_TRIPLE is the default target triple for the compiler being used. With clang as your compiler this isn't necessarily true. To ensure that the rest of the build system behaves as expected this patch adds "--target=${COMPILER_RT_DEFAULT_TARGET_TRIPLE}" to the compiler flags for C, CXX and ASM sources. Reviewers: compnerd, rengolin, fjricci Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D24156 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282024 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-14[cmake] Support overriding llvm-config query resultsMichal Gorny
Support overriding LLVM_* variables obtained from llvm-config when doing stand-alone builds. The override of LLVM_MAIN_SRC_DIR is necessary to provide LLVM sources when the initial directory used to build LLVM does no longer exist when compiler-rt is built stand-alone. This is especially the case when building the projects separately in temporary directories with unpredictable names. The code is based on existing CMakeLists.txt from clang. Alike clang, it extends the override to all queried variables. Differential Revision: https://reviews.llvm.org/D24005 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281461 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-08Really fix warnings about passing -std=gnu99 to MSVCReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280958 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-07[compiler-rt] Fix library suffixes on windowsFrancis Ricci
Summary: Make sure that windows libraries contain the suffixes expected by clang. This is expecially important when compiling the windows builtins with clang, as cmake will use .a as the suffix by default. Reviewers: beanz, compnerd Subscribers: llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D24046 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280854 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26[CMake] Connect Compiler-RT targets to LLVM Runtimes directoryChris Bieneman
This patch builds on LLVM r279776. In this patch I've done some cleanup and abstracted three common steps runtime components have in their CMakeLists files, and added a fourth. The three steps I abstract are: (1) Add a top-level target (i.e asan, msan, ...) (2) Set the target properties for sorting files in IDE generators (3) Make the compiler-rt target depend on the top-level target The new step is to check if a command named "runtime_register_component" is defined, and to call it with the component name. The runtime_register_component command is defined in llvm/runtimes/CMakeLists.txt, and presently just adds the component to a list of sub-components, which later gets used to generate target mappings. With this patch a new workflow for runtimes builds is supported. The new workflow when building runtimes from the LLVM runtimes directory is: > cmake [...] > ninja runtimes-configure > ninja asan The "runtimes-configure" target builds all the dependencies for configuring the runtimes projects, and runs CMake on the runtimes projects. Running the runtimes CMake generates a list of targets to bind into the top-level CMake so subsequent build invocations will have access to some of Compiler-RT's targets through the top-level build. Note: This patch does exclude some top-level targets from compiler-rt libraries because they either don't install files (sanitizer_common), or don't have a cooresponding `check` target (stats). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279863 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-25[builtins] Make sure builtin compile tests respect CMAKE_C_COMPILER_TARGETFrancis Ricci
Summary: Since we generate the compiler invocation on our own, we need to manually add -target if CMAKE_C_COMPILER_TARGET has been specified. Reviewers: compnerd, beanz Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D23823 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279747 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-22[cmake] Fix append_rtti_flag macro and bad var nameFilipe Cabecinhas
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279450 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19[CMake] Support building on OS X without Xcode installationChris Bieneman
This should resolve PR23162. This patch has two parts. First we need to check the error code from xcodebuild when querying for SDKs, second if the OS X SDK is not discovered, we ensure that /usr/include exists and use / as the OS X sysroot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279336 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19[CMake] Add top-level install-compiler-rt targetChris Bieneman
This is a wrapper target of all the component install targets. This wrapper target will be used by the new LLVM runtimes directory to connect top-level targets to the runtime project target. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279333 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19build: allow building a specific set of sanitizersSaleem Abdulrasool
Introduce a new CMake option `COMPILER_RT_SANITIZERS_TO_BUILD` which takes either a special token `all` (default) which will preserve the current behaviour or a CMake list of sanitizers to build. It will still perform the normal checks if the sanitizer is requested. It only permits a further means to exclude a particular sanitizer. This gives finer grained control than `COMPILER_RT_BUILD_SANITIZERS` which only gives an all or nothing control. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279253 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18[CMake] Stop building eprintf library on DarwinChris Bieneman
In r278988 clang stopped using the eprintf library, so we should stop generating it too. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279090 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12[CMake] If the compiler supports _Atomic include atomic.c in builtins librariesChris Bieneman
This fixes a long-standing TODO by implementing a compiler check for supporting the _Atomic keyword. If the _Atomic keyword is supported by the compiler we should include it in the builtin library sources. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@278454 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02[CMake] Load LLVMConfig for standalone build of builtinsJonas Hahnfeld
Therefore move some code into reusable macros. Differential Revision: https://reviews.llvm.org/D22866 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277418 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01[CMake] Don't trust compiler error code, also check for errorsChris Bieneman
Summary: rnk reported that MSVC ignores unknown flags and still returns 0. This should cause unknown flags to be an error during the compiler check. Reviewers: rnk Subscribers: brad.king, llvm-commits Differential Revision: https://reviews.llvm.org/D23030 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277377 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-22[compiler-rt][cmake] Don't reset CAN_TARGET_${arch} on every cmake invocation.Daniel Sanders
Allowing this variable to be cached makes it possible to repair the MIPS buildbots in lieu of either fixing the mips64 sanitizer issues or fixing the detection of mips64 support (which I think was changed by r268977 but didn't take effect on this buildbot until the last couple days) so that it returns to not being built on these buildbots. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276402 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20[compiler-rt] Fix target architecture matchingFrancis Ricci
Summary: Use stricter comparisons for architecture. This prevents cmake from failing for sysroots which can only compile armhf and not arm, since arm MATCHES armhf is true, while arm STREQUAL armhf is false. Reviewers: beanz, compnerd Subscribers: aemerson, llvm-commits Differential Revision: https://reviews.llvm.org/D22473 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276148 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-11[compiler-rt] Fix VisualStudio virtual folders layoutEtienne Bergeron
Summary: This patch is a refactoring of the way cmake 'targets' are grouped. It won't affect non-UI cmake-generators. Clang/LLVM are using a structured way to group targets which ease navigation through Visual Studio UI. The Compiler-RT projects differ from the way Clang/LLVM are grouping targets. This patch doesn't contain behavior changes. Reviewers: kubabrecka, rnk Subscribers: wang0109, llvm-commits, kubabrecka, chrisha Differential Revision: http://reviews.llvm.org/D21952 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275111 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22[CMake] Converting darwin_test_archs simple source to CChris Bieneman
Using C instead of CXX here removes a configuration-time dependency on libcxx for the sanitizers. This should be NFC. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273505 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21[compiler-rt] Split cflags and link flags to avoid warningsEtienne Bergeron
Summary: The MSVC compiler is complaining about invalid flags. The CFLAGS are passed to the linker (i.e. /Gy-, ...). Reviewers: rnk Subscribers: llvm-commits, kubabrecka, chrisha Differential Revision: http://reviews.llvm.org/D21554 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273265 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09[CMake] Cleanup CMake version checkingChris Bieneman
CMAKE_VERSION is always greater than 3.0 now. No reason not to remove the extra compatibility code. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272315 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-03[CMake] detect_target_arch needs to be moved to UtilsChris Bieneman
This macro is called from the base config, so it can't live in config-ix, it needs to be in the utils. I suspect the only reason this hasn't caused problems is that nobody is building the Android builtins from the builtins subdirectory. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271693 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-16[compiler-rt] Fix multi-configuration output pathsEtienne Bergeron
Summary: When using a multi-configuration build (i.e. MSVC) the output path where libraries are dropped is incorrect. Example: ``` C:\src\llvm\examples>d:\src\llvm\build\Release\bin\clang-cl.exe -fsanitize=address test.cc LINK : fatal error LNK1181: cannot open input file 'd:\src\llvm\build\Release\bin\..\lib\clang\3.9.0\lib\windows\clang_rt.asan-i386.lib' ``` The dropped executable path contains the configuration 'Release': ``` 'd:\src\llvm\build\Release\bin\..\lib\clang\3.9.0\lib\windows\Release\clang_rt.asan-i386.lib' ``` The variable 'RUNTIME_OUTPUT_DIRECTORY' is used to specify the output directory. But CMAKE is appending the current configuration (i.e. Debug, Release). see: https://cmake.org/cmake/help/v3.0/prop_tgt/RUNTIME_OUTPUT_DIRECTORY.html ``` "Multi-configuration generators (VS, Xcode) append a per-configuration subdirectory to the specified directory." ``` To avoid this problem, the configuration specific variable must be set: 'RUNTIME_OUTPUT_DIRECTORY_DEBUG', 'RUNTIME_OUTPUT_DIRECTORY_RELEASE', and so on. Reviewers: ddunbar, chapuni, rnk Subscribers: kubabrecka, llvm-commits Differential Revision: http://reviews.llvm.org/D20261 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269658 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-11[CMake] Cache check results and avoid duplicate checksChris Bieneman
This caches the result of builtin_check_c_compiler_flag, and removes a duplicate check for C99 flag support. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269230 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-03[CMake] NFC. Add support for testing the compiler without testing the linkerChris Bieneman
Summary: One of the big limitations we have in the compiler-rt build system today is that we cannot bootstrap building the builtins because you need a fully functional toolchain to pass CMake's tests. This change adds support for compile only tests. It is NFC because nothing is using the compile-only tests yet. I believe this is the last separable part of D16653. Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19692 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268427 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28[CMake] Adding another missing include. NFC.Chris Bieneman
This also works fine today, but will break with my upcoming refactoring. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267941 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28[CMake] Adding some missing CMake includes. NFC.Chris Bieneman
This happens to be working now because the includes exist in another CMake file that is included before this one. That will change with upcoming refactoring. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267912 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26[CMake] [PR27403] Fix COMPILER_RT_ENABLE_IOS when using Xcode from the App ↵Chris Bieneman
Store. This change modifies find_darwin_sdk_dir to set a variable if a Darwin "Internal" SDK is present which allows CMake to disable components that require internal-only APIs. This mechanism is then used to disable TSan when an internal SDK is not present. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267575 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06Use `CMAKE_HOST_UNIX` to check the host.Sean Silva
`UNIX` is for the target. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@265595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-31[CMake] Provide the ability to skip stripping when generating dSYMsChris Bieneman
For debugging it is useful to be able to generate dSYM files but not strip the executables. This change adds the ability to skip stripping by setting COMPILER_RT_EXTERNALIZE_DEBUGINFO_SKIP_STRIP=On. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@265057 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-17[CMake] Remove bash-ism in SanitizerLintCheckAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263751 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-05[cmake] Address Samsonov's post-commit review of r262723Filipe Cabecinhas
Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D17896 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262770 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26[CMake] Fix a typo in add_compiler_rt_library.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262063 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-23[CMake] Support component-based installation for runtime librariesChris Bieneman
This enables targets like "install-ubsan" and "install-asan" to install all associated runtime libraries. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261700 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-23[CMake] Assign components and dependencies during add_compiler_rt_resource_fileChris Bieneman
This makes it so that component-based installations will include resource files (i.e. blacklists). My next patch will add support for component-based installations. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261699 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17[CMake] [NFC] Move macro definitions out of config-ix.cmakeChris Bieneman
This change should have no functional impact, it just moves some macro definitions out of config-ix.cmake into CompilerRTUtils.cmake. This step will allow these macros to be re-used by the separated builtin build. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261108 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-17[CMake] Push the dependency on AddLLVM into the test and unites layersChris Bieneman
Compiler-rt only relies on LLVM for lit support. Pushing this dependency down into the test and unitest layers will allow builtin libraries to be built without LLVM. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261105 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02[compiler-rt] add_custom_libcxx should pass LLVM_PATH and a C++ compilerDaniel Sanders
Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16681 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259493 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-02[asan] Add iOS support.Anna Zaks
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259451 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-01[CMake] Use LLVM_MAIN_SRC_DIR instead of LLVM_SOURCE_DIR.Alexey Samsonov
The former will be properly initialized in standalone CMake build of compiler-rt. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@259407 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-27[compiler-rt] list_union() is actually an intersect operation. Rename it.Daniel Sanders
Summary: Given: set(T1 a b c) set(T2 b c d) message("T1=${T1}") message("T2=${T2}") list_union(T3 T1 T2) message("T3=${T3}") cmake emitted: T1=a;b;c T2=b;c;d T3=b;c Reviewers: beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16580 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@258916 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14Fix the cross compilation of unit tests. NFC (second attempt)Sumanth Gundapaneni
With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling environment, the unit tests fail to link. This patch does the following changes >Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the way it's used. >Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to build/compile the unit tests >Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to link the unit tests (if needed) Differential Revision: http://reviews.llvm.org/D16165 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257783 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13Revert r257686 "With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross ↵Hans Wennborg
compiling" This broke the build. For example, from http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/1191/steps/cmake%20stage%201/logs/stdio: -- Compiler-RT supported architectures: aarch64 CMake Error at projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:170 (string): string sub-command REPLACE requires at least four arguments. Call Stack (most recent call first): projects/compiler-rt/lib/CMakeLists.txt:4 (include) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257694 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-13With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compilingSumanth Gundapaneni
environment, the unit tests fail to link. This patch does the following changes >Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the way it's used. >Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to build/compile the unit tests >Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that cross-compiler would be able to link the unit tests (if needed) Differential Revision:http://reviews.llvm.org/D15082 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257686 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-08[cmake] Indentation fix (NFC)Vedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257118 91177308-0d34-0410-b5e6-96231b3b80d8