Commit graph

91 commits

Author SHA1 Message Date
Matt Arsenault
6b98f82fe9
cmake: Derive CMake system name from a triple via new mechanism (#208773) 2026-08-01 09:41:32 +02:00
Douglas Yung
6af0a79d7a
Bump version to 24.0.0git (#209473) 2026-07-14 09:21:03 -04:00
Hans Wennborg
5eb8007046
Revert "Reapply "runtimes: Pass CMAKE_SYSTEM_NAME based on target triple" (#205133) (#205522)" (#208644)
The change broke the runtimes build for Android; see discussion on the
PR. There are fixes in progress, but let's revert to unbreak the tree
until all those are ready to land.

This reverts commit 00b2f81418 and the
follow-up commit 1008b485e4.
2026-07-10 08:58:58 +00:00
Matt Arsenault
00b2f81418
Reapply "runtimes: Pass CMAKE_SYSTEM_NAME based on target triple" (#205133) (#205522)
This reverts commit 08c728e852.

Reapply after runtimes build fixes on platforms without shared
libraries.
2026-07-08 16:47:31 +02:00
Matt Arsenault
885ef9daac
[runtimes] Don't create shared library targets when unsupported (#205517)
On platforms that don't support shared libraries (e.g. CMAKE_SYSTEM_NAME
of "Generic", used for GPU and other baremetal targets), CMake's
Platform/Generic.cmake sets the global TARGET_SUPPORTS_SHARED_LIBS
property to FALSE. Under CMP0164's OLD behavior (the default, since the runtimes 
set cmake_minimum_required(3.20)), CMake silently demotes SHARED library
targets to STATIC archives. libcxx, libcxxabi and libunwind always create their
shared target, so after demotion both the shared and static targets emit e.g.
"libc++abi.a" and Ninja fails with "multiple rules generate ...".

Rather than papering over the collision with a distinct output name,
skip creating the shared library targets entirely when the platform does not
support them, gating on the TARGET_SUPPORTS_SHARED_LIBS property (left 
undefined on platforms that do support shared libraries). The few consumers of 
the shared targets are guarded with TARGET checks so they fall back to the static
library or are skipped.

Also set policy CMP0164 to NEW so that any future unguarded
add_library(... SHARED ...) on an unsupported platform fails at
configure time instead of silently producing a colliding static archive.

See https://gitlab.kitware.com/cmake/cmake/-/issues/25759.

The bodies of the newly-conditional blocks are left at their original
indentation to keep this diff minimal. A follow-up commit will fix the
indentation. This was mostly AI generated with some comment fixups.

Co-authored-by: Claude (Opus 4.8) <noreply@anthropic.com>
2026-06-29 17:53:09 +02:00
Nikolas Klauser
44546e0e32
[libc++] Enable clang-tidy in the CI again (#195047)
clang-tidy currently doesn't run in the CI because CMake doesn't find
the appropriate `ClangConfig.cmake` anymore. This adds the path so
clang-tidy is built again and fixes most issues. Some things are
disabled for now to get most checks back. They will be re-enabled later.
2026-06-25 09:11:33 +02:00
Matt Arsenault
08c728e852
Revert "runtimes: Pass CMAKE_SYSTEM_NAME based on target triple" (#205133)
Reverts llvm/llvm-project#203504

Breaks build pending #205130
2026-06-22 18:30:29 +02:00
Matt Arsenault
6e4e181c83
runtimes: Pass CMAKE_SYSTEM_NAME based on target triple (#203504)
Compute the cmake system name from the target triple, rather
than passing through the host's. This is primarily to stop
forwarding OSX specific cmake variables.

This fixes build failures when trying to build gpu libc on mac
hosts. Previously it would fail on several issues, starting with
an unused argument -mmacos-version-min error, followed by other
errors caused by passing -isysroot.

Secondarily, restrict the cmake imported targets when cross compiling.
Without this, the amdgpu build prints many cmake warnings about the
target not supporting shared libraries.

Claude did most of the actual work, though it required quite a few
rounds of prodding to get it into the right place. In particular it
took care of handling all of the cmake platform recognized names from
the triple.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-22 16:32:46 +02:00
Jameson Nash
7daddf2b6f
[docs] try again to handle doxygen everywhere (#203081)
The previous attempt at this (b7da956501)
still broke standalone builds. Now I have locally tested standalone
flang, runtimes (with openmp), lldb, combined builds, and the utils
script. Hopefully that covers everything this time, and gets everything
into a more consistent state (always using the HandleDoxygen script in
the same way, included exactly once as required by the cmake design).
2026-06-11 08:58:36 -04:00
Jameson Nash
b7da956501
[docs] update CI to use latest release of doxygen (#202420)
Resubmitting https://github.com/llvm/llvm-project/pull/191501 for
review, with added https://github.com/llvm/llvm-project/pull/202404 for
SHA checksum verification and fix for cmake target name conflicts.
Tested with `./llvm/utils/release/build-docs.sh -no-sphinx` locally.

Co-authored-by: Aiden Grossman <aidengrossman@google.com>
2026-06-10 10:25:33 -04:00
Jameson Nash
50088e2275
Revert "[docs] update CI to use latest release of doxygen" (#202412)
Reverts llvm/llvm-project#191501 as cmake CI is having an issue with it:

```
-- Doxygen enabled (1.14.0).
CMake Error at /work/as-worker-4/publish-doxygen-docs/llvm-project/cmake/Modules/HandleDoxygen.cmake:29 (add_custom_target):
  add_custom_target cannot create target "doxygen" because another target
  with the same name already exists.  The existing target is a custom target
  created in source directory
  "/work/as-worker-4/publish-doxygen-docs/llvm-project/llvm".  See
  documentation for policy CMP0002 for more details.
Call Stack (most recent call first):
  docs/CMakeLists.txt:59 (include)
```
2026-06-08 15:28:03 -04:00
Jameson Nash
2eed192c21
[docs] update CI to use latest release of doxygen (#191501)
Previously this was likely 1.9.8, with the Ubuntu 24.04 worker. Now this
is 1.17.0. This is a fix for
https://discourse.llvm.org/t/many-doxygen-links-are-broken/83809/2.

Fixes 3 significant issues for LLVM:

- `dot` execution performance is very slow (cuts this half hour step
down to mere seconds). https://github.com/doxygen/doxygen/pull/12037
- multi-thread performance is very slow (worse than single threading),
and now uses all cores for ncpu times speedup (when using version with
fix, autodetected by cmake).
https://github.com/doxygen/doxygen/pull/12027
- file links for IR.cpp and similar files were wrong
https://github.com/doxygen/doxygen/pull/11944

Assisted-by: Claude Code
2026-06-08 13:17:05 -04:00
Michael Kruse
8e132f78bf
[runtimes][CMake] Move Fortran support code from flang-rt (#171610)
Common CMake code to be used by flang-rt and openmp to emit Flang module
files. Most of the code is not yet used within this PR.

Extracted out of #171515 for review by @petrhosek.
2026-04-21 10:58:43 +00:00
Michael Kruse
1f75f318ae
[Runtimes] Gracefully handle invalid LLVM_TARGET_TRIPLE (#190284)
In some situations such as reported at
https://github.com/llvm/llvm-project/pull/177953#issuecomment-4179014239,
LLVM_(DEFAULT_)TARGET_TRIPLE is not set. It is used to derive the output
directory in #177953. Only flang-rt currently uses
RUNTIMES_(INSTALL|OUTPUT)_RESOURCE_LIB_PATH, we should not fail building
other despite a missing LLVM_TARGET_TRIPLE.

Compiler-rt uses COMPILER_RT_DEFAULT_TARGET_TRIPLE instead which it
derives itself. Most other LLVM runtimes libraries just skip the target
portion of the library path (explicitly so since #93354). Do the same
for RUNTIMES_(INSTALL|OUTPUT)_RESOURCE_LIB_PATH which we hope eventually
can replace the other mechanisms.
2026-04-02 23:32:42 +00:00
Michael Kruse
afb80bddf1
[Runtimes] Introduce variables containing resource dir paths (#177953)
Introduce common infrastructure for runtimes that determines compiler
resource path locations. These variables introduced are:

 * RUNTIMES_OUTPUT_RESOURCE_DIR
 * RUNTIMES_INSTALL_RESOURCE_PATH
 
That contain the location for the compiler resource path (typically
`lib/clang/<version>`) in the build tree and the install tree (the
latter relative to CMAKE_INSTALL_PREFIX).

Additionally, define

 * RUNTIMES_OUTPUT_RESOURCE_LIB_DIR
 * RUNTIMES_INSTALL_RESOURCE_LIB_PATH

as for the location of clang/flang version-locked libraries (typically
`lib${LLVM_LIBDIR_SUFFIX}/<targer-triple>`, but also depends on `APPLE`
and `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR`). This code is moved from
flang-rt and initially becomes its only user.

Refactored out of #171610 as requested
[here](https://github.com/llvm/llvm-project/pull/171610#discussion_r2687382481).

Extracted `get_runtimes_target_libdir_common` from compiler-rt as
requested
[here](https://github.com/llvm/llvm-project/pull/171610#discussion_r2689565634).
 
Added TODO comments to all runtimes as requested
[here](https://github.com/llvm/llvm-project/pull/171610#issuecomment-3789598635).
2026-04-02 10:32:14 +00:00
Michael Kruse
6367c4bae0 [cmake][NFC] CRLF -> LF 2026-01-21 23:14:07 +01:00
Michael Kruse
50638e01e4
[runtimes] Share doxygen handling with LLVM (#176948)
Hoist handling of Doxygen into the top-level cmake/ directory so it can
be shared between LLVM and RUNTIMES and a default/standalone runtimes
build can support building Doxygen documentation as well.

The openmp subproject currently supports doxygen documentation using an
`LLVM_ENABLE_PROJECTS=openmp` build, but not with
`LLVM_ENABLE_RUNTIMES=openmp` because of this missing boilerplate code
in the runtimes build. This is a step towards removing the
`LLVM_ENABLE_PROJECTS=openmp` build mode which was deprecated (#124014)
and already scheduled to be removed in LLVM 21 (#136314). Eventual
removal is planned with #176950.

Hoisting CMake code for shared use with runtimes has been done before in
e.g. #84641, 7017e6c9cf,
44e3365775,
7017e6c9cf

---------

Co-authored-by: Petr Hosek <phosek@google.com>
2026-01-21 12:38:31 +01:00
Cullen Rhodes
bd6bfba3e5 Bump version to 23.0.0-git 2026-01-13 09:34:22 +00:00
Argyrios Kyrtzidis
b91add86a2
[FindGRPC.cmake] Make sure that PACKAGE_VERSION is not overwritten when doing find_package(gRPC) (#173115)
`PACKAGE_VERSION` is important since it sets the `LLVM_VERSION_STRING`
string.
2025-12-19 22:18:07 -08:00
Michael Kruse
d233e787f0 Revert "[Flang] Move builtin .mod generation into runtimes (Reapply #137828) (#169638)"
This reverts commit 7675fc79c8.

Requested in PR:
https://github.com/llvm/llvm-project/pull/169638#issuecomment-3634227707
2025-12-09 22:39:41 +01:00
Michael Kruse
7675fc79c8
[Flang] Move builtin .mod generation into runtimes (Reapply #137828) (#169638)
Reapplication of #137828, changes:
* Workaround CMAKE_Fortran_PREPROCESS_SOURCE issue for CMake < 2.24: The
issue is that `try_compile` does not forward manually-defined compiler
flang variables to the test build environment; instead of just a
negative test result, it aborts the configuration step itself. To be
fair, manually defining these variables is deprecated since at least
CMake 3.6.
* Missing flang cmd line flags for CMake < 3.28 `-target=`, `-O2`, `-O3`
* It is now possible to set FLANG_RT_ENABLED_STATIC=OFF and
FLANG_RT_ENABLE_SHARED=OFF at the same and is the default for amdgpu and
nvptx targets. In this mode, only the .mod files are compiled --
necessary for module files in
lib/clang/22/finclude/flang/(nvptx64-nvidia-cuda|amdgpu-amd-amdhsa)/*.mod
to be available.
* For compiling omp_lib.mod for nvptx and amdgpu, the module build
functionality must be hoisted out if openmp's runtime/ directory which
is only included for host targets. This PR now requires #169909.
 

Move building the .mod files from openmp/flang to openmp/flang-rt using
a shared mechanism. Motivations to do so are:

1. Most modules are target-dependent and need to be re-compiled for each
target separately, which is something the LLVM_ENABLE_RUNTIMES system
already does. Prime example is `iso_c_binding.mod` which encodes the
target's ABI. Constants such as [`c_long_double` also have different
values](d748c81218/flang-rt/lib/runtime/iso_c_binding.f90 (L77-L81)).
Most other modules have `#ifdef`-enclosed code as well. For instance
this caused offload targets nvptx64-nvidia-cuda/amdgpu-amd-amdhsa to use
the modules files compiled for the host which may contrain uses of the
types REAL(10) or REAL(16) not available for nvptx/amdgpu.

#146876
#128015
#129742
#158790

3. CMake has support for Fortran that we should use. Among other things,
it automatically determines module dependencies so there is no need to
hardcode them in the CMakeLists.txt.

4. It allows using Fortran itself to implement Flang-RT. Currently, only
`iso_fortran_env_impl.f90` emits object files that are needed by Fortran
applications (#89403). The workaround of #95388 could be reverted (PR
#169525).


If using Flang for cross-compilation or target-offloading, flang-rt must
now be compiled for each target not only for the library, but also to
get the target-specific module files. For instance in a bootstrapping
runtime build, this can be done by adding:
`-DLLVM_RUNTIME_TARGETS=default;nvptx64-nvidia-cuda;amdgpu-amd-amdhsa`.


Some new dependencies come into play:
* openmp depends on flang-rt for building `lib_omp.mod` and
`lib_omp_kinds.mod`. Currently, if flang-rt is not found then the
modules are not built.
* check-flang depends on flang-rt: If not found, the majority of tests
are disabled. If not building in a bootstrpping build, the location of
the module files can be pointed to using
`-DFLANG_INTRINSIC_MODULES_DIR=<path>`, e.g. in a flang-standalone
build. Alternatively, the test needing any of the intrinsic modules
could be marked with `REQUIRES: flangrt-modules`.
* check-flang depends on openmp: Not a change; tests requiring
`lib_omp.mod` and `lib_omp_kinds.mod` those are already marked with
`openmp_runtime`.

As intrinsic are now specific to the target, their location is moved
from `include/flang` to `<resource-dir>/finclude/flang/<triple>`. The
mechnism to compute the location have been moved from flang-rt
(previously used to compute the location of `libflang_rt.*.a`) to common
locations in `cmake/GetToolchainDirs.cmake` and
`runtimes/CMakeLists.txt` so they can be used by both, openmp and
flang-rt. Potentially the mechnism could also be shared by other
libraries such as compiler-rt.

`finclude` was chosen because `gfortran` uses it as well and avoids
misuse such as `#include <flang/iso_c_binding.mod>`. The search location
is now determined by `ToolChain` in the driver, instead of by the
frontend. Another subdirectory `flang` avoids accidental inclusion of
gfortran-modules which due to compression would result in
user-unfriendly errors. Now the driver adds `-fintrinsic-module-path`
for that location to the frontend call (Just like gfortran does).
`-fintrinsic-module-path` had to be fixed for this because ironically it
was only added to `searchDirectories`, but not
`intrinsicModuleDirectories_`. Since the driver determines the location,
tests invoking `flang -fc1` and `bbc` must also be passed the location
by llvm-lit. This works like llvm-lit does for finding the include dirs
for Clang using `-print-file-name=...`.
2025-12-09 12:54:26 +01:00
Jan Patrick Lehr
4bc654d649
Revert "[Flang] Move builtin .mod generation into runtimes" (#169489)
Reverts llvm/llvm-project#137828

Buildbot error in
https://lab.llvm.org/staging/#/builders/105/builds/37275
2025-11-25 13:54:27 +01:00
Michael Kruse
86fbaef99a
[Flang] Move builtin .mod generation into runtimes (#137828)
Move building the .mod files from openmp/flang to openmp/flang-rt using
a shared mechanism. Motivations to do so are:

1. Most modules are target-dependent and need to be re-compiled for each
target separately, which is something the LLVM_ENABLE_RUNTIMES system
already does. Prime example is `iso_c_binding.mod` which encodes the
target's ABI. Most other modules have `#ifdef`-enclosed code as well.

2. CMake has support for Fortran that we should use. Among other things,
it automatically determines module dependencies so there is no need to
hardcode them in the CMakeLists.txt.

3. It allows using Fortran itself to implement Flang-RT. Currently, only
`iso_fortran_env_impl.f90` emits object files that are needed by Fortran
applications (#89403). The workaround of #95388 could be reverted.


Some new dependencies come into play:
* openmp depends on flang-rt for building `lib_omp.mod` and
`lib_omp_kinds.mod`. Currently, if flang-rt is not found then the
modules are not built.
* check-flang depends on flang-rt: If not found, the majority of tests
are disabled. If not building in a bootstrpping build, the location of
the module files can be pointed to using
`-DFLANG_INTRINSIC_MODULES_DIR=<path>`, e.g. in a flang-standalone
build. Alternatively, the test needing any of the intrinsic modules
could be marked with `REQUIRES: flangrt-modules`.
* check-flang depends on openmp: Not a change; tests requiring
`lib_omp.mod` and `lib_omp_kinds.mod` those are already marked with
`openmp_runtime`.

As intrinsic are now specific to the target, their location is moved
from `include/flang` to `<resource-dir>/finclude/flang/<triple>`. The
mechnism to compute the location have been moved from flang-rt
(previously used to compute the location of `libflang_rt.*.a`) to common
locations in `cmake/GetToolchainDirs.cmake` and
`runtimes/CMakeLists.txt` so they can be used by both, openmp and
flang-rt. Potentially the mechnism could also be shared by other
libraries such as compiler-rt.

`finclude` was chosen because `gfortran` uses it as well and avoids
misuse such as `#include <flang/iso_c_binding.mod>`. The search location
is now determined by `ToolChain` in the driver, instead of by the
frontend. Now the driver adds `-fintrinsic-module-path` for that
location to the frontend call (Just like gfortran does).
`-fintrinsic-module-path` had to be fixed for this because ironically it
was only added to `searchDirectories`, but not
`intrinsicModuleDirectories_`. Since the driver determines the location,
tests invoking `flang -fc1` and `bbc` must also be passed the location
by llvm-lit. This works like llvm-lit does for finding the include dirs
for Clang using `-print-file-name=...`.
2025-11-25 10:33:58 +01:00
Steven Wu
2b135b9313
[CMake][gRPC] Update FindGRPC.cmake to support newer gRPC versions (#162935)
Update the logic to find gRPC to always favor CMake `find_package`
implementation including for builds on macOS that uses homebrew, where
gRPCConfig.cmake is also installed to provide an accurate target
dependencies to link against.

This fixes the problem that newer gRPC version has broken up the
libraries into smaller pieces and the hard coded list of libraries in
the implementation can no longer work.

Fixes: https://github.com/llvm/llvm-project/issues/59844
2025-10-15 13:14:14 -07:00
David Tenty
94738ddaf4
[CMake][AIX] Enable CMP0182: Create shared library archives by default (#155686)
On AIX we prefer to create shared libraries as shared library archives
(i.e. we archive the shared object in a big AR archive) as this is the
standard format on the platform.

There is now a CMake policy that allows us to do this by default, so
opt-in to that behaviour.

---------

Co-authored-by: Hubert Tong <hubert.reinterpretcast@gmail.com>
2025-08-28 09:29:27 -04:00
William Huynh
0b1639581a
[libc] Change LIBC_THREAD_LOCAL to be dependent on LIBC_THREAD_MODE (#151527)
When single-threaded mode is selected, all instances of the keyword
`LIBC_THREAD_LOCAL` are stubbed out, similar to how it currently works
on the GPU. This allows baremetal builds to avoid using thread_local.

However, libcxx uses shared headers, so we need to be careful there.
Thankfully, there is already an option to disable multithreading in
libcxx, so a flag is added such that single-threaded mode is propagated
down to libc.
2025-08-06 15:04:26 +01:00
Tobias Hieta
01f36b39bd Bump version to 22.0.0-git 2025-07-15 16:03:12 +02:00
Peter Collingbourne
71d4c9ce70
cmake: Allow CLANG_RESOURCE_DIR to be absolute.
Currently an absolute CLANG_RESOURCE_DIR is treated as being relative
to bin. Fix that by using cmake_path(APPEND) to append the path to bin.

The prepending of PREFIX is left as-is because callers passing PREFIX
are usually forming a path within the build directory and would not
want build products to be written to an absolute resource directory
that is likely to be an installation prefix. One exception is the caller
in lldb/cmake/modules/LLDBStandalone.cmake; for now it is not possible
to build LLDB with an absolute resource directory until the users are
disambiguated.

Reviewers: petrhosek

Reviewed By: petrhosek

Pull Request: https://github.com/llvm/llvm-project/pull/145996
2025-06-27 16:04:35 -07:00
Aiden Grossman
2f08927fd5 Reland "[CMake] Do not set CMP0116 explicitly to old (#90385)"
This reverts commit fa65a228f4.

This relands commit ab405fb6e9.

There was an issue where CMake versions <3.23.0 would not properly parse
dep files, causing the build to file. This patch fixes that by just
making CMake versions <3.23.0 use the fallback behavior.
2025-04-26 17:59:41 +00:00
Aiden Grossman
fa65a228f4 Revert "[CMake] Do not set CMP0116 explicitly to old (#90385)"
This reverts commit ab405fb6e9.

This caused quite a few buildbot failures that need further
investigation.
2025-04-26 04:51:16 +00:00
Aiden Grossman
ab405fb6e9
[CMake] Do not set CMP0116 explicitly to old (#90385)
CMP0116 was originally set to old to get rid of warnings. However, this
behavior is now set to new by default with the minimum CMake version
that LLVM requires so does not produce any warnings, and setting it
explicitly to old does produce a warning in newer CMake versions. Due to
these reasons, remove this check for now.

Splitting off from removing the CMP0114 check just in case something
breaks.

Partially fixes #83727.
2025-04-25 21:29:59 -07:00
Nikita Popov
2fbfbf499e
[cmake] Resolve symlink when finding install prefix (#124743)
When determining the install prefix in LLVMConfig.cmake etc resolve
symlinks in CMAKE_CURRENT_LIST_FILE first. The motivation for this is to
support symlinks like `/usr/lib64/cmake/llvm` to
`/usr/lib64/llvm19/lib/cmake/llvm`. This only works correctly if the
paths are relative to the resolved symlink.

It's worth noting that this *mostly* already works out of the box,
because cmake automatically does the symlink resolution when the library
is found via CMAKE_PREFIX_PATH. It just doesn't happen when it's found
via the default prefix path.
2025-03-18 14:48:40 +01:00
Michał Górny
ed57ab0c2b
[cmake] Move FindLibcCommonUtils to shared cmake, to fix standalone builds (#131586)
Move `FindLibcCommonUtils` from LLVM's CMake module directory to the
shared top-level CMake directory, as the module is intended to be used
from within the source tree rather than the installed LLVM version. This
fixes standalone offload builds after #131205.
2025-03-17 08:00:09 -05:00
Tom Stellard
3bd3e06f3f
Bump version to 21.0.0git (#124870)
Also clear the release notes.
2025-01-28 19:48:43 -08:00
Raul Tambre
505e049aa0
[CMake] Enable CMP0179 alongside CMP0156 for deduplication on LLD (#116497)
LLD has a bug regarding ordering of static link libraries in the ELF backend, which has been reported as #116669.
CMake 3.31.0 started properly deduplicating static libraries for LLD causing the following linking failure for `libclang-cpp.so` with `-DLLVM_LINK_LLVM_DYLIB=ON`:
```
ld.lld: error: undefined symbol: llvm::omp::getOpenMPClauseName(llvm::omp::Clause)
>>> referenced by OpenMPKinds.cpp
>>>               tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/OpenMPKinds.cpp.o:(clang::getOpenMPSimpleClauseTypeName(llvm::omp::Clause, unsigned int))
>>> referenced by SemaOpenMP.cpp
>>>               tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o:(clang::SemaOpenMP::CheckOMPRequiresDecl(clang::SourceLocation, llvm::ArrayRef<clang::OMPClause*>))
>>> referenced by SemaOpenMP.cpp
>>>               tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o:(clang::SemaOpenMP::CheckOMPRequiresDecl(clang::SourceLocation, llvm::ArrayRef<clang::OMPClause*>))
>>> referenced 166 more times

[tons more]
```

CMake 3.31 also introduced CMP0179, which builds on CMP0156 and makes the deduplication consistent across platforms.
By coincidence this works around the above LLD deficiency and is the fix that CMake 3.31.1 will implement.
However, the fix is to ignore CMP0156 unless CMP0179 is also enabled, i.e. no more deduplication.
So enable CMP0179 to keep the benefits of deduplication from CMP0156 on LLD and fix the build for CMake 3.31.0.

See: #116669
See: https://gitlab.kitware.com/cmake/cmake/-/issues/26447
Fixes: cb90d5b
2024-11-21 21:33:40 +02:00
Evan Wilde
cb90d5b3ef
[CMake] Enable CMP0156 if available (#115046)
Some linkers do not require that libraries are repeated on the command
line. The Apple linker emits warnings when duplicate libraries are
specified, resulting in a wall of warnings.

CMP0156 deduplicates libraries on the command line when the linker
doesn't require them.

This patch enables CMP0156 to quiet the warnings when using a version of
CMake that recognizes it (CMake 3.29 and newer).
2024-11-06 10:34:48 -08:00
Louis Dionne
6127724786
[cmake] Remove obsolete files, docs and CMake variables related to the standalone build (#112741)
The runtimes used to support a build mode called the "Standalone build",
which isn't supported anymore (and hasn't been for a few years).
However, various places in the code still contained stuff whose only
purpose was to support that build mode, and some outdated documentation.
This patch cleans that up (although I probably missed some).

- Remove HandleOutOfTreeLLVM.cmake which isn't referenced anymore
- Remove the LLVM_PATH CMake variable which isn't used anymore
- Update some outdated documentation referencing standalone builds
2024-11-04 17:53:38 -05:00
Louis Dionne
cb445e8d1d
[cmake] Promote message when failing to find compiler-rt to warning (#111834)
This makes the message stand out a bit more, which can be helpful to
debug situations where compiler-rt is missing but shouldn't.
2024-10-24 10:27:51 -04:00
Aiden Grossman
49de154165
[CMake] Do not set CMP0114 explicitly to old (#90384)
CMP0114 was originally set to old to get rid of warnings. However, this
behavior is now set to new by default with the minimum CMake version
that LLVM requires so does not produce any warnings, and setting it
explicitly to old does produce a warning in newer CMake versions. Due to
these reasons, remove this check for now.

Splitting off from removing the CMP0116 check just in case something
breaks.

Partially fixes #83727.
2024-10-15 23:15:05 -07:00
c8ef
cf9fc5e22f
[CMake] enable CMP0147 policy if available (#109150)
Closes #38383.

This enables parallel custom build commands, which improve compilation
time on Windows with Visual Studio.
2024-09-24 23:30:31 +03:00
Petr Hosek
26a4edf655
[CMake][compiler-rt] Support for using compiler-rt atomic library (#106603)
Not every toolchain provides and want to use libatomic which is a part
of GCC, some toolchains may opt into using compiler-rt atomic library.
2024-09-03 10:28:49 -07:00
h-vetinari
89946bda5e
[cmake] switch to CMake's native check_{compiler,linker}_flag (#96171)
Broken out from #93429

Somewhat closing the loop opened by 7017e6c9cf.

Co-authored-by: Ryan Prichard <rprichard@google.com>
2024-07-31 10:31:13 -04:00
Tobias Hieta
8f701b5df0
Set version to 20.0.0git
LLVM 19 release is starting.
2024-07-23 11:04:06 +02:00
Jerry Zhang Jian
9f3bfbb680
[CMake] enable CMP0144 policy if available (#96589)
- Enable CMP0144 policy if available, this will make the find_package()
more robust.

Signed-off-by: Jerry Zhang Jian <jerry.zhangjian@sifive.com>
2024-07-02 02:37:11 +09:00
Usama Hameed
3bc71c2abf
Get the linker version and pass the it to compiler-rt tests on Darwin. (#86220)
The HOST_LINK_VERSION is a hardcoded string in Darwin clang that detects
the linker version at configure time. The driver uses this information
to build the correct set of arguments for the linker. This patch detects
the linker version again during compiler-rt configuration and passes it
to the tests. This allows a clang built on a machine with a new linker
to run compiler-rt tests on a machine with an old linker.

rdar://125198603
2024-03-22 15:29:36 -07:00
Martin Storsjö
1b945e35a6 [CMake] Fix a typo in 23ffb2bdb9 2024-03-12 12:35:44 +02:00
Dave Abrahams
23ffb2bdb9
[CMake] Enable new policy for CMAKE_MSVC_DEBUG_INFORMATION_FORMAT (#82371) 2024-03-12 12:30:43 +02:00
Mark de Wever
81e20472a0
[cmake] Exposes LLVM version number in the runtimes. (#84641)
This allows sharing the LLVM version number in libc++.
2024-03-11 17:43:14 +01:00
Martin Storsjö
c6bd873403 [CMake] Switch the CMP0091 policy (MSVC_RUNTIME_LIBRARY) to the new behaviour
With the new behaviour, the /MD or similar options aren't added to
e.g. CMAKE_CXX_FLAGS_RELEASE, but are added separately by CMake.
They can be changed by the cmake variable
CMAKE_MSVC_RUNTIME_LIBRARY or with the target property
MSVC_RUNTIME_LIBRARY.

LLVM has had its own custom CMake flags, e.g. LLVM_USE_CRT_RELEASE,
which affects which CRT is used for release mode builds. Deprecate
these and direct users to use CMAKE_MSVC_RUNTIME_LIBRARY directly
instead (and do a best effort attempt at setting CMAKE_MSVC_RUNTIME_LIBRARY
based on the existing LLVM_USE_CRT_ flags). This only handles the
simple cases, it doesn't handle multi-config generators with
different LLVM_USE_CRT_* variables for different configs though,
but that's probably fine - we should move over to the new upstream
CMake mechanism anyway, and push users towards that.

Change code in compiler-rt, that previously tried to override the
CRT choice to /MT, to set CMAKE_MSVC_RUNTIME_LIBRARY instead of
meddling in the old variables.

This resolves the policy issue in
https://github.com/llvm/llvm-project/issues/63286, and should
handle the issues that were observed originally when the
minimum CMake version was bumped, in
https://github.com/llvm/llvm-project/issues/62719 and
https://github.com/llvm/llvm-project/issues/62739.

Differential Revision: https://reviews.llvm.org/D155233
2023-07-17 09:59:05 +03:00
Tom Stellard
c951960e65 GetClangResourceDir: Fix downstream projects that bundle llvm source
A project that bundles the llvm source code may have their own
PACKAGE_VERSION variable, so only use this to compute the
CLANG_RESOURCE_DIR if CLANG_VERSION_MAJOR is undefined.

Reviewed By: sebastian-ne

Differential Revision: https://reviews.llvm.org/D152608
2023-07-05 20:10:28 -07:00