Commit Graph

43 Commits

Author SHA1 Message Date
Petr Hosek
6cfc1adc32 [CMake] Pass Clang defaults to runtimes builds
This enables the use of Clang default options from runtimes CMake files.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332923 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-22 00:43:04 +00:00
Chris Bieneman
e605bbd4c5 [CMake] Support runtimes in distributions
Summary:
This patch adds a new internal variable
LLVM_RUNTIME_DISTRIBUTION_COMPONENTS which specifies distribution
components that are part of runtime projects, and thus should be exposed
from runtime configuraitons up into the top-level CMake configurations.

This is required for allowing runtime components to be included in
LLVM_DISTRIBUTION_COMPONENTS because we verify that the build and
install targets exist for every component specified for the
distribution.

Without this patch runtimes and builtins can only be included in
distributions in whole, not by component.

Reviewers: phosek

Reviewed By: phosek

Subscribers: mgorny, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332631 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-17 16:58:44 +00:00
Kostya Kortchinsky
bd3f6f82e4 [CMake] Enable warnings for runtimes
Summary:
`HandleLLVMOptions` adds `-w` to the cflags if `LLVM_ENABLE_WARNINGS` is not on.
With `-w`, `check_cxx_compiler_flag` doesn't error out for unsupported flags
(for example `-mcrc` on x86_64), and those flags end up being detected as
working - and really they aren't.

I am not entirely sure what the best way to solve this is, but setting
`LLVM_ENABLE_WARNINGS` prior to including `HandleLLVMOptions` does the job.

Reviewers: phosek, beanz

Reviewed By: phosek

Subscribers: mgorny, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331042 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-27 15:10:50 +00:00
Petr Hosek
84029d7c96 [CMake][runtimes] Process common options in runtimes build
This was removed in D39932 but turned out this is actually needed
because runtimes such as compiler-rt and libc++ rely on common options
processing for setting certain flags such as -ffunction-sections and
-fdata-sections.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329778 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-11 05:18:03 +00:00
Petr Hosek
f5a4b47201 [CMake] Support for cross-compilation when build runtimes
When cross-compiling, we cannot use the just built toolchain, instead
we need to use the host toolchain which we assume has a support for
targeting the selected target platform. We also need to pass the path
to the native version of llvm-config to external projects.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322046 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-08 23:50:59 +00:00
Shoaib Meenai
91bceea7d9 [runtimes] Add install-*-stripped targets
These should be the only remaining missing install-*-stripped targets.
They're modeled after the existing install targets.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320182 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-08 19:42:46 +00:00
Petr Hosek
567f85d531 [CMake][runtimes] Support monorepo layout with runtimes build
We introduce a new variable LLVM_ENABLE_RUNTIMES which works
similarly to LLVM_ENABLE_PROJECTS and allows specifying runtimes
that will be enabled in the runtimes build.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319107 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-27 22:31:11 +00:00
Petr Hosek
8e87d92d1d [CMake][runtimes] Don't passthrough prefixes for non-default targets
The passthrough is useful for setting up the options for the default
build, but we already have a different mechanism to pass CMake flags
to builds for builtins and runtimes targets so this is not really
needed there. Furthermore, when the flags are set for the default
build, with the prefix passthrough set we have to explicitly override
all options in other targets which can be cumbersome.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318571 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17 23:51:53 +00:00
Petr Hosek
681627dd81 [CMake][runtimes] Use cmake_parse_arguments in runtimes functions
Passing lists to functions in CMake is tricky, any list argument
has to be quoted otherwise it'll be expanded. To avoid this issue,
use cmake_parse_arguments in runtime functions and pass lists using
a keyword argument which eliminates any ambiguity when dealing with
lists.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318457 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16 21:28:54 +00:00
Petr Hosek
cace43159e [CMake][runtimes] Don't process common options in runtimes build
This is no longer needed for any of the runtimes build and it breaks
in case we don't have the working compiler yet, e.g. when building
a compiler that uses compiler-rt and libc++ as a default runtime,
because these common options check whether these are available.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318227 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-14 23:56:05 +00:00
Petr Hosek
6dc7825247 [CMake][runtimes] Set compiler as working even for default target
Even when building builtins and runtimes for the default target
we shouldn't assume that the just built compiler is already useable.
When the compiler uses compiler-rt and libc++ as the default runtime
and C++ library, it won't be usable until we finish building runtimes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318224 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-14 23:47:20 +00:00
Petr Hosek
1ef4dcad1c [CMake][runtimes] Fix the variable name
This typo causes the llvm-lit path resolution to fail.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317742 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08 23:44:27 +00:00
Petr Hosek
9efaebecaa [CMake][runtimes] Use the same configuration for non-target and "default" target
The default host target for builtins and runtimes has special behavior
on some platforms, e.g. on Linux both i386 and x86_64 targets are being
built. Specifying "default" as a target name should lead to the same
behavior, which wasn't the case in the past. This patch unifies the
configuration between the non-target and "default" target to produce the
same behavior by moving the default configuration into a function that
can be used from both paths.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312831 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-08 22:26:50 +00:00
Petr Hosek
4f10103672 [CMake][runtimes] Use target specific name for all runtimes targets
We need to use target specific name for all runtimes targets. Target
specific name means the name of target in the LLVM build is different
from the name in runtimes build (in LLVM build, it's suffixed by the
target itself). Previously we have only used target specific names for
check targets collected through SUB_CHECK_TARGETS, but that's not
sufficient, we need to use target specific names for all targets we're
exposing in LLVM build.

Fixes PR34335.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312405 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-02 02:28:03 +00:00
Leo Li
59cb965ee9 [CMake] Add more runtime configurations.
Summary:
- `project` is required when `runtime/CMakeList.txt` is the top-level `CMakeList.txt` file. This will establish version and policy settings.

- `-D_FILE_OFFSET_BITS=64` should never be set for Android runtimes.

Reviewers: srhines, pirama, beanz

Subscribers: llvm-commits, srhines, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312302 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-01 01:05:59 +00:00
Petr Hosek
f7b0497d81 [CMake][runtimes] Support for building target variants
This can be used to build non-sanitized and sanitized versions of
runtimes, where sanitized versions use the just built sanitizer
which in turn may use the non-sanitized version.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311036 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-16 19:13:45 +00:00
Leo Li
c37f42c5b8 [CMake] Remove redundant logic in runtimes/CMakeList.txt
Summary:
`SUB_CHECK_TARGETS` contains all test targets in `SUB_COMPONENTS` when
we load `Components.cmake`. We don't need to add those targets
again and having duplicate targets will break the cmake policy CMP0002.

Reviewers: phosek

Subscribers: mgorny, llvm-commits, srhines, pirama

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308900 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-24 17:26:28 +00:00
Petr Hosek
5212269bc2 [CMake] Set toolchain tools in cross-target runtimes build
This is needed for runtimes build to work on Darwin.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308359 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18 20:54:02 +00:00
Leo Li
c0e7d7e6da [CMake]Use LLVM_LIBRARY_DIR for lib path.
Summary:
This makes sure the correct lib path is being used when `CMAKE_CFG_INTDIR` or
`LLVM_LIBDIR_SUFFIX` is set.

Reviewers: beanz

Subscribers: mgorny, srhines, pirama, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307985 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14 00:35:21 +00:00
Petr Hosek
39247cb1d1 [CMake] Support multi-target runtimes build
This changes adds support for building runtimes for multiple
different targets using LLVM runtimes directory.

The implementation follow the model used already by the builtins
build which already supports this option. To specify the runtimes
targets to be built, use the LLVM_RUNTIME_TARGETS variable, where
the valuae is the list of targets to build runtimes for. To pass
a per target variable to the runtimes build, you can set
RUNTIMES_<target>_<variable> where <variable> will be passed to the
runtimes build for <target>.

Each runtime target (except for the default one) will be installed
into lib/<target> subdirectory. Build targets will be suffixed with
the target name.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307731 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 23:41:15 +00:00
George Karpenkov
3b0bb78b4e Remove circular dependency from runtimes/CMakeLists
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307605 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 00:48:00 +00:00
George Karpenkov
3b8d30db1d [CMake] Dependencies for tests in "runtimes"
Many of the test cases in the runtimes require LLVM's testing tools, to
facilitate this working as expected we need to have all the test targets
in the runtimes depend on all LLVM testing tools used in the runtimes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307572 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-10 19:23:28 +00:00
Petr Hosek
e84c1d83ad [CMake][runtimes] Add install target for runtimes builtins
This adds an install-builtins target to avoid having to list all
builtins targets explicitly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304587 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-02 19:38:11 +00:00
Petr Hosek
ed85367738 [CMake][runtimes] Use -nodefaultlibs for the runtimes build
We may not have a working C++ standard library at this point so we
shouldn't rely on it when running CMake checks.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300260 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-13 21:29:03 +00:00
Petr Hosek
85005dd1d4 [CMake] Support single target builtins build on Darwin
This change allows cross-compiling compiler-rt builtins for
multiple targets as part of runtimes on Darwin. This functionality
is already supported on other platforms.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298678 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-24 02:21:11 +00:00
Petr Hosek
3d91fe7c1a [CMake] Provide an option to disable runtimes build
This could be used to either disable the runtimes build altogether
or avoid building them but still generate the build targets.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298653 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-23 22:40:10 +00:00
Petr Hosek
8548be38d1 [CMake] Handle common options for runtimes build
All the existing runtimes relies on flags which are set by AddLLVM
and HandleLLVMOptions. In the standalone case, they would include
these themselves, but when being built using LLVM runtimes we should
include these in the top-level runtimes CMake files.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291590 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10 19:47:05 +00:00
Chris Bieneman
677ee43225 [CMake] Set HAVE_${runtime} before including any subdirectories
This should allow us to avoid most order dependence in the runtime library configurations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290834 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-02 20:33:33 +00:00
Petr Hosek
a923c5a134 [CMake] Multi-target builtins build
This change enables building builtins for multiple different targets
using LLVM runtimes directory.

To specify the builtin targets to be built, use the LLVM_BUILTIN_TARGETS
variable, where the value is the list of targets.  To pass a per target
variable to the builtin build, you can set BUILTINS_<target>_<variable>
where <variable> will be passed to the builtin build for <target>.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289491 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-12 23:15:10 +00:00
Chris Bieneman
43fa064b8c [CMake] Make the runtimes directory work with bootstrap builds
This patch builds on clang r284648, and allows the runtime directory to make the bootstrap builds depend on the builtin libraries.

This patch also make the bootstrap build depend on configuring the other runtimes because the libcxx headers are copied during configuration. I have left a TODO in the code to remove that once I come up with a better solution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284650 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 21:50:25 +00:00
Jonas Hahnfeld
f158709ee5 [CMake] Fixing lit for runtimes directory
Copy variable LLVM_BUILD_MAIN_SRC_DIR from LLVMConfig.cmake to
LLVM_MAIN_SRC_DIR as it is named for in-tree builds. This ensures that
add_lit_target() can reliably find llvm-lit which is not necessarily
in the PATH.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281585 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-15 06:14:13 +00:00
Chris Bieneman
816c475854 [CMake] Connecting check-all and test-depends targets correctly
My previous attempt at this connected the sub-project check targets to the test-depends target instead of to the check-all target. That resulted in the tests running multiple times on bots that built "test-depends" and "check-all" in separate build invocations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280392 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-01 18:26:01 +00:00
Chris Bieneman
3449d54601 [CMake] Ensure that compiler-rt is added first
This will enable other runtime projects to detect the presence of sanitizer runtimes by referring to the sanitizer targets directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280162 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-30 21:29:21 +00:00
Chris Bieneman
6aad1fb5e9 [CMake] Builtins build needs LLVM_*_OUTPUT_INTDIR variables
This allows the builtins archives to build into the correct subdirectory under the binary dir. Addresses the issue discussed in D24001.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280002 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-29 20:18:52 +00:00
Chris Bieneman
4ec9567b37 [CMake] Only generate Components.cmake if components are specified
Generating the Components import file is useless if there are no components coming in from the runtimes configuration, so we should skip generation in that case.

This also should fix the configuration error that Renato reported on llvm-dev.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279893 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-27 00:19:51 +00:00
Chris Bieneman
cf9a1e3c7d [CMake] Expose runtime component check targets
This will expose the check targets for runtime project components into the top-level build. It will enable exposing targets like check-asan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279861 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26 20:34:11 +00:00
Chris Bieneman
7921d70074 [CMake] Fixing LLVM_INCLUDE_TESTS for runtimes directory
We need to explicitly pass LLVM_INCLUDE_TESTS through from the top-level to the runtimes configuration because it isn't in LLVMConfig.cmake

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279857 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-26 20:08:57 +00:00
Chris Bieneman
3e8e88eddd [CMake] Add support for exposing runtime targets
This patch adds support to the runtimes build for exposing sub-project targets through the high-level configuration. This will enable exposing the build, check and install targets for sub-project components (i.e. asan, check-asan, install-asan...).

This patch requires minor changes to the runtime projects to take advantage of it, and I'll phase those changes into Compiler-RT shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279776 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-25 20:49:51 +00:00
Chris Bieneman
774da3752b Hooking up a check-all target for the runtimes projects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279756 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-25 17:18:41 +00:00
Chris Bieneman
67f56cc4e4 [CMake] Add variables for tracking which runtimes are included
This allows sub-projects to have conditionals based on the presence of other projects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279172 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 22:18:11 +00:00
Chris Bieneman
26b922023e [CMake] Create convenience targets for runtime projects
Each runtime project has a top-level target that is the name of the runtime (minus the "lib" prefix if applicable). This creates top-level targets mapping to runtime projects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279160 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 21:47:18 +00:00
Chris Bieneman
85a2cffca4 [CMake] Make llvm-config implicit dependency for subprojects
The subproject interface being used for runtime libraries expects that llvm-config is passed into the subproject for consumption. We currently do this for every subproject, so we should expect that all LLVM ExternalProjects depend on llvm-config for the time being.

Eventually I'd like to see the sub-projects using LLVMConfig.cmake instead of the llvm-config binary, but that will take time to roll out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279155 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-18 21:41:21 +00:00
Chris Bieneman
f444c52628 [CMake] Add LLVM runtimes directory
Summary:
There are a few LLVM projects that produce runtime libraries. Ideally
runtime libraries should be built differently than other projects,
specifically they should be built using the just-built toolchain.

There is support for building compiler-rt in this way from the clang
build. Moving this logic into the LLVM build is interesting because it
provides a simpler way to extend the just-built toolchain to include
LLD and the LLVM object file tools.

Once this functionality is better fleshed out and tested we’ll want to
encapsulate it in a module that can be used for clang standalone
builds, and we’ll want to make it the default way to build compiler-rt.

With this patch applied there is no immediate change in the build.
Moving compiler-rt out from llvm/projects into llvm/runtimes enables
the functionality.

This code has a few improvements over the method provided by
LLVM_BUILD_EXTERNAL_COMPILER_RT. Specifically the sub-ninja command is
always invoked, so changes to compiler-rt source files will get built
properly, so this patch can be used for iterative development with
just-built tools.

This first patch only works with compiler-rt. Support for other
runtime projects will be coming in follow-up patches.

Reviewers: chandlerc, bogner

Subscribers: kubabrecka, llvm-commits

Differential Revision: http://reviews.llvm.org/D20992

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273620 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 22:07:21 +00:00