Commit Graph

64 Commits

Author SHA1 Message Date
Alex Rønne Petersen 2b6ab59435 cmake: update to LLVM 22
closes https://codeberg.org/ziglang/zig/issues/30558
2026-04-25 21:49:39 +02:00
Alex Rønne Petersen 008affa645 build: update to LLVM 21
Closes #20966.
2025-08-30 06:36:40 +02:00
Alex Rønne Petersen c712f18d74 build: Update to LLVM/Clang 20. 2025-04-04 06:08:08 +02:00
Andrew Kelley a3a8a266ef add missing clang and llvm library listings 2024-09-19 18:20:21 -07:00
Alex Rønne Petersen dd095e506a cmake: Update to LLVM 19.
Co-authored-by: David Rubin <daviru007@icloud.com>
2024-09-19 18:20:20 -07:00
Forest cf939b096a cmake: CLANG_LIBRARIES: find libclang-cpp.so.18.1
This fixes the failure to find CLANG_LIBRARIES on debian, which packages
the relevant .so file at these paths:

libclang-cpp18: /usr/lib/llvm-18/lib/libclang-cpp.so.18.1
libclang-cpp18: /usr/lib/x86_64-linux-gnu/libclang-cpp.so.18.1
libclang-cpp18: /usr/lib/x86_64-linux-gnu/libclang-cpp.so.18

(The latter two paths are symlinks to the first.)
2024-08-17 13:15:32 -07:00
Andrew Kelley 376387c390 add missing clang static library to the build 2024-05-08 19:37:28 -07:00
Andrew Kelley 3ac8d37182 update CMake files to LLVM 18 2024-05-08 19:37:28 -07:00
Andrew Kelley 3882ce4f4b update cmake files to LLVM 17 2023-09-19 09:37:26 -07:00
Andrew Kelley 9c3bd437e6 update cmake files to LLVM 16 2023-01-25 20:26:14 -07:00
kcbanner 3cacbea95b build: simplify llvm-config provided system library parsing
- Revert the addition of CLANG_SYSTEM_LIBARIES and LLVM_SYSTEM_LIBRARIES
- Change addCMakeLibraryList to parse non-absolute path .lib dependencies as system libraries
2023-01-04 21:45:06 -05:00
kcbanner 0471eea0e2 build: first pass on geting stage3 building under x64_64-windows-msvc 2023-01-04 21:45:05 -05:00
Andrew Kelley dfecd819ce build: add new clang libraries for LLVM 15 upgrade 2022-08-02 17:22:16 -07:00
Andrew Kelley adb4a95302 update to LLVM 15
release/15.x 37007475ca1b345b4c5d340e228bcd7a62732d81
2022-07-28 11:53:25 -07:00
Cody Tapscott abc1ae538f CMake: Search for Clang in CMAKE_LIBRARY_PATH, CMAKE_PREFIX_PATH, and CMAKE_FRAMEWORK_PATH
On some systems (esp. systems that use unique hashed file-paths for
library-versions like Nix), we can't expect LLVM and Clang to share
lib/bin directories.

The best we can do is find the matching clang libraries in the
CMAKE_LIBRARY_PATH provided by the environment
2022-07-25 10:38:52 -07:00
Cody Tapscott 4113a790b0 CMake: Search more permissively for LLD
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-23 08:55:56 -07:00
Cody Tapscott 3f640ef3d2 CMake: Improve usage of llvm-config, esp. for consistent linking
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-23 08:52:30 -07:00
Cody Tapscott dd70336f3a CMake: Use NAMES_PER_DIR in all lookups
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-14 22:18:10 -04:00
Andrew Kelley 308f72701a update cmake files to LLVM 14 2022-02-03 13:38:48 -07:00
Andrew Kelley f3ebfcae38 Merge remote-tracking branch 'origin/master' into llvm13
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-15 14:51:08 -07:00
FnControlOption 23c25c5eaf cmake: also check Homebrew install paths when looking for LLVM
- 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-09-08 13:48:16 -04:00
Andrew Kelley 78ff2a148a cmake: update to LLVM 13 rc1
More precisely, aac4fe380d16a957627af2d6e5110ee35ad7e7e7 which is the
current tip of release/13.x.

Immediately following commits are tracking the same LLVM version.
2021-08-15 17:48:37 -07:00
Jakub Konka 9c2d8056ce Update LLVM version numbers in CMake 2020-12-16 09:37:32 +01:00
Andrew Kelley 338f155a02 Merge remote-tracking branch 'origin/master' into llvm11 2020-09-03 23:52:19 -07:00
pwzk baa734c42a Fixing dylib search path 2020-09-01 13:53:12 -04:00
Andrew Kelley 41a8b6f57b llvm11: link against libClangToolingCore
This is needed to successfully link against llvm, clang, and lld 11.
2020-07-24 17:08:39 -07:00
Andrew Kelley cd91e17b73 update LLVM 10 version numbers to 11 2020-07-24 16:49:43 -07:00
Andrew Kelley 986aa42d3e update cmake, update readme, in response to the dynamic linking fiasco 2020-04-17 18:41:21 -04:00
Andrew Kelley f79faf9008 cmake: allow not finding some clang libs
partial revert of aaf99371b2
because it broke the build for some people
2020-04-11 22:09:17 -04:00
Andrew Kelley e857190dab put the previous commit behind cmake option ZIG_PREFER_CLANG_CPP_DYLIB
Without this, building from source caused:

CommandLine Error: Option 'mc-relax-all' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

This is due to LLVM static libs compiled in multiple times. But without
the LLVM static libs on the linker line, it caused undefined symbol
linker errors.

So our hands are tied. Homebrew users will have to specify
`-DZIG_PREFER_CLANG_CPP_DYLIB`.
2020-04-10 01:25:15 -04:00
Andrew Kelley aaf99371b2 look for clang-cpp shared lib when it exists
See #4799
2020-04-10 00:38:19 -04:00
Michael Neumann 7a829a7015 Fix paths to find llvm/clang on DragonFly 2020-04-07 17:13:33 +02:00
Michael Dusan 9cc593ca78 cmake: address new warnings from cmake-3.17
Match package-name case from CMakeLists.txt .

New warning sample:

    The package name passed to `find_package_handle_standard_args` (LLVM) does
    not match the name of the calling package (llvm).  This can lead to
    problems in calling code that expects `find_package` result variables
    (e.g., `_FOUND`) to follow a certain pattern.
2020-03-25 18:43:28 -04:00
Andrew Kelley f9992850a5 simplify cmake logic for finding clang
which fixes the build on windows
2020-03-22 17:35:06 -04:00
Andrew Kelley 6f10e3fda6 llvm 9.0.0 => llvm 10.0.0 2019-10-02 02:11:46 -04:00
Andrew Kelley 8f92a49dfd update to llvm9 trunk 2019-07-16 22:23:48 -04:00
Wink Saville 7bafe2e490 Fix alignment of macro FIND_AND_ADD_CLANG_LIB 2019-04-24 14:42:08 -04:00
Andrew Kelley 2dcf1a2392 Merge remote-tracking branch 'origin/master' into llvm8 2019-02-28 09:19:18 -05:00
Andrew Kelley a77a17e2c2 add zig cc command to act like a C compiler
closes #490
2019-02-24 12:53:28 -05:00
Andrew Kelley c00216701c Merge remote-tracking branch 'origin/master' into llvm8 2018-12-23 17:04:26 -05:00
Greg V 24e54799fd Fix CMake finding LLVM/clang/lld on FreeBSD 2018-10-20 15:15:01 +03:00
Andrew Kelley a4d61b5d72 update to llvm 8 2018-09-19 17:34:52 -04:00
Andrew Kelley 287f5cce50 build: fix finding llvm and clang 7 2018-09-19 15:38:36 -04:00
Andrew Kelley 62668e3e6b update to llvm 7.0.0 2018-03-22 15:39:50 -04:00
Ben Noordhuis 4a921b2eba add CLANG_LIBDIRS cmake build variable
Mirrors LLVM_LIBDIRS, tells cmake where to look for libclang libraries.
2018-03-17 18:41:47 +01:00
Andrew Kelley 94ec2190f8 update to llvm master 2017-11-02 21:54:24 -04:00
Andrew Kelley 57ea6e8c9f fix up msvc stuff to make it work on linux and macos too 2017-09-13 02:40:02 -04:00
Jonathan Marler 67021e2bff Modified cmake to use LLVM imported packages. 2017-09-11 18:27:41 -06:00
Jonathan Marler 7c81cd30de Add support for MSVC 2017-09-11 09:26:26 -06:00
Andrew Kelley 120e2fdf8b build: add more search paths for libclang
thanks @smaeul
2017-09-09 17:17:36 -04:00