Commit Graph

107 Commits

Author SHA1 Message Date
Isaac Freund
49a7ceb5bc cmake: add /usr/lib/llvm13 to searched paths
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-05-05 02:51:48 -04:00
Andrew Kelley
25a7025613 ci: use zig-bootstrap for windows 2022-02-16 18:43:45 -07:00
Kazuki Sakamoto
64f7231f86 stage1: Fix missing LLD library 2022-02-04 01:45:44 -05:00
Andrew Kelley
0f35a1f37a fix the list of llvm libraries
not sure what "HelloNew" was doing in there
2021-09-30 23:33:03 -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
0e15205521 Remove mention of lldMachO from the project
including:
* finding lldMachO in CMake config
* punting `ld64.lld` to LLD linker
* providing bindings to LLD linker
2021-06-29 23:38:19 +02:00
Andrew Kelley
a4316d5505 Merge remote-tracking branch 'origin/master' into llvm12 2021-03-13 14:35:03 -07:00
Andrew Kelley
4e9894cfc4 cmake build: allow overriding whether to use llvm-config
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-13 14:30:56 -07:00
Timon Kruiper
939f334221 cmake: update findllvm.cmake file to include llvm12 libraries 2021-03-01 12:51:25 -08:00
Jakub Konka
9c2d8056ce Update LLVM version numbers in CMake 2020-12-16 09:37:32 +01:00
Andrew Kelley
b30a765b95 fix cmake logic for checking LLVM version 2020-11-02 12:16:10 -07:00
Jakub Konka
fe127a3691 Add llvm-config detection when dynlinking clang 2020-10-16 19:14:42 -04:00
Andrew Kelley
b5a36f676b Merge remote-tracking branch 'origin/master' into llvm11
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-07 00:46:05 -07:00
Timon Kruiper
d6d05fc84d Update the list of libraries that llvm11 uses 2020-10-06 20:07:40 -04:00
John Sullivan
ab7ea53541 cmake: add option to use llvm-config to find cross-target llvm deps 2020-10-04 00:41:32 -04:00
Frank Denis
99c5d2d590 Print the llvm-config path on configuration error
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-26 17:10:33 +02: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
Andrew Kelley
15ab61b2a0
cmake: improvements to cross-compiling for Windows
* 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-04-06 18:38:09 -04:00
Brian Cain
607892a30d Create an "LLD_LIBDIRS" var to override lld loc 2020-03-30 11:01:36 -04:00
Andrew Kelley
69aa09948b
cmake: support cross compiling 2020-03-27 23:43:21 -04:00
Andrew Kelley
107b5196f6
Merge pull request #4827 from ziglang/zig-cpp
support compiling and linking c++ code
2020-03-27 22:35:13 -04:00
Andrew Kelley
e803490a56
cmake: support finding a cross compiled llvm 2020-03-27 22:24:15 -04: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
f33bf48af7
Merge remote-tracking branch 'origin/master' into llvm10 2020-02-25 16:30:40 -05:00
Andrew Kelley
20f3b0efff rename libuserland to libstage2 2020-02-16 19:16:08 -05:00
Andrew Kelley
7eb0a3edce
remove libc dependency of zig0 building libstage2
Rather than `zig0 build ...` the build now does
`zig0 build-lib ...`, avoiding the requirement of linking the build
script, and thus avoiding the requirement of finding native libc,
for systems where libc is the system ABI.
2020-02-16 18:57:34 -05:00
Andrew Kelley
97b2ac598b
Merge remote-tracking branch 'origin/master' into llvm10 2020-01-22 12:12:36 -05:00
Michael Dusan
b9f4ac86ef
cmake: support make and make install
(2nd attempt to get this right)
2020-01-17 19:39:43 -05:00
Andrew Kelley
fbe6af81fd
Merge remote-tracking branch 'origin/master' into llvm10 2020-01-16 13:01:36 -05:00
Sahnvour
63ecded3ce
msvc: reduce inlining aggressivity to workaround a codegen bug in cl.exe cf. #3024 2019-10-16 19:04:50 -04:00
Sahnvour
5b51f41cee
stage1: override cmake's default compilation flags to statically link the CRT on windows
we want to use /MT instead of /MD for a fully static executable
2019-10-16 19:04:50 -04:00
LemonBoy
935cce2414 Fix lld search path 2019-10-12 15:27:42 +02:00
Andrew Kelley
6f10e3fda6
llvm 9.0.0 => llvm 10.0.0 2019-10-02 02:11:46 -04:00
Andrew Kelley
e816d592e8
update zig codebase to llvm 9 2019-07-17 17:47:39 -04:00
Andrew Kelley
8f92a49dfd
update to llvm9 trunk 2019-07-16 22:23:48 -04:00
daurnimator
3a67c13b5d cmake: allow user to select static vs dynamic LLVM 2019-07-16 12:33:13 -04:00
Andrew Kelley
038946288c
Revert "fixed path with spaces in llvm-config (#2854)"
This reverts commit d23798a296.

This caused build problems for several people.
2019-07-09 13:31:13 -04:00
Ian Lilley
d23798a296 fixed path with spaces in llvm-config (#2854)
* fixed path with spaces in llvm-config
2019-07-09 11:48:25 -04:00
Wink Saville
7bafe2e490 Fix alignment of macro FIND_AND_ADD_CLANG_LIB 2019-04-24 14:42:08 -04:00