summaryrefslogtreecommitdiffstats
path: root/llvm/cmake/modules/CrossCompile.cmake
Commit message (Collapse)AuthorAgeFilesLines
* [cmake] Pass external project source directories to sub-configuresShoaib Meenai2019-10-171-0/+9
| | | | | | | | | | We're passing LLVM_EXTERNAL_PROJECTS to cross-compilation configures, so we also need to pass the source directories of those projects, otherwise configuration can fail from not finding them. Differential Revision: https://reviews.llvm.org/D69076 llvm-svn: 375157
* [cmake] Convert the NATIVE llvm build process to be project agnosticNathan Lanza2019-07-191-28/+31
| | | | | | | | | lldb recently added a tablegen tool. In order to properly cross compile lldb standalone there needs to be a mechanism to generate the native lldb build, analgous to what's done for the NATIVE llvm build. Thus, we can simply modify this setup to allow for any project to be used. llvm-svn: 366514
* [cmake] Fix bug in r358779 - [CMake] Pass monorepo build settings in cross ↵Don Hinton2019-04-211-2/+7
| | | | | | | | | compile Escape semicolons in the targets list so that cmake doesn't expand them to spaces. llvm-svn: 358859
* [CMake] Pass monorepo build settings in cross compileChris Bieneman2019-04-191-0/+2
| | | | | | | | This allows the cross compiled build targets to configure the LLVM tools and sub-projects that are part of the main build. This is needed for generating native non llvm *-tablegen tools when cross compiling clang in the monorepo build environment. llvm-svn: 358779
* [cmake] Add function for building native toolShoaib Meenai2019-04-021-0/+27
| | | | | | | | | | | | | | | | | | Instead of duplicating functionality for building native versions of tblgen and llvm-config, add a function to set up a native tool build. This will also be used for llvm-nm in a follow-up. This should be NFC for tblgen, besides the slightly different COMMENT for the custom command (it'll display the tablegen target name instead of always saying TableGen). For the native llvm-config, it's a behavior change in that we'll use llvm_ExternalProject_BuildCmd instead of constructing the build command manually, always build in Release, and reference the correct binary path for multi-config generators. I believe all of these changes to be bug fixes. Differential Revision: https://reviews.llvm.org/D60024 llvm-svn: 357486
* [cmake] Pass LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN to NATIVE configureShoaib Meenai2019-02-071-0/+1
| | | | | | | We should propagate this down to host builds so that e.g. people using an optimized tablegen can do the sub-configure successfully. llvm-svn: 353463
* [CMake] Support for cross-compilation when build runtimesPetr Hosek2018-01-081-0/+2
| | | | | | | | | | | 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 llvm-svn: 322046
* [cmake] Pass CMAKE_MAKE_PROGRAM to native configureShoaib Meenai2018-01-081-0/+1
| | | | | | | | | | | If the make program isn't in the path, the native configure will fail. Pass CMAKE_MAKE_PROGRAM to the native configure explicitly to remedy this, similar to what's already done for external project configuration. Explicitly set CMAKE_MAKE_PROGRAM before the user flags so that they can override it for the native build if they desire (though I can't fathom why that would be useful). llvm-svn: 322032
* [cmake] Fix host tools build in when LLVM_EXPERIMENTAL_TARGETS_TO_BUILD is setAlex Bradbury2017-12-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | r320413 triggered cmake configure failures when building with -DLLVM_OPTIMIZED_TABLEGEN=True and with LLVM_EXPERIMENTAL_TARGETS_TO_BUILD set (e.g. to RISCV). This is because that patch moved to passing through LLVM_TARGETS_TO_BUILD, and at that point LLVM_EXPERIMENTAL_TARGETS_TO_BUILD has been merged in to it. LLVM_EXPERIMENTAL_TARGETS_TO_BUILD must be also be passed through to avoid errors like below: -- Constructing LLVMBuild project information CMake Error at CMakeLists.txt:682 (message): The target `RISCV' does not exist. It should be one of AArch64;AMDGPU;ARM;BPF;Hexagon;Lanai;Mips;MSP430;NVPTX;PowerPC;Sparc;SystemZ;X86;XCore -- Configuring incomplete, errors occurred! See the thread http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20171211/509225.html for discussion of this fix. llvm-svn: 320556
* [cmake] Pass TARGETS_TO_BUILD through to host tools buildJustin Bogner2017-12-111-1/+6
| | | | | | | | | | | | | | | | | | | | In r319620, the host build was changed to use Native for TARGETS_TO_BUILD because passing semicolons through add_custom_command is surprisingly difficult. However, Native really doesn't make any sense here, and it only works because we don't technically do any codegen in the host tools so pretty well anything will "work". The problem here is that passing something other than the correct value is very fragile - as evidence note how the llvm-config in the host tools acts differently than the target one now, and misreports the targets to build. Similarly, if there is any logic conditional on the targets in tablegen (now or in the future), it will do the wrong thing. To fix this, we need to escape the semicolons in the targets string and pass it through to the child cmake invocation. llvm-svn: 320413
* [cmake] Make setting of CMAKE_C(XX)_COMPILER flags overridable for cross-buildsPavel Labath2017-12-081-5/+9
| | | | | | | | | | | | | | | | | | | | | | | Summary: r319898 made it possible to override these variables via the CROSS_TOOLCHAIN_FLAGS setting, but this only worked if one explicitly specifies these variables there. If, instead, one uses CROSS_TOOLCHAIN_FLAGS to specify a toolchain file (as our internal builds do, to point cmake to a checked-in toolchain), the CMAKE_C(XX)_COMPILER flags would still win over the ones specified by the toolchain file. To fix is to make the mere presence of these flags overridable. I do this by putting them as a default value for the CROSS_TOOLCHAIN_FLAGS setting, so they can be overridden at cmake configuration time. Reviewers: hintonda, beanz Subscribers: bogner, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D40947 llvm-svn: 320138
* [cmake] Move CMAKE_(C|CXX)_COMPILER variables before CROSS_TOOLCHAIN_FLAGS soDon Hinton2017-12-061-2/+2
| | | | | | | | | | | | | | | | | | | | | they can be overridden when cross compiling. Summary: Since CROSS_TOOLCHAN_FLAGS can set CMAKE_(C|CXX)_COMPILER variables, move the compiler variables up front so they can be overridden. This is a followup to https://reviews.llvm.org/D40229 committed in rL319620. Thanks to Pavel Labath for reporting this issue. Reviewers: labath, beanz Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D40896 llvm-svn: 319898
* [cmake] Re-commit: Remove redundant call to cmake when building host tools.Don Hinton2017-12-021-28/+15
| | | | | | | | | | | | | | | | | Also pass CMAKE_(C|CXX)_COMPILER to add_custom_command. Summary: Remove the redundant, config-time call to cmake when building host tools for cross compiles or optimized tablegen.. The config-time call to cmake is redundant because it will always get called again when the CONFIGURE_LLVM_${target_name} target fires at build-time. This speeds up initial configuration, but has no affect on build behavior. Differential Revision: https://reviews.llvm.org/D40229 llvm-svn: 319620
* [cmake] Revert (rL319574): Resubmit Remove redundant call to cmake when ↵Don Hinton2017-12-011-13/+28
| | | | | | | | | | building host tools. Still fails for some bots. Differential Revision: https://reviews.llvm.org/D40229 llvm-svn: 319582
* [cmake] Resubmit Remove redundant call to cmake when building host tools.Don Hinton2017-12-011-28/+13
| | | | | | | | | | | | | | | | | Only pass Native to LLVM_TARGETS_TO_BUILD. Summary: Remove the redundant, config-time call to cmake when building host tools for cross compiles or optimized tablegen.. The config-time call to cmake is redundant because it will always get called again when the CONFIGURE_LLVM_${target_name} target fires at build-time. This speeds up initial configuration, but has no affect on build behavior. Differential Revision: https://reviews.llvm.org/D40229 llvm-svn: 319574
* Rollback r319176.Don Hinton2017-11-291-13/+28
| | | | | | | The ';' separators in LLVM_TARGETS_TO_BUILD disappear when list variables are evaluated in custom commands. llvm-svn: 319268
* [cmake] Pass LLVM_USE_LINKER flag when building host tools, e.g.,Don Hinton2017-11-281-1/+4
| | | | | | | | LLVM_OPTIMIZED_TABLEGEN=ON, and not crosscompiling. Differential Revision: https://reviews.llvm.org/D39734 llvm-svn: 319228
* [cmake] Remove redundant call to cmake when building host tools.Don Hinton2017-11-281-26/+10
| | | | | | | | | | | | | | | | | | | | | Summary: Remove the redundant, config-time call to cmake when building host tools for cross compiles or optimized tablegen.. The config-time call to cmake is redundant because it will always get called again when the CONFIGURE_LLVM_${target_name} target fires at build-time. This speeds up initial configuration, but has no affect on build behavior. Reviewers: beanz Reviewed By: beanz Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D40229 llvm-svn: 319176
* [CMake] Add custom target to create build directoryJonas Hahnfeld2017-11-081-1/+4
| | | | | | | | | | CMake does a poor job in tracking dependencies on files and directories directly. Create custom target similar to the configuration step. On my system, this avoids the reconfiguration on each build. Differential Revision: https://reviews.llvm.org/D39298 llvm-svn: 317694
* CMake: make LLVM_OPTIMIZED_TABLEGEN friendly with LLVM_EXTERNAL_CLANG_SOURCE_DIRMehdi Amini2016-11-111-0/+5
| | | | | | | | This is need because of clang-tblgen Differential Revision: https://reviews.llvm.org/D26483 llvm-svn: 286560
* [CMake] Fixing a typoChris Bieneman2016-06-081-1/+1
| | | | | | This was called out on the list a long time ago and just got pointed out to me again. Need to fix it before I forget. llvm-svn: 272201
* [CMake] Flag recursive cmake invocations for cross-compileJoseph Tremoulet2015-09-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Cross-compilation uses recursive cmake invocations to build native host tools. These recursive invocations only forward a fixed set of variables/options, since the native environment is generally the default. This change adds -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE to the recursive cmake invocations, so that cmake files can distinguish these recursive invocations from top-level ones, which can explain why expected options are unset. LLILC will use this to avoid trying to generate its build rules in the crosscompile native host target (where it is not needed), which would fail if attempted because LLILC requires a cmake variable passed on the command line, which is not forwarded in the recursive invocation. Reviewers: rnk, beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12679 llvm-svn: 247151
* Refactoring CMake CrossCompile module.Chris Bieneman2015-03-121-33/+55
| | | | | | | | | * put most of the cross-compiling support into a function llvm_create_cross_target_internal. * when CrossCompile is included it still generates a NATIVE target. * llvm_create_cross_target function takes a target_name which should match a toolchain. * llvm_create_cross_target can now be used to target more than one cross-compilation target. llvm-svn: 232067
* Enabling LLVM & Clang to be cross-compiled using CMake from a single ↵Chris Bieneman2014-09-031-0/+33
configuration command line The basic idea is similar to the existing cross compilation support. A directory must be configured to build host versions of tablegen tools and llvm-config. This directory can be user provided (and configured), or it can be created during the build. During a build the native build directory will be configured and built to supply the tablegen tools used during the build. A user could also explicitly provide the tablegen executables to run on the CMake command line. llvm-svn: 217105
OpenPOWER on IntegriCloud