Commit Graph

64 Commits

Author SHA1 Message Date
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
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
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
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
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
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
Andrew Kelley
1864acd326
Merge remote-tracking branch 'origin/master' into llvm8 2019-02-09 18:57:39 -05:00
Andrew Kelley
91baa574a5
build: update Findllvm.cmake for llvm 8 2019-02-07 12:24:55 -05:00
Andrew Kelley
f8ba50f5ed
build: make sure LLVM is exactly correct
* check the version to be the correct major version
 * ensure that it has all the default targets enabled
2019-02-07 12:22:04 -05:00
Andrew Kelley
7843c96df8
build: make sure LLVM is exactly correct
* check the version to be the correct major version
 * ensure that it has all the default targets enabled
2019-02-07 12:18:01 -05:00
Andrew Kelley
87f5bed11f Merge remote-tracking branch 'origin/master' into llvm8 2019-01-22 20:10:34 -05:00
tharvik
3bec3b9f9b llvm-config sanity check 2019-01-21 15:58:54 -05:00
Andrew Kelley
c00216701c Merge remote-tracking branch 'origin/master' into llvm8 2018-12-23 17:04:26 -05:00
Andrew Kelley
f8d6f5daff Merge remote-tracking branch 'origin/master' into llvm8 2018-11-05 10:56:42 -05:00
Greg V
24e54799fd Fix CMake finding LLVM/clang/lld on FreeBSD 2018-10-20 15:15:01 +03:00
Andrew Kelley
5b84192f07
build: try to find llvm-config-7 before llvm-config 2018-10-06 00:10:16 -04: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
7109035b78 Merge remote-tracking branch 'origin/master' into llvm7 2018-08-25 21:57:28 -04:00
prazzb
6e55f61581 Find local llvm-config first
Distro's llvm usually have a 6.0 suffix.Any custom llvm build
names the binary as llvm-config.Keeping 6.0 variant first causes
the distro's llvm to be compiled in place of a custom one even if
given using CMAKE_PREFIX_PATH.
2018-08-13 22:55:19 +05:30
Andrew Kelley
cca93908e6 Merge remote-tracking branch 'origin/master' into llvm7 2018-04-04 17:22:26 -04:00
Andrew Kelley
f586acabdc add ZIG_STATIC cmake option
it's not compatible with glibc but it works with musl
2018-03-30 13:20:13 -04:00
Andrew Kelley
62668e3e6b update to llvm 7.0.0 2018-03-22 15:39:50 -04:00
Ben Noordhuis
c2c34c09b9 add LLVM_LIBDIRS to link directories
This seems to be the only way to get the zig build to link against llvm
libraries in a non-standard location.
2018-03-17 18:41:54 +01:00
Andrew Kelley
94ec2190f8 update to llvm master 2017-11-02 21:54:24 -04:00
Andrew Kelley
3fe50cb13c simpler cmake for msvc 2017-09-28 10:48:13 -04:00
Andrew Kelley
41b588547c improvements to windows support
See #302
2017-09-23 18:46:03 -04:00
Andrew Kelley
d9eabde319 add Child property of slice type
also rename child field to Child for pointer and array
2017-09-13 14:30:57 -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
Jonathan Marler
850a1d2054 Switched find order for llvm, means it will choose llvm version 5.0 before any other version. (#446) 2017-09-08 17:08:24 -04:00
Andrew Kelley
234030c37a update build to look for llvm 5.0 2017-08-26 00:34:40 -04:00