aboutsummaryrefslogtreecommitdiff
path: root/flang/cmake
AgeCommit message (Collapse)AuthorFilesLines
2022-08-16[flang] Install runtime libs with the toolchainDiana Picus1-2/+3
Make sure that FortranDecimal, FortranRuntime and Fortran_main are installed/packaged even when LLVM_INSTALL_TOOLCHAIN_ONLY is enabled. They are used by flang to link executables, so they should be provided even with minimal installs. Differential Revision: https://reviews.llvm.org/D131670 (cherry picked from commit 467abac2046d037f8d4cf428e76b77e5b06c187f)
2022-07-26[CMake] Fix add_subdirectory llvm buildsSebastian Neubauer1-1/+1
Fixes a regression from D117973, that used CMAKE_BINARY_DIR instead of LLVM_BINARY_DIR in some places. Differential Revision: https://reviews.llvm.org/D130555
2022-07-25[cmake] Support custom package install pathsJohn Ericson1-6/+11
Firstly, we we make an additional GNUInstallDirs-style variable. With NixOS, for example, this is crucial as we want those to go in `${dev}/lib/cmake` not `${out}/lib/cmake` as that would a cmake subdir of the "regular" libdir, which is installed even when no one needs to do any development. Secondly, we make *Config.cmake robust to absolute package install paths. We for NixOS will in fact be passing them absolute paths to make the `${dev}` vs `${out}` distinction mentioned above, and the GNUInstallDirs-style variables are suposed to support absolute paths in general so it's good practice besides the NixOS use-case. Thirdly, we make `${project}_INSTALL_PACKAGE_DIR` CACHE PATHs like other install dirs are. Reviewed By: sebastian-ne Differential Revision: https://reviews.llvm.org/D117973
2022-07-21[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymoreJohn Ericson1-2/+2
First of all, `LLVM_TOOLS_INSTALL_DIR` put there breaks our NixOS builds, because `LLVM_TOOLS_INSTALL_DIR` defined the same as `CMAKE_INSTALL_BINDIR` becomes an *absolute* path, and then when downstream projects try to install there too this breaks because our builds always install to fresh directories for isolation's sake. Second of all, note that `LLVM_TOOLS_INSTALL_DIR` stands out against the other specially crafted `LLVM_CONFIG_*` variables substituted in `llvm/cmake/modules/LLVMConfig.cmake.in`. @beanz added it in d0e1c2a550ef348aae036d0fe78cab6f038c420c to fix a dangling reference in `AddLLVM`, but I am suspicious of how this variable doesn't follow the pattern. Those other ones are carefully made to be build-time vs install-time variables depending on which `LLVMConfig.cmake` is being generated, are carefully made relative as appropriate, etc. etc. For my NixOS use-case they are also fine because they are never used as downstream install variables, only for reading not writing. To avoid the problems I face, and restore symmetry, I deleted the exported and arranged to have many `${project}_TOOLS_INSTALL_DIR`s. `AddLLVM` now instead expects each project to define its own, and they do so based on `CMAKE_INSTALL_BINDIR`. `LLVMConfig` still exports `LLVM_TOOLS_BINARY_DIR` which is the location for the tools defined in the usual way, matching the other remaining exported variables. For the `AddLLVM` changes, I tried to copy the existing pattern of internal vs non-internal or for LLVM vs for downstream function/macro names, but it would good to confirm I did that correctly. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D117977
2022-06-10Revert "[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymore"John Ericson1-2/+2
This reverts commit d5daa5c5b091cafb9b7ffd19b5dfa2daadef3229.
2022-06-10[cmake] Don't export `LLVM_TOOLS_INSTALL_DIR` anymoreJohn Ericson1-2/+2
First of all, `LLVM_TOOLS_INSTALL_DIR` put there breaks our NixOS builds, because `LLVM_TOOLS_INSTALL_DIR` defined the same as `CMAKE_INSTALL_BINDIR` becomes an *absolute* path, and then when downstream projects try to install there too this breaks because our builds always install to fresh directories for isolation's sake. Second of all, note that `LLVM_TOOLS_INSTALL_DIR` stands out against the other specially crafted `LLVM_CONFIG_*` variables substituted in `llvm/cmake/modules/LLVMConfig.cmake.in`. @beanz added it in d0e1c2a550ef348aae036d0fe78cab6f038c420c to fix a dangling reference in `AddLLVM`, but I am suspicious of how this variable doesn't follow the pattern. Those other ones are carefully made to be build-time vs install-time variables depending on which `LLVMConfig.cmake` is being generated, are carefully made relative as appropriate, etc. etc. For my NixOS use-case they are also fine because they are never used as downstream install variables, only for reading not writing. To avoid the problems I face, and restore symmetry, I deleted the exported and arranged to have many `${project}_TOOLS_INSTALL_DIR`s. `AddLLVM` now instead expects each project to define its own, and they do so based on `CMAKE_INSTALL_BINDIR`. `LLVMConfig` still exports `LLVM_TOOLS_BINARY_DIR` which is the location for the tools defined in the usual way, matching the other remaining exported variables. For the `AddLLVM` changes, I tried to copy the existing pattern of internal vs non-internal or for LLVM vs for downstream function/macro names, but it would good to confirm I did that correctly. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D117977
2022-05-16[flang] Install Fortran_main libraryDiana Picus1-2/+2
At the moment the Fortran_main library is not installed, so it cannot be found by the driver when run from an install directory. This patch fixes the issue by replacing llvm_add_library with add_flang_library, which already contains all the proper incantations for installing a library. It also enhances add_flang_library to support a STATIC arg which forces the library to be static even when BUILD_SHARED_LIBS is on. Differential Revision: https://reviews.llvm.org/D124759 Co-authored-by: Dan Palermo <Dan.Palermo@amd.com>
2022-01-07[CMake] Factor out config prefix finding logicJohn Ericson1-10/+2
See the docs in the new function for details. I think I found every instance of this copy pasted code. Polly could also use it, but currently does something different, so I will save the behavior change for a future revision. We get the shared, non-installed CMake modules following the pattern established in D116472. It might be good to have LLD and Flang also use this, but that would be a functional change and so I leave it as future work. Reviewed By: beanz, lebedev.ri Differential Revision: https://reviews.llvm.org/D116521
2021-12-31[flang] Use `GNUInstallDirs` to support custom installation dirs.John Ericson2-3/+6
Extracted from D99484. My new plan is to start from the outside and work inward. Reviewed By: stephenneuendorffer Differential Revision: https://reviews.llvm.org/D115569
2021-10-01[flang] Revert 3 commits pushed by mistake along ↵Jean Perier1-2/+2
b7c07ce15ffe6da9dcd69d457a3eca987452edc7 Revert "[flang][NFC] Add debug dump method to evaluate::Expr and semantics::Symbol" This reverts commit b0e35fde21ecb47799603e1acfc9ffa7b83dea13. Revert "[flang] Add a wrapper for Fortran main program" This reverts commit 2c1ce0755e09909c41db93845c4c3f42457cb9c8. Revert "[flang][NFC] Fix header comments in some runtime headers" This reverts commit a63f57674d511eb287edbabad9674c6298cf8b84.
2021-10-01[flang] Add a wrapper for Fortran main programJean Perier1-2/+2
Add a C wrapper that calls the Fortran runtime initialization and finalization routines as well as the compiled Fortran main program _QQmain. Place it in its own library to satisfy shared library builds since it contains a C main function. - https://github.com/flang-compiler/f18-llvm-project/commit/cc7ac498f916d32a9b197d3ace816f4de5d36aad#diff-fa35a5efa62731fd2845e5e982eca9a2e36439783e11a4e4a463753c2160ec10R53 - was created in flang/test/Examples/main.c in Eric's branch
2021-05-12[cmake] Add support for multiple distributionsShoaib Meenai3-24/+8
LLVM's build system contains support for configuring a distribution, but it can often be useful to be able to configure multiple distributions (e.g. if you want separate distributions for the tools and the libraries). Add this support to the build system, along with documentation and usage examples. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D89177
2021-02-11[flang] Fix typo in FlangConfig.cmake.in.Leandro Vaz1-1/+1
`find_package(Flang)` does not work as there is a missing `@` in the FlangConfig.cmake.in file. This patch fixes the issue. Reviewed By: thopre Differential Revision: https://reviews.llvm.org/D96484
2020-10-14[flang] Make flang build compatible with LLVM dylibSerge Guelton1-1/+0
Harmonize usage of LLVM components througout Flang. Explicit LLVM Libs where used across several CMakeFIles, which led to incompatibilities with LLVM shlibs. Fortunately, the LLVM component system can be relied on to harmoniously handle both cases. Differential Revision: https://reviews.llvm.org/D87893
2020-04-16[flang] Use the Flang cmake-functions to add targets.Mehdi Chinoune1-1/+0
Summary: It also removes the cycle-dependency between FortranSemantics and FortranEvaluate. Reviewers: #flang, jdoerfert, sscalpone Reviewed By: #flang, sscalpone Subscribers: DavidTruby, schweitz, tskeith, mgorny, aartbik, llvm-commits Tags: #flang, #llvm Differential Revision: https://reviews.llvm.org/D78215
2020-03-26[flang] A rework of the cmake build components for in and out of tree builds.Patrick McCormick3-0/+228
In general all the basic functionality seems to work and removes some redundancy and more complicated features in favor of borrowing infrastructure from LLVM build configurations. Here's a quick summary of details and remaining issues: * Testing has spanned Ubuntu 18.04 & 19.10, CentOS 7, RHEL 8, and MacOS/darwin. Architectures include x86_64 and Arm. Without access to Window nothing has been tested there yet. * As we change file and directory naming schemes (i.e., capitalization) some odd things can occur on MacOS systems with case preserving but not case senstive file system configurations. Can be painful and certainly something to watch out for as any any such changes continue. * Testing infrastructure still needs to be tuned up and worked on. Note that there do appear to be cases of some tests hanging (on MacOS in particular). They appear unrelated to the build process. * Shared library configurations need testing (and probably fixing). * Tested both standalone and 'in-mono repo' builds. Changes for supporting the mono repo builds will require LLVM-level changes that are straightforward when the time comes. * The configuration contains a work-around for LLVM's C++ standard mode passing down into Flang/F18 builds (i.e., LLVM CMake configuration would force a -std=c++11 flag to show up in command line arguments. The current configuration removes that automatically and is more strict in following new CMake guidelines for enforcing C++17 mode across all the CMake files. * Cleaned up a lot of repetition in the command line arguments. It is likely that more work is still needed to both allow for customization and working around CMake defailts (or those inherited from LLVM's configuration files). On some platforms agressive optimization flags (e.g. -O3) can actually break builds due to the inlining of templates in .cpp source files that then no longer are available for use cases outside those source files (shows up as link errors). Sticking at -O2 appears to fix this. Currently this CMake configuration forces this in release mode but at the cost of stomping on any CMake, or user customized, settings for the release flags. * Made the lit tests non-source directory dependent where appropriate. This is done by configuring certain test shell files to refer to the correct paths whether an in or out of tree build is being performed. These configured files are output in the build directory. A %B substitution is introduced in lit to refer to the build directory, mirroring the %S substitution for the source directory, so that the tests can refer to the configured shell scripts. Co-authored-by: David Truby <david.truby@arm.com> Original-commit: flang-compiler/f18@d1c7184159b2d3c542a8f36c58a0c817e7506845 Reviewed-on: https://github.com/flang-compiler/f18/pull/1045
2018-02-14[flang] Revert "Schauveau cmake"Steve Scalpone4-269/+0
Original-commit: flang-compiler/f18@be33dc182a9bcfa664095886ca62b3b1db4eb797 Reviewed-on: https://github.com/flang-compiler/f18/pull/7
2018-02-09[flang] Add new global CMakefile infrastructure with examplesStephane Chauveau4-0/+269
Original-commit: flang-compiler/f18@81b91f327052cd0596e96af9c33b2d0e221d10f5 Reviewed-on: https://github.com/flang-compiler/f18/pull/6 Tree-same-pre-rewrite: false