aboutsummaryrefslogtreecommitdiff
path: root/cmake/Findllvm.cmake
AgeCommit message (Collapse)Author
2025-11-12cmake: update ZIG_LLVM_REQUIRED_TARGETS to contain LoongArch and SPIRVAlex Rønne Petersen
2025-08-30build: update to LLVM 21Alex Rønne Petersen
Closes #20966.
2025-04-04build: Update to LLVM/Clang 20.Alex Rønne Petersen
2024-09-19add missing clang and llvm library listingsAndrew Kelley
2024-09-19cmake: Update to LLVM 19.Alex Rønne Petersen
Co-authored-by: David Rubin <daviru007@icloud.com>
2024-07-06cmake/findllvm: fix incorrect lib dir setup for zig2Erik Arvstedt
Line `link_directories("${CMAKE_PREFIX_PATH}/lib")` was evaluated as `link_directories("/lib")` in the default case of `CMAKE_PREFIX_PATH` being empty. This caused cmake to add `-L/lib -Wl,-rpath,/lib` to the zig2 build flags. This could result in errors on systems where libraries set via `CMAKE_LIBRARY_PATH` had conflicting versions in `/lib`: - `-L/lib` could cause linking zig2 to fail - `-Wl,-rpath,/lib` adds `/lib` as the first entry of the zig2 `RPATH`. This could cause running zig2 (to build zig3) to fail. In case of conflicting lib dirs, cmake emitted this warning, which is now fixed: ``` Cannot generate a safe runtime search path for target zig2 because files in some directories may conflict with libraries in implicit directories: runtime library [libclang-cpp.so.18.1] in /nix/store/...-clang-18.1.5-lib/lib may be hidden by files in: /lib ```
2024-05-25Revert "cmake/llvm: Don't unset LLVM_CONFIG_EXE"Andrew Kelley
This reverts commit 28476a5ee94d311319941b54e9da66210690ce70. It also adds a comment to explain the purpose of this line, to prevent this mistake from being repeated.
2024-05-20cmake/llvm: Don't unset LLVM_CONFIG_EXERidai Govinda Pombo
2024-05-08update CMake files to LLVM 18Andrew Kelley
2023-09-19update LLVM static library list to 17Andrew Kelley
release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19update cmake files to LLVM 17Andrew Kelley
2023-01-29update Findllvm.cmake static lib list to LLVM 16Andrew Kelley
2023-01-25update cmake files to LLVM 16Andrew Kelley
2023-01-05cmake: move 'continue' statement to avoid cmake bugEric Joldasov
2022-12-27Revert "cmake: check llvm-config in separate function"Andrew Kelley
This reverts commit 55c3efcb58cc153fc3109a61c6949e470b57b81e. This caused a regression when building Zig with Homebrew. Also I don't like that it prints a message on success. Only when there is a problem should an error message be printed. closes #14093
2022-12-27cmake: check llvm-config in separate functionEric Joldasov
2022-08-02update LLVM library list to LLVM 15Andrew Kelley
2022-07-31Merge remote-tracking branch 'origin/master' into llvm15Andrew Kelley
2022-07-31cmake: Print all LLVM config errors instead of just the last onesin-ack
If you have multiple llvm-config executables in your path, and all of them cause failures, then only the last failure will be printed. This can cause confusion when the multiple llvm-config executables are from different major LLVM versions, i.e. LLVM 13 and 14, which might mask an error that happened on the LLVM 14 llvm-config with an unrelated error. This commit makes it so that all errors are collected into a list and printed all at once; this way, you can see how each llvm-config executable failed to configure properly. Note that the failures still won't be printed if a successful configuration is found.
2022-07-28update to LLVM 15Andrew Kelley
release/15.x 37007475ca1b345b4c5d340e228bcd7a62732d81
2022-07-23CMake: Search more permissively for LLDCody Tapscott
This change relaxes the restriction added in the prior commit that LLD should be alongside LLVM. This also leaves unresolved the issue of making sure the link mode (static or shared) of LLD matches that of LLVM/Clang. That would be an unfortunate restriction, since LLD seems to be provided only as a static lib on some distros.
2022-07-23CMake: Improve usage of `llvm-config`, esp. for consistent linkingCody Tapscott
This commit reworks the LLVM/Clang/LLD discovery process for CMake. The biggest changes are that: 1. We search for LLVM from most preferred directory to least, skipping any `llvm-config` that is the wrong version, or that doesn't support the requested link mode ("static" or "shared"). 2. `ZIG_PREFER_CLANG_CPP_DYLIB` has been renamed to `ZIG_SHARED_LLVM`, to better align with `ZIG_STATIC_LLVM`. 3. We only search for LLVM in the same directory alongside LLVM. 4. LLVM's link mode is forwarded to Clang, so that we can look for the appropriate shared/static libraries. 5. We use `--link-static` when querying `--system-libs` from llvm-config, so that this will include libz and other dependencies for statically linking LLD
2022-07-14CMake: Use NAMES_PER_DIR in all lookupsCody Tapscott
CMake has a surprising default behavior where looking up a library by multiple names gives the name order higher priority than the directory search order. For example, if your system provides "llvm-config-14" and CMAKE_PREFIX_PATH includes "llvm-config", CMake will always end up choosing the system-provided llvm-config-14. This change add NAMES_PER_DIR to request the more sensible behavior: directory search order has higher priority than name order, so CMAKE_PREFIX_PATH always wins over system-provided tools/libraries.
2022-07-03update build scripts to LLD and LLVM 14 librariesAndrew Kelley
2022-07-01Merge remote-tracking branch 'origin/master' into llvm14Andrew Kelley
2022-05-05cmake: add /usr/lib/llvm13 to searched pathsIsaac Freund
Alpine linux installs llvm to this path and currently patches zig's cmake file in order to build zig from source. https://git.alpinelinux.org/aports/tree/testing/zig/llvm-include.patch?id=0c3f7850bef38fb4c63fc6af5c14724e5311b0cc
2022-02-16ci: use zig-bootstrap for windowsAndrew Kelley
2022-02-03update cmake files to LLVM 14Andrew Kelley
2021-09-30fix the list of llvm librariesAndrew Kelley
not sure what "HelloNew" was doing in there
2021-09-15Merge remote-tracking branch 'origin/master' into llvm13Andrew Kelley
Conflicts: * cmake/Findclang.cmake * cmake/Findlld.cmake * cmake/Findllvm.cmake In master branch, more search paths were added to these files with "12" in the path. In this commit I updated them to "13". * src/stage1/codegen.cpp * src/zig_llvm.cpp * src/zig_llvm.h In master branch, ZigLLVMBuildCmpXchg is improved to add `is_single_threaded`. However, the LLVM 13 C API has this already, and in the llvm13 branch, ZigLLVMBuildCmpXchg is deleted in favor of the C API. In this commit I updated stage2 to use the LLVM 13 C API rather than depending on an improved ZigLLVMBuildCmpXchg. Additionally, src/target.zig largestAtomicBits needed to be updated to include the new m68k ISA.
2021-09-08cmake: also check Homebrew install paths when looking for LLVMFnControlOption
- On Intel Macs, the path is /usr/local/opt/llvm@12 - On Silicon Macs, the path is /opt/homebrew/opt/llvm@12 This makes specifying CMAKE_PREFIX_PATH optional for Homebrew LLVM.
2021-08-15cmake: update to LLVM 13 rc1Andrew Kelley
More precisely, aac4fe380d16a957627af2d6e5110ee35ad7e7e7 which is the current tip of release/13.x. Immediately following commits are tracking the same LLVM version.
2021-03-13Merge remote-tracking branch 'origin/master' into llvm12Andrew Kelley
2021-03-13cmake build: allow overriding whether to use llvm-configAndrew Kelley
Previously, there was an option ZIG_PREFER_LLVM_CONFIG which would override the default of not using llvm-config when cross compiling. That option is now removed in favor of the more powerful ZIG_USE_LLVM_CONFIG which defaults to OFF for cross compiling and ON for native compilation. The option overrides the default. This will be used in zig-bootstrap to improve support for native builds.
2021-03-01cmake: update findllvm.cmake file to include llvm12 librariesTimon Kruiper
2020-12-16Update LLVM version numbers in CMakeJakub Konka
2020-11-02fix cmake logic for checking LLVM versionAndrew Kelley
2020-10-16Add llvm-config detection when dynlinking clangJakub Konka
2020-10-07Merge remote-tracking branch 'origin/master' into llvm11Andrew Kelley
Conflicts: cmake/Findllvm.cmake The llvm11 branch changed 10's to 11's and master branch added the "using LLVM_CONFIG_EXE" help message, so the resolution was to merge these changes together. I also added a check to make sure LLVM is built with AVR enabled, which is no longer an experimental target.
2020-10-06Update the list of libraries that llvm11 usesTimon Kruiper
2020-10-04cmake: add option to use llvm-config to find cross-target llvm depsJohn Sullivan
2020-09-26Print the llvm-config path on configuration errorFrank Denis
This is helpful on systems with multiple LLVM installations. For example, OpenBSD ships with LLVM in the base system, but without support for extra targets. A full LLVM version can be installed using the ports system, but even when it is, `cmake` is not going to pick it up unless `/usr/local` is explicitly added to the `cmake` search paths. Having the full `llvm-config` path printed on error is helpful to understand that the detected LLVM version was not the expected one.
2020-09-03Merge remote-tracking branch 'origin/master' into llvm11Andrew Kelley
2020-09-01Fixing dylib search pathpwzk
2020-07-24update LLVM 10 version numbers to 11Andrew Kelley
2020-04-17update cmake, update readme, in response to the dynamic linking fiascoAndrew Kelley
2020-04-07Fix paths to find llvm/clang on DragonFlyMichael Neumann
2020-04-06cmake: improvements to cross-compiling for WindowsAndrew Kelley
* don't unconditionally pass -lz3 for mingw builds. If mingw builds require this then the llvm-config executable should put it as part of --system-libs. If there is a bug and it does not do that, and we need a workaround, then the workaround should be an explicit cmake option. * don't link libstage2.a against -lntdll. This causes zig to set `builtin.link_mode == .Dynamic` and include the TLS definitions, which then collide with the mingw-w64 symbols. This should probably be addressed separately, but for now this solves the problem and there is no reason to link a static library against a DLL. * Findllvm.cmake no longer treats the libraries as "optional" and will emit a cmake error if one is not found. Additionally, the not-required LLVM library LLVMTableGen is omitted.
2020-03-27cmake: support cross compilingAndrew Kelley
2020-03-27Merge pull request #4827 from ziglang/zig-cppAndrew Kelley
support compiling and linking c++ code