summaryrefslogtreecommitdiffstats
path: root/compiler-rt/cmake/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* [CMake] Explicitly add --target option to compiler flagsChris Bieneman2016-09-201-0/+12
| | | | | | | | | | | | | | | 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 llvm-svn: 282024
* [cmake] Support overriding llvm-config query resultsMichal Gorny2016-09-141-4/+9
| | | | | | | | | | | | | | | | 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 llvm-svn: 281461
* Really fix warnings about passing -std=gnu99 to MSVCReid Kleckner2016-09-081-2/+3
| | | | llvm-svn: 280958
* [compiler-rt] Fix library suffixes on windowsFrancis Ricci2016-09-071-2/+8
| | | | | | | | | | | | | | | 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 llvm-svn: 280854
* [CMake] Connect Compiler-RT targets to LLVM Runtimes directoryChris Bieneman2016-08-261-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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). llvm-svn: 279863
* [builtins] Make sure builtin compile tests respect CMAKE_C_COMPILER_TARGETFrancis Ricci2016-08-251-1/+7
| | | | | | | | | | | | | | 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 llvm-svn: 279747
* [cmake] Fix append_rtti_flag macro and bad var nameFilipe Cabecinhas2016-08-221-1/+1
| | | | llvm-svn: 279450
* [CMake] Support building on OS X without Xcode installationChris Bieneman2016-08-191-2/+6
| | | | | | | | 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. llvm-svn: 279336
* [CMake] Add top-level install-compiler-rt targetChris Bieneman2016-08-191-0/+1
| | | | | | 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. llvm-svn: 279333
* build: allow building a specific set of sanitizersSaleem Abdulrasool2016-08-191-0/+12
| | | | | | | | | | | 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. llvm-svn: 279253
* [CMake] Stop building eprintf library on DarwinChris Bieneman2016-08-181-26/+0
| | | | | | In r278988 clang stopped using the eprintf library, so we should stop generating it too. llvm-svn: 279090
* [CMake] If the compiler supports _Atomic include atomic.c in builtins librariesChris Bieneman2016-08-121-3/+20
| | | | | | 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. llvm-svn: 278454
* [CMake] Load LLVMConfig for standalone build of builtinsJonas Hahnfeld2016-08-021-0/+54
| | | | | | | | Therefore move some code into reusable macros. Differential Revision: https://reviews.llvm.org/D22866 llvm-svn: 277418
* [CMake] Don't trust compiler error code, also check for errorsChris Bieneman2016-08-011-1/+13
| | | | | | | | | | | | 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 llvm-svn: 277377
* [compiler-rt][cmake] Don't reset CAN_TARGET_${arch} on every cmake invocation.Daniel Sanders2016-07-221-10/+12
| | | | | | | | | | 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. llvm-svn: 276402
* [compiler-rt] Fix target architecture matchingFrancis Ricci2016-07-201-1/+1
| | | | | | | | | | | | | | | 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 llvm-svn: 276148
* [compiler-rt] Fix VisualStudio virtual folders layoutEtienne Bergeron2016-07-111-24/+34
| | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 275111
* [CMake] Converting darwin_test_archs simple source to CChris Bieneman2016-06-221-3/+3
| | | | | | Using C instead of CXX here removes a configuration-time dependency on libcxx for the sanitizers. This should be NFC. llvm-svn: 273505
* [compiler-rt] Split cflags and link flags to avoid warningsEtienne Bergeron2016-06-212-1/+3
| | | | | | | | | | | | | | 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 llvm-svn: 273265
* [CMake] Cleanup CMake version checkingChris Bieneman2016-06-091-15/+1
| | | | | | CMAKE_VERSION is always greater than 3.0 now. No reason not to remove the extra compatibility code. llvm-svn: 272315
* [CMake] detect_target_arch needs to be moved to UtilsChris Bieneman2016-06-031-0/+34
| | | | | | 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. llvm-svn: 271693
* [compiler-rt] Fix multi-configuration output pathsEtienne Bergeron2016-05-161-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 269658
* [CMake] Cache check results and avoid duplicate checksChris Bieneman2016-05-111-7/+9
| | | | | | This caches the result of builtin_check_c_compiler_flag, and removes a duplicate check for C99 flag support. llvm-svn: 269230
* [CMake] NFC. Add support for testing the compiler without testing the linkerChris Bieneman2016-05-033-13/+81
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 268427
* [CMake] Adding another missing include. NFC.Chris Bieneman2016-04-281-0/+2
| | | | | | This also works fine today, but will break with my upcoming refactoring. llvm-svn: 267941
* [CMake] Adding some missing CMake includes. NFC.Chris Bieneman2016-04-281-0/+3
| | | | | | 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. llvm-svn: 267912
* [CMake] [PR27403] Fix COMPILER_RT_ENABLE_IOS when using Xcode from the App ↵Chris Bieneman2016-04-261-0/+2
| | | | | | | | | | 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. llvm-svn: 267575
* Use `CMAKE_HOST_UNIX` to check the host.Sean Silva2016-04-061-1/+1
| | | | | | `UNIX` is for the target. llvm-svn: 265595
* [CMake] Provide the ability to skip stripping when generating dSYMsChris Bieneman2016-03-311-1/+5
| | | | | | 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. llvm-svn: 265057
* [CMake] Remove bash-ism in SanitizerLintCheckAlexey Samsonov2016-03-171-1/+1
| | | | llvm-svn: 263751
* [cmake] Address Samsonov's post-commit review of r262723Filipe Cabecinhas2016-03-051-3/+8
| | | | | | | | | | Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D17896 llvm-svn: 262770
* [CMake] Fix a typo in add_compiler_rt_library.Alexey Samsonov2016-02-261-1/+1
| | | | llvm-svn: 262063
* [CMake] Support component-based installation for runtime librariesChris Bieneman2016-02-231-2/+38
| | | | | | This enables targets like "install-ubsan" and "install-asan" to install all associated runtime libraries. llvm-svn: 261700
* [CMake] Assign components and dependencies during add_compiler_rt_resource_fileChris Bieneman2016-02-231-2/+5
| | | | | | 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. llvm-svn: 261699
* [CMake] [NFC] Move macro definitions out of config-ix.cmakeChris Bieneman2016-02-171-0/+54
| | | | | | | | 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. llvm-svn: 261108
* [CMake] Push the dependency on AddLLVM into the test and unites layersChris Bieneman2016-02-171-1/+0
| | | | | | 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. llvm-svn: 261105
* [compiler-rt] add_custom_libcxx should pass LLVM_PATH and a C++ compilerDaniel Sanders2016-02-021-1/+2
| | | | | | | | | | Reviewers: samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16681 llvm-svn: 259493
* [asan] Add iOS support.Anna Zaks2016-02-021-1/+1
| | | | llvm-svn: 259451
* [CMake] Use LLVM_MAIN_SRC_DIR instead of LLVM_SOURCE_DIR.Alexey Samsonov2016-02-011-2/+2
| | | | | | | The former will be properly initialized in standalone CMake build of compiler-rt. llvm-svn: 259407
* [compiler-rt] list_union() is actually an intersect operation. Rename it.Daniel Sanders2016-01-273-5/+5
| | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 258916
* Fix the cross compilation of unit tests. NFC (second attempt)Sumanth Gundapaneni2016-01-141-4/+7
| | | | | | | | | | | | | | | | 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 llvm-svn: 257783
* Revert r257686 "With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross ↵Hans Wennborg2016-01-131-7/+4
| | | | | | | | | | | | | | | 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) llvm-svn: 257694
* With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compilingSumanth Gundapaneni2016-01-131-4/+7
| | | | | | | | | | | | | | | 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 llvm-svn: 257686
* [cmake] Indentation fix (NFC)Vedant Kumar2016-01-081-1/+1
| | | | llvm-svn: 257118
* [cmake] Add InstrProfilingWriter to libclang_rt on DarwinVedant Kumar2016-01-071-1/+2
| | | | | | | | | llvmBufferWriter and a few related symbols were missing from libclang_rt on Darwin (PR26002). This should fix the problem. Patch by Dan Peebles! llvm-svn: 257110
* Revert "[CMake] Provide options for toggling on and off various runtime ↵Chris Bieneman2015-12-101-19/+0
| | | | | | | | libraries." This reverts r255170. This change caused a bunch of bot failures and needs to be revised. llvm-svn: 255184
* [CMake] [Darwin] Log architecture test failures to CMakeError.logChris Bieneman2015-12-101-0/+4
| | | | | | This makes debugging configuration issues way easier. llvm-svn: 255183
* [CMake] Provide options for toggling on and off various runtime libraries.Chris Bieneman2015-12-091-0/+19
| | | | | | | | | | | | | | | Summary: Rather than having to add new "experimental" options each time someone wants to work on bringing a sanitizer to a new platform, this patch makes options for all of them. The default values for the options are set by the platform checks that would have enabled them, but they can be overridden on or off. Reviewers: kubabrecka, samsonov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D14846 llvm-svn: 255170
* [CMake] CMake calls to set_property with APPEND string need to have a ↵Chris Bieneman2015-12-031-1/+1
| | | | | | leading space. llvm-svn: 254660
* [CMake] set_target_properties doesn't append link flagsChris Bieneman2015-12-031-1/+1
| | | | | | This fixes a bug I introduced in r254643. llvm-svn: 254658
OpenPOWER on IntegriCloud