Commit Graph

736 Commits

Author SHA1 Message Date
Chandler Carruth
7c150bae21 [cmake] Start making LLVM_LIBDIR_SUFFIX effective by adding it to
*numerous* places where it was missing in the CMake build. The primary
change here is that the suffix is now actually used for all of the lib
directories in the LLVM project's CMake. The various subprojects still
need similar treatment.

This is the first of a series of commits to try to make LLVM's cmake
effective in a multilib Linux installation. I don't think many people
are seriously using this variable so I'm hoping the fallout will be
minimal. A somewhat unfortunate consequence of the nature of these
commits is that until I land all of them, they will in part make the
brokenness of our multilib support more apparant. At the end, things
should actually work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224919 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-29 11:16:19 +00:00
Peter Zotov
827f4eb6a3 [cmake] Unbreak LLVM-Config.cmake / llvm_expand_dependencies.
The algorithm for sorting libraries in topological order, as
previously implemented, had a few issues:
  * It didn't make any sense.
  * It didn't actually sort libraries in topological order.
  * It hung on some inputs, e.g. "LLVMipo".

This commit replaces the old algorithm with a straightforward port
from llvm-config.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224554 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-18 23:56:52 +00:00
Rafael Espindola
97996ea790 Disable --icf=safe to avoid a bug.
Thanks to Sameer Sahasrabuddhe for the report!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224123 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 14:28:19 +00:00
Nico Weber
24d058a523 cmake: Make SVNVersion.inc work on Windows if svn is called svn.bat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223864 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-10 00:10:21 +00:00
Paul Robinson
ebde7405a7 Make GetSVN.cmake do its VCS queries with native CMake code.
This lets the queries work on Windows as well as Linux.

This does mean make and cmake aren't using the same scripts to do the
queries (again), but at least GetSVN.cmake understands git and git-svn
as well as svn now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223425 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 00:50:15 +00:00
Rafael Espindola
838e18116d Also use --icf=safe if we are being linked by gold.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223394 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 22:16:08 +00:00
Rafael Espindola
89f1920565 Detect if the linker is gold and if so always use --gc-sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223372 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 17:54:35 +00:00
Peter Zotov
0245b12df2 [OCaml] [cmake] Disable OCaml bindings if ctypes >=0.3 is not found.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223195 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 03:39:01 +00:00
Reid Kleckner
efcedf94c4 cmake: Remove MAXPATHLEN define as autoconf does not provide it
Presumably it was added to the CMake system when MAXPATHLEN was still
used by code built for Windows. Currently only lib/Support/Path.inc uses
MAXPATHLEN, and it should be available on all Unices.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223139 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 18:59:08 +00:00
Peter Zotov
a0a26f222b [OCaml] [cmake] Add CMake buildsystem for OCaml.
Closes PR15325.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223071 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 19:50:23 +00:00
Peter Collingbourne
a9ce03858d Teach LLVM about llgo subproject.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222860 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-27 00:15:21 +00:00
Jordan Rose
61fd8ea520 [CMake] Update GetSVN.cmake to use LLVM version control helper scripts.
This allows the logic to work with Git, and also uses the variable names
to match what Clang is actually looking for.

This is a re-application of r190556 and r190808. This changes the interface
of GetSVN.cmake. Clang change to follow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222391 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 22:03:21 +00:00
Eric Fiselier
ad49f982e7 Add support for LLVM_USE_SANITIZER=Thread
Summary: This will help in testing libc++ and libc++abi with tsan.

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: samsonov, llvm-commits

Differential Revision: http://reviews.llvm.org/D6283

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222258 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 21:23:38 +00:00
Peter Collingbourne
5b9a46b789 CMake: Use the new USES_TERMINAL option for test suite targets when available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222181 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 22:16:15 +00:00
Eric Fiselier
96c8ba61cb Provide missing definition of uppercase_CMAKE_BUILD_TYPE in HandleLLVMOptions module
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222082 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-15 07:45:31 +00:00
Roman Divacky
89a5f54f1d Use -Wcast-qual in cmake builds, not only autoconfo ones.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221913 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 19:45:27 +00:00
Rafael Espindola
b3963d680c Pass PRIVATE to target_link_libraries if using shared libraries.
A shared library (unlike a .a), has its dependencies recorded in the library and
we can pass PRIVATE to target_link_libraries.

This patch then removes some bogus dependencies when using
BUILD_SHARED_LIBS=ON. For example, we go from

build lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/AggressiveAntiDepBreaker.cpp.o:
CXX_COMPILER /home/espindola/llvm/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
|| include/llvm/IR/intrinsics_gen lib/libLLVMSupport.so
lib/libLLVMCore.so lib/libLLVMBitReader.so
lib/libLLVMTransformUtils.so lib/libLLVMInstCombine.so
lib/libLLVMScalarOpts.so lib/libLLVMipa.so lib/libLLVMAnalysis.so
lib/libLLVMMCParser.so lib/libLLVMMC.so lib/libLLVMObject.so
lib/libLLVMTarget.so lib/libLLVMProfileData.so

to

build lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/AggressiveAntiDepBreaker.cpp.o:
CXX_COMPILER /home/espindola/llvm/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
|| include/llvm/IR/intrinsics_gen lib/libLLVMSupport.so
lib/libLLVMCore.so lib/libLLVMTransformUtils.so
lib/libLLVMScalarOpts.so lib/libLLVMAnalysis.so lib/libLLVMMC.so
lib/libLLVMTarget.so

In fact, build.ninja goes from 5231028 bytes to 4896759 bytes.

With this, old verisons of bfd ld (2.24 is OK, 2.23 warns) will print a bogus
warning when building with BUILD_SHARED_LIBS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221530 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-07 15:33:56 +00:00
Rafael Espindola
3ee42f6e5f Add a LLVM_BUILD_STATIC option to cmake.
Setting it to true causes all executables to be statically linked.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221345 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-05 14:03:58 +00:00
Rafael Espindola
a0ef0e7d0c [cmake] Pass -O3 when linking.
Gold and bfd ld enable misc optimizations. lld ignores the option for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221097 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-02 12:14:22 +00:00
Reid Kleckner
57c911e4ab Suppress MSVC's equivalent of -Wshadow warnings
IMO we need to clean up some of these, but the member variable one
(C4458) has false positives on static methods.  It is currently firing
on Twine, which has a static method like:
  struct Twine {
    uintptr_t LHS, RHS;
    static void staticMethod() {
      // warning C4458: declaration of 'LHS' hides class member
      uintptr_t LHS;
      ...
    }
  };

We should fix up clang's -Wshadow and clean it up, and then we can
re-enable some of these MSVC warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221012 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-31 22:55:57 +00:00
Chris Bieneman
4b57390110 EXPORTED_SYMBOL_FILE using mingw and cmake
Summary: This is a fix for the command line syntax error while building LTO when using MinGW.

Patch By: jsroemer

Reviewers: rnk

Reviewed By: rnk

Subscribers: rnk, beanz, llvm-commits

Differential Revision: http://reviews.llvm.org/D5476

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220935 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-30 22:37:58 +00:00
Rui Ueyama
490f286d15 Re-commit r220667.
C++ source given to check_cxx_source_compile should have define "main".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220669 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 08:16:18 +00:00
Rui Ueyama
e975522566 Revert "Include stddef.h before including cxxabi.h" to un-break buildbot
This reverts commit r220665.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220667 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 08:03:21 +00:00
Rui Ueyama
baa8acd546 Include stddef.h before including cxxabi.h
On FreeBSD 10.0, size_t needs to be defined before including cxxabi.h.
Currenty HAVE_CXXABI_H is not defined on FreeBSD because of that reason.
This patch teaches cmake and configure how to include it.

http://reviews.llvm.org/D5940



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220665 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 07:37:57 +00:00
Peter Collingbourne
bdc3a5b99a Add llvm-go tool.
This tool lets us build LLVM components within the tree by setting up a
$GOPATH that resembles a tree fetched in the normal way with "go get".

It is intended that components such as the Go frontend will be built in-tree
using this tool.

Differential Revision: http://reviews.llvm.org/D5902

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220462 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 02:33:23 +00:00
Peter Collingbourne
1496d41753 Do not add -gsplit-dwarf to LLVM_DEFINITIONS.
This would cause the flag to appear in the output of "llvm-config --cppflags",
which should contain only preprocessor flags. The -gsplit-dwarf flag in
particular can cause problems with certain downstream users such as cgo.

Differential Revision: http://reviews.llvm.org/D5895

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220410 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-22 19:49:19 +00:00
Chandler Carruth
14e55b16df Teach lit to filter the host LDFLAGS down from the build system and into
the CGO build environment. This lets things like -rpath propagate down
to the C++ code that is built along side the Go bindings when testing
them.

Patch by Peter Collingbourne, and verified that it works by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220252 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-21 00:36:28 +00:00
Rafael Espindola
b9c7f60191 Explain why we don't always use --gc-sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220237 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-20 21:37:38 +00:00
NAKAMURA Takumi
7c771b0293 Revert r220174, "Always use -Wl,-gc-sections on our build."
It dropped required functions for plugins with gnu ld 2.20 and 2.21.

  Failing Tests (1):
      LLVM :: Feature/load_module.ll

  Hello: bin/opt: symbol lookup error: lib/LLVMHello.so: undefined symbol: _ZN4llvm11raw_ostream13write_escapedENS_9StringRefEb

  Failing Tests (1):
      Clang :: Frontend/plugins.c

  error: unable to load plugin 'lib/PrintFunctionNames.so': 'lib/PrintFunctionNames.so: undefined symbol: _ZN5clang15PluginASTAction6anchorEv'

I think we should inspect linker's version or behavior to introduce --gc-sections for --export-dynamic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220198 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-20 12:12:21 +00:00
Rafael Espindola
0ea9c06fe0 Always use -Wl,-gc-sections on our build.
Both bfd ld and gold correctly handle --export-dynamic, so gc-sections is safe even for binaries
that support plugins.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220174 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-19 23:24:46 +00:00
Peter Collingbourne
560e2700e2 Disable ccache for go tests.
Should fix llvm-clang-lld-x86_64-debian-fast bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220071 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-17 18:32:36 +00:00
Peter Collingbourne
798ace2e58 Initial version of Go bindings.
This code is based on the existing LLVM Go bindings project hosted at:
https://github.com/go-llvm/llvm

Note that all contributors to the gollvm project have agreed to relicense
their changes under the LLVM license and submit them to the LLVM project.

Differential Revision: http://reviews.llvm.org/D5684

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219976 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-16 22:48:02 +00:00
Alexey Samsonov
fcc00a10e3 Re-land r219354: Use llvm-symbolizer to symbolize LLVM/Clang crash dumps.
In fact, symbolization is now expected to work only on Linux and
FreeBSD/NetBSD, where we have dl_iterate_phdr and can learn the
main executable name without argv0 (it will be possible on BSD systems
after http://reviews.llvm.org/D5693 lands). #ifdef-out the code for
all the rest Unix systems.

Reviewed in http://reviews.llvm.org/D5610


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219534 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 22:06:59 +00:00
Alexey Samsonov
aa486d0764 Revert r219354. It seems to break some buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219355 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-08 23:07:59 +00:00
Alexey Samsonov
ee3948fdbe Use llvm-symbolizer to symbolize LLVM/Clang crash dumps.
This change modifies fatal signal handler used in LLVM tools.
Now it attempts to find llvm-symbolizer binary and communicates
with it in order to turn instruction addresses into
function/file/line info entries. This should significantly improve
stack traces readability in Debug builds.

This feature only works on selected platforms (including Darwin
and Linux). If the symbolization fails for some reason, signal
handler will fallback to the original behavior.

Reviewed in http://reviews.llvm.org/D5610


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219354 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-08 22:57:47 +00:00
Richard Smith
173573736b Add LLVM_ENABLE_MODULES flag to CMake to enable building with C++ modules.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218551 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-26 22:40:15 +00:00
Richard Smith
7e0a0e282a Fix CMake warning CMP0054: don't quote a variable name that is intended to be
expanded; future versions of cmake may not expand the variable in this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218543 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-26 21:35:48 +00:00
Richard Smith
dadfd4f0a7 Fix misinterpretation of CMake rule found by a CMake warning (related to CMP0054).
lldb sets the variable SHARED_LIBRARY to 1, which breaks this conditional,
because older versions of CMake interpret

  if ("${t}" STREQUAL "SHARED_LIBRARY")

as meaning

  if ("${t}" STREQUAL "1")

in this case. Change the conditional so it does the right thing with both old
and new CMakes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218542 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-26 21:33:05 +00:00
Evgeniy Stepanov
6354451c6a Add CMake check for libatomic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217666 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-12 11:08:59 +00:00
Dan Liew
056270700d Don't attempt to run llvm-config in cmake/modules/Makefile when doing
``make clean`` because it won't be available.

This is an attempt to unbreak buildbots broken by r217484.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217490 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10 11:09:23 +00:00
Dan Liew
aa55210555 Attempt to fix PR20884
This fixes the generation of broken LLVMExports.cmake file by
the Autoconf/Makefile build system when --enable-shared is passed to
configure.

When --enable_shared is passed the Makefile.rules does not set the
LLVMConfigLibs variable which cmake/modules/Makefile previously relied
on. Now it runs the llvm-config command itself to get the library names.

This still isn't perfect because the generated LLVM targets refer to the
static libraries and not the shared library but that is much larger
problem to fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217484 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10 10:18:59 +00:00
Alexey Samsonov
7935e70de2 [CMake] Add -fno-sanitize=function to UBSan bootstrap
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217217 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-05 01:17:30 +00:00
Chris Bieneman
901166c939 Enabling LLVM & Clang to be cross-compiled using CMake from a single configuration command line
The basic idea is similar to the existing cross compilation support. A directory must be configured to build host versions of tablegen tools and llvm-config. This directory can be user provided (and configured), or it can be created during the build. During a build the native build directory will be configured and built to supply the tablegen tools used during the build. A user could also explicitly provide the tablegen executables to run on the CMake command line.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217105 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 23:21:18 +00:00
Matt Arsenault
ef02f8eb0b cmake: Don't reject unknown cpp files that start with .
Some editors create hidden file backups in the same
directory as the file, and it's annoying when cmake
errors on them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216941 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02 20:20:43 +00:00
Alexey Samsonov
79e9b30b11 Introduce -DLLVM_USE_SANITIZER=Undefined CMake option to build UBSan-ified version of LLVM/Clang.
I've fixed most of the simple bugs and currently "check-llvm" test suite
has 26 failures, and "check-clang" suite has 5 failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216701 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 00:50:36 +00:00
Dylan Noblesmith
a2a6fa2fd5 cmake: actually test -Wcomment
This test was testing nothing, as only -Werror was ever
being added to the compiler flags.

You can see the final nitty-gritty compiler invocation in
CMakeFiles/CMakeOutput.log (for successful tests) and
CMakeFiles/CMakeError.log (for failed tests).

Before:
Building C object CMakeFiles/cmTryCompileExec3385359576.dir/src.c.o
/usr/bin/clang   -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default  -DC_WCOMMENT_ALLOWS_LINE_WRAP  -Werror   -o CMakeFiles/cmTryCompileExec3385359576.dir/src.c.o   -c /home/nobled/code/llvm-b9/CMakeFiles/CMakeTmp/src.c

After:
Building C object CMakeFiles/cmTryCompileExec3385359576.dir/src.c.o
/usr/bin/clang   -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default  -DC_WCOMMENT_ALLOWS_LINE_WRAP  -Werror -Wcomment   -o CMakeFiles/cmTryCompileExec3385359576.dir/src.c.o   -c /home/nobled/code/llvm-b9/CMakeFiles/CMakeTmp/src.c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216328 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-23 21:10:58 +00:00
Dylan Noblesmith
136fd4c7e2 cmake: disable -Wnon-virtual-dtor when it gives false positives
clang has only been smart enough not to trigger -Wnon-virtual-dtor
warnings on final classes since r208449 (in clang 3.5). Building
with older versions is extremely noisy, so disable the warning
on those compilers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216327 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-23 21:10:56 +00:00
Aaron Ballman
71493b7d7c Disabling an MSVC warning ('var' : definition from the for loop is ignored; the definition from the enclosing scope is used) which will trigger false positives more than true positives.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215895 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-18 14:54:22 +00:00
Dan Liew
43d6849e95 Make message about building sphinx documentation with CMake more
informative by stating where the output is going.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215635 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-14 11:57:16 +00:00
Dan Liew
550abf8c29 Add SPHINX_WARNINGS_AS_ERRORS CMake option to allow warnings to not be
treated as errors (which is still the default). This is useful when
working on documentation that has existing errors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215634 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-14 11:57:13 +00:00
Josh Klontz
a9ee302530 Fix for #20408 - CMake LLVM_ENABLE_FFI=ON build fails on reconfigure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215207 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 14:32:56 +00:00
Dan Liew
b3768f6fb0 Emit a warning if llvm_map_components_to_libraries() is used noting that its
use is deprecated in favour of llvm_map_components_to_libnames()

Although message(DEPRECATION "msg") would probably be a better fit this
does nothing if CMAKE_ERROR_DEPRECATED and CMAKE_WARNING_DEPRECATED are
both off, which is the default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214078 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-28 13:36:50 +00:00
Dan Liew
e6113b6aa8 Add LLVM_TOOLS_BINARY_DIR variable to LLVMConfig.cmake so clients
of LLVM using CMake can easily find the tools directory.

LLVM_BUILD_TOOLS_BINARY_DIR was removed because it is now
superfluous.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213674 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-22 17:48:51 +00:00
Dan Liew
153dc48cd3 Export LLVM_ENABLE_RTTI and LLVM_ENABLE_EH in LLVMConfig.cmake so
clients of LLVM know if RTTI and/or EH were enabled in the build of
LLVM they are trying to link against.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213664 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-22 15:41:33 +00:00
Dan Liew
976824a7a4 Added LLVM_ENABLE_RTTI and LLVM_ENABLE_EH options that allow RTTI and EH
to globally be controlled. Individual targets (e.g.  ExceptionDemo) can
still override this by using LLVM_REQUIRE_RTTI and LLVM_REQUIRE_EH if
they need to be compiled with RTTI or exception handling respectively.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213663 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-22 15:41:18 +00:00
Dan Liew
285c82122d Export LLVM_ENABLE_ASSERTIONS in LLVMConfig.cmake so clients know
if the version of LLVM they are trying to use was built with or
without assertions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213532 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-21 14:17:15 +00:00
Alp Toker
427c5cb4f9 CMake: avoid a reconfigure loop from r213091
Removing the native CMakeCache.txt causes the target to get re-run needlessly
on some systems. We'll want another solution for that part of the fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213099 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-15 22:11:54 +00:00
Alp Toker
9bc72a33f1 CMake: fix cross-compilation with external source directories
This adds support for building native artifacts when cross-compiling using the
popular side-by-side source directory layout (no symlinks, no nested
repositories).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213091 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-15 21:04:12 +00:00
Alp Toker
afa0ba139f Revert "Revert "Move clang feature flags settings out of LLVM core and into cfe""
It turns out this commit was fine. The problem was in the legacy build system (fixed r213010).

This reverts commit r213005.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213015 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 23:30:31 +00:00
Alp Toker
e077a904c8 Revert "Move clang feature flags settings out of LLVM core and into cfe"
This broke one of the builds, presumably side-by-side modular CMake.
Investigating.

This reverts commit r212998.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213005 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 22:54:22 +00:00
Alp Toker
18c3a47118 Move clang feature flags settings out of LLVM core and into cfe
clang r212997 incorporated these settings into its own build system.  They no
longer need to be set from LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212998 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 22:19:04 +00:00
NAKAMURA Takumi
f51fbcbb36 [CMake][Win32.DLL] Let llvm_add_library(SHARED) link dependent libraries as PRIVATE.
For example, c-index-test.exe requires just libclang.dll (its import library).
When libraries in libclang were not PRIVATE but PUBLIC, c-index-test required libraries transitive by libclang.

Note, on mingw with BUILD_SHARED_LIBS, library dependencies would become more strict.
In principle, required libraries should be "required in its source file".

This will help to detect missing dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212934 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 12:26:15 +00:00
NAKAMURA Takumi
13764f7b18 [CMake] LINK_COMPONENTS: Add also corresponding MCTargetDesc and TargetInfo as well, when target names or "nativecodegen" are specified.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212921 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 05:07:07 +00:00
NAKAMURA Takumi
d74d9b3377 [CMake] Enable loadable modules, aka plugins, with BUILD_SHARED_LIBS on cygming.
Loadable modules could be enabled without BUILD_SHARED_LIBS with tweaks in future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212907 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-13 13:47:37 +00:00
NAKAMURA Takumi
adad0d53dc [CMake] Introduce moddir for MODULE -- corresponding to LIBRARY_OUTPUT_DIRECTORY.
On Win32.DLL, it points not lib but bin.

LIBRARY_OUTPUT_DIRECTORY affects add_library(MODULE), especially Win32.DLL.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212903 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-13 13:33:26 +00:00
NAKAMURA Takumi
c1a060c6a3 [CMake] add_llvm_library: Add "RUNTIME DESTINATION bin" to install(). It affects add_library(SHARED) for Win32.DLL.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212818 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-11 14:36:28 +00:00
Alp Toker
2bd8e0cde3 Prospective -fsanitize=memory build fix following r212586
This -f group flag appears to influence linker flags, breaking the usual rules
and causing CMake's link invocation to fail during feature detection due to
missing link dependencies (msan_*).

Let's forcibly add it for now to get things the way they were before feature
detection started working.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212590 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-09 06:27:05 +00:00
Alp Toker
d87c2fc2e3 CMake: make __DATE__, __TIME__ etc. macro usage an error
When LLVM_ENABLE_TIMESTAMPS has been disabled we can prevent the preprocessor
from embedding dates, times and file timestamps.

There are a few motivations for this:

  1) Validate the recent CMake feature detection bugfix from LLVM r212586 with
     a flag that's not actually available everywhere.

  2) Dogfood clang's new -Wdate-time warning from r210511 when bootstrapping.

  3) Encourage reproducible builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212587 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-09 03:39:32 +00:00
Alp Toker
b1d6b8ea7d CMake: fix compiler feature detection
add_flag_if_supported() and add_flag_or_print_warning() were effectively
no-ops, just returning the value of the first result (usually
'-fno-omit-frame-pointer') for all subsequent checks for different flags.

Due to the way CMake caches feature detection results, we need to provide
symbolic variable names which will persist the cached results. This commit
fixes feature detection using these two macros.

The feature checks now run and get stored correctly, and the correct output can
be observed in configure logs:

  -- Performing Test C_SUPPORTS_FPIC
  -- Performing Test C_SUPPORTS_FPIC - Success
  -- Performing Test CXX_SUPPORTS_FPIC
  -- Performing Test CXX_SUPPORTS_FPIC - Success

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212586 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-09 03:38:19 +00:00
NAKAMURA Takumi
7ca91f97cc [CMake] Introduce LLVM_ENABLE_PLUGINS as an internal option. BUILD_SHARED_LIBS may not control enable/disable plugins.
FIXME: Make this configurable.

FIXME: "ENABLE_SHARED" doesn't make sense, since it is used just for plugins. We may rename it.
I introduced config.enable_shared in r120273.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212315 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-04 04:45:40 +00:00
NAKAMURA Takumi
1f8525a98f [CMake] Introduce LLVM_SHLIB_OUTPUT_INTDIR.
For now, its user is configure_lit_site_cfg().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212314 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-04 04:23:26 +00:00
NAKAMURA Takumi
a84cb68aad [CMake] Fix set_output_directory to do nothing if *_OUTPUT_INTDIR was not given.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212313 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-04 04:23:15 +00:00
Reid Kleckner
4a295dfbf9 cmake: Don't do anything for LLVM_ENABLE_ASSERTIONS=OFF
By default, CMake will set NDEBUG in Rel* builds and leave it off in
debug builds, so we shouldn't need to do anything ourselves.

Before this change, it was possible to a Debug build without assertions
(aka Debug-Asserts in the autoconf system) by configuring with
-DLLVM_ENABLE_ASSERTIONS=OFF, but this configuration isn't very useful.
You can still get the same effect by explicitly adding -DNDEBUG to
CFLAGS.

Differential Revision: http://reviews.llvm.org/D4257

Patch by Janusz Sobczak!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211919 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-27 18:17:30 +00:00
Alp Toker
dc4c7fb098 Remove clang-specific libxml2 check from CMake
clang's own CMake setup handles this as of r210308.

The CMAKE_CROSSCOMPILING special-case will no longer be hard-coded. This was
clearly site-specific to someone's local configuration and should be passed in
at configure time if needed with e.g. -DLIBXML2_LIBRARIES=... (the libxml2
target I tried here doesn't even support liblzma so it's *way* off).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210309 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-06 05:08:42 +00:00
Alp Toker
04de60e28f GraphWriter: detect graph viewer programs at runtime
Replace the crufty build-time configure checks for program paths with
equivalent runtime logic.

This lets users install graphing tools as needed without having to reconfigure
and rebuild LLVM, while eliminating a long chain of inappropriate compile
dependencies that included GUI programs and the windowing system.

Additional features:

 * Support the OS X 'open' command to view graphs generated by any of the
   Graphviz utilities. This is an alternative to the Graphviz OS X UI which is
   no longer available on Mountain Lion.

 * Produce informative log output upon failure to indicate which programs can
   be installed to view graphs.

Ping me if this doesn't work for your particular environment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210001 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-02 01:40:04 +00:00
Tim Northover
29f94c7201 AArch64/ARM64: move ARM64 into AArch64's place
This commit starts with a "git mv ARM64 AArch64" and continues out
from there, renaming the C++ classes, intrinsics, and other
target-local objects for consistency.

"ARM64" test directories are also moved, and tests that began their
life in ARM64 use an arm64 triple, those from AArch64 use an aarch64
triple. Both should be equivalent though.

This finishes the AArch64 merge, and everyone should feel free to
continue committing as normal now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209577 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-24 12:50:23 +00:00
Greg Fitzgerald
03b003b1cb Use llvm-lit if LLVM source tree is unavailable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209308 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-21 16:44:03 +00:00
Reid Kleckner
37b0592215 cmake: Remove -D NDEBUG from CFLAGS as well as CXXFLAGS
This silences ~7 warnings on .c files in the LLVM build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209163 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-19 21:13:41 +00:00
Evgeniy Stepanov
0e8c40d643 Disable -Wcomment when building with GCC.
GCC version of -Wcomment is not compatible with ascii art graph diagrams.

Reverts r207629.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208073 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-06 09:46:06 +00:00
Dan Liew
00f0627f76 Teach add_sphinx_target() to respect the LLVM_INSTALL_TOOLCHAIN_ONLY CMake
option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207450 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-28 22:06:20 +00:00
Dan Liew
859530fba6 If building with LLVM_ENABLE_DOXYGEN and using CMake then
abort while configuring if doxygen could not be found. This
is desirable because if the build is going to fail then it should
fail as early as possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207404 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-28 09:10:05 +00:00
Reid Kleckner
4c464def6a Added Sphinx documentation generation to CMake build system.
The option LLVM_ENABLE_SPHINX option enables the "docs-llvm-html",
"docs-llvm-man" targets but does not build them by default. The
following CMake options have been added that control what targets are
made available

SPHINX_OUTPUT_HTML
SPHINX_OUTPUT_MAN

If LLVM_BUILD_DOCS is enabled then the enabled docs-llvm-* targets will
be built by default and if ``make install`` is run then docs-llvm-html
and docs-llvm-man will be installed (tested on Linux only).

The add_sphinx_target function is in its own file so it can be included
by other projects that use Sphinx for their documentation.

Patch by Daniel Liew <daniel.liew@imperial.ac.uk>!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206655 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-18 21:45:25 +00:00
Eric Christopher
0fa7dc4762 Teach LLVMConfigVersion.cmake to behave as find_package() expects.
Patch by Brad King

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206426 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16 23:15:31 +00:00
Eric Christopher
8e589975ea Add support for a patch version to the cmake system.
Patch by Brad King

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206425 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-16 23:15:28 +00:00
NAKAMURA Takumi
f0aeabb5a6 AddLLVM: Mute the prefix "lib" in SHARED on win32.
- LLVMSupport.dll
  - libLLVMSupport.dll.a

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205969 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-10 15:47:04 +00:00
Viktor Kutuzov
d97cbff528 Add support for building LLVM on FreeBSD 9.2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205847 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-09 11:43:34 +00:00
Tim Northover
7b837d8c75 ARM64: initial backend import
This adds a second implementation of the AArch64 architecture to LLVM,
accessible in parallel via the "arm64" triple. The plan over the
coming weeks & months is to merge the two into a single backend,
during which time thorough code review should naturally occur.

Everything will be easier with the target in-tree though, hence this
commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205090 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-29 10:18:08 +00:00
Hans Wennborg
b0a50a3f29 Win installer: provide a pretty icon
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204960 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-27 20:48:37 +00:00
Yaron Keren
6e2aab69a6 Remove cmake module support for Visual C++ 2010 (MSVC10)
but keep the MSVC11 (Visual C++ 2012) support.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204706 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 09:34:20 +00:00
Yaron Keren
d8ceb275c2 Disable Visual C++ warning 4722 about aborting a destructor,
it has no value for us.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204704 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-25 08:42:49 +00:00
NAKAMURA Takumi
7d5c4cbc71 [CMake][cygming] Disable --out-implib from executables.
It doesn't make sense even with --export-all-symbols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204017 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-16 13:51:24 +00:00
Alexey Samsonov
b9aefe6d09 [CMake] Put -Werror to CMAKE_CXX_FLAGS instead of using add_llvm_definitions()
add_definitions shouldn't really be used for compiler flags, and the variable
LLVM_DEFINITIONS is not appropriately used at the moment, e.g. it's not exported
to LLVMConfig.cmake


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203792 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13 13:08:47 +00:00
Ted Kremenek
ec7eedc5db [CMake] Enable a bunch of Xcode build settings that correspond to warnings that are for the most part enabled by default either by Clang or -Wall.
I personally build with these settings enabled all the time, and it
is clearer to see the actual warning flags (e.g., -Wuninitialized)
get passed by Xcode rather than seeing -Wno-uninitialized followed
by -Wall (the latter canceling out the former) and figuring out
what is going on.

Xcode will ignore build settings it doesn't understand, so this will
work on possibly older versions of Xcode that don't support all
of these settings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203760 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-13 06:37:28 +00:00
Rafael Espindola
3f06e3f55f Use -std=gnu++11 on cygwin and mingw.
Without this common features like off_t and strdup are missing.
This should bring back those bots.

Configure bits by Meador Inge.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203701 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-12 20:01:15 +00:00
NAKAMURA Takumi
230036c610 [CMake] add_llvm_target(): No need to include TABLEGEN_OUTPUT in source list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202862 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 17:05:28 +00:00
Chandler Carruth
b23750a8ae [C++11] Switch the CMake option from LLVM_ENABLE_CXX11 (default on) to
LLVM_ENABLE_CXX1Y (default *off*). =D C++98 is dead. Long live C++11.

I don't exactly recommend using C++1y just yet though...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202567 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-01 03:16:07 +00:00
Rafael Espindola
fc6cc0edd6 With rpaths being set correctly, SHLIBPATH_VAR is not needed anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202510 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-28 16:16:51 +00:00
NAKAMURA Takumi
d477e841dc [CMake] llvm_add_library(SHARED|STATIC): Fix broken OUTPUT_NAME for *_static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202454 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-28 00:28:13 +00:00
NAKAMURA Takumi
2e0d7a9337 [CMake] Work around to use target_link_libraries(PUBLIC) in BUILD_SHARED_LIBS mode.
FIXME: It may be PRIVATE since SO knows its dependent libs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202261 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-26 11:58:11 +00:00
NAKAMURA Takumi
8571df6ae5 [CMake] Move LLVMBUILD_LIB_DEPS stuff from add_llvm_library (and LLVm-Config) to llvm_add_library to centralize target_link_libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202260 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-26 11:58:01 +00:00