Commit Graph

701 Commits

Author SHA1 Message Date
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
NAKAMURA Takumi
07f95b3218 [CMake] Use target_link_libraries(INTERFACE|PRIVATE) on CMake-2.8.12 to increase opportunity for parallel build.
target_link_libraries(INTERFACE) doesn't bring inter-target dependencies in add_library,
although final targets have dependencies to whole dependent libraries.
It makes most libraries can be built in parallel.

target_link_libraries(PRIVATE) is used to shaared library.
Each dependent library is linked to the target.so, and its user will not see its grandchildren.
For example,

  - libclang.so has sufficient libclang*.a(s).
  - c-index-test requires just only libclang.so.

FIXME: lld is tweaked minimally. Adding INTERFACE in each library would be better thing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202241 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-26 06:53:16 +00:00
NAKAMURA Takumi
46e8559826 TableGen.cmake: Functionalize and reformat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201972 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-23 12:54:15 +00:00
NAKAMURA Takumi
043cc54d6c Simplify linking to system libraries
The LLVMSupport library implementation consolidates all dependencies on
system libraries.  Move the logic gathering system libraries out of
'cmake/modules/LLVM-Config.cmake' and into 'lib/Support/CMakeLists.txt'.
Use the target_link_libraries() command there to tell CMake about the
link dependencies of the LLVMSupport implementation.  CMake will
automatically propagate this to all targets that link LLVMSupport
directly or indirectly.

We still need to build knowledge of system library dependencies into
'llvm-config'.  Store the list of libraries needed in a property on
LLVMSupport and teach 'tools/llvm-config/CMakeLists.txt' to retrieve it
from there.

Drop all calls to 'link_system_libs' and 'get_system_libs' from our
CMake code.  Replace their implementations with a warning that explains
the calls are no longer necessary.  Also drop from 'LLVMConfig.cmake'
the HAVE_* and related variables that were published there only to allow
'get_system_libs' to run outside our build process.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201969 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-23 06:27:04 +00:00
NAKAMURA Takumi
a7101ebc86 Prune debug message in AddLLVM.cmake.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201932 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-22 07:31:10 +00:00
NAKAMURA Takumi
6be6579352 [CMake] llvm_add_library: Add dependencies also to objlibs as workaround of CMake issue 14747.
http://www.cmake.org/Bug/view.php?id=14747

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201855 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21 14:17:29 +00:00
NAKAMURA Takumi
1901ee61d5 [CMake] Introduce "llvm_add_library(SHARED STATIC)" to build both shared lib and static lib simulataneously.
llvm_add_library(foo SHARED STATIC
    DEPENDS <dependent targets...>
    LINK_LIBS <required libraries...>
    )

It generates both foo (foo.so) and foo_static(foo.a) and both of them depend on DEPENDS and LINK_LIBS.
Then, also obj.foo is generated. obj.foo depends on DEPENDS, but doesn't depend on LINK_LIBS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201854 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21 14:17:17 +00:00
NAKAMURA Takumi
6eeedf33d5 Teach LLVM-Config to use logical target names (2/2)
The module still needs to collect the list of all available libraries
in order to satisfy the 'all' component.  Provide this in the package
configuration file, 'LLVMConfig.cmake', as a LLVM_AVAILABLE_LIBS
variable.  (A variable is scoped better than a global property.)
Since this won't be set for our own build, fall back to looking up the
LLVM_LIBS property to get the value when it is not set.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201853 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21 14:17:07 +00:00
NAKAMURA Takumi
83782f2571 Teach LLVM-Config to use logical target names (1/2)
LLVM library names are now available as logical CMake targets both
to our own build and to application CMake code.  Replace use of
'list(FIND)' with a simple 'if(TARGET)' to determine whether a
library is available.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201852 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21 14:16:52 +00:00
NAKAMURA Takumi
1e3bb3fc41 [CMake] Move intrinsics_gen to lib/Target out of add_public_tablegen_target.
add_public_tablegen_target is used somewhere.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-20 13:42:30 +00:00
Evgeniy Stepanov
b584e193b5 Unconditionally include msan_interface.h when building with MSan.
Any version of Clang that does not provide this header is way too old to
bootstrap with MSan.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201776 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-20 11:37:03 +00:00
Evgeniy Stepanov
84d5a235fd Build PIE binaries when cross-compiling to Android.
This change also removes CMAKE_LINK_FLAGS setting that seems to be ignored by cmake.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201654 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-19 09:51:22 +00:00
NAKAMURA Takumi
789f722abd LLVMExports.cmake: Add System libs $(LIBS) to LLVMSupport, corresponding to r201077.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201489 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-16 12:14:13 +00:00
NAKAMURA Takumi
88fae4e86f LLVMExports.cmake: Exclude gtest since they are not installed.
FIXME: gtest might be included if external project could refer to the build tree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201488 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-16 12:14:03 +00:00
NAKAMURA Takumi
621c80f4d7 [CMake] Let llvm_add_library(MODULE) check capability of loadable module.
On unsupported platforms, llvm_add_library(MODULE) doesn't create any targets.
Caller may be responsible to check and add extra target properties.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201320 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 11:25:17 +00:00
NAKAMURA Takumi
069bd29ec4 [CMake] Move the target property PREFIX from add_llvm_loadable_module() to llvm_add_library().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201318 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 11:19:21 +00:00
NAKAMURA Takumi
74c3f7dc5b [CMake] llvm_add_library(MODULE) may use CMAKE_MODULE_LINKER_FLAGS instead of target property LINK_FLAGS.
I mis-dropped Darwin's link flags (in clang side) since r201073.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201317 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 11:19:11 +00:00
NAKAMURA Takumi
38a10d0596 [CMake] LLVM_PLUGIN_EXT: Use CMAKE_SHARED_LIBRARY_SUFFIX rather than CMAKE_SHARED_MODULE_SUFFIX in llvm tree.
FIXME: llvm/test may be aware of LLVM_PLUGIN_EXT, like as clang/test does.
FIXME: CMAKE_*_SUFFIX may be set in HandleLLVMOptions if those variables could be writable, rather than to set one as target properties.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201316 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 11:19:00 +00:00
NAKAMURA Takumi
571417b8a3 [CMake] llvm_add_library: Add handling of the parameter ADDITIONAL_HEADERS to pass through to process_source.
I was insightless then about unknown optional parameters.
(Consider that LINK_LIBS foo bar ADDITIONAL_HEADERS qux quux)

Suggested by Michael Kruse. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201283 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 01:00:52 +00:00
NAKAMURA Takumi
dd5ff1bf41 Teach tablegen() macro to check needed variables
This macro depends on several variables to be set in the calling
context.  Check them and report an error if they are not set.
Without this, custom commands may be silently specified that
will fail at build time.

Patch by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201229 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-12 11:50:11 +00:00
Reid Kleckner
b89b11926c cmake: Do not export targets when installing toolchain only
Patch by Brad King!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201111 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-10 20:44:57 +00:00
NAKAMURA Takumi
fdc6308fa1 [CMake] LLVMSupport should be responsible to provide system_libs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201077 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-10 10:52:19 +00:00
NAKAMURA Takumi
0eefad30d4 [CMake] Introduce llvm_add_library().
- MODULE;SHARED;STATIC
      STATIC by default w/o BUILD_SHARED_LIBS.
      SHARED by default w/  BUILD_SHARED_LIBS.
  - OUTPUT_NAME name
      Corresponds to OUTPUT_NAME in target properties.
  - DEPENDS targets...
      Same semantics as add_dependencies().
  - LINK_COMPONENTS components...
      Same as the variable LLVM_LINK_COMPONENTS.
  - LINK_LIBS lib_targets...
      Same semantics as target_link_libraries().
  - ADDITIONAL_HEADERS (implemented in LLVMProcessSources)
      May specify header files for IDE generators.

I suggest llvm_add_library() may be used for inter-project add_library stuff
and also suggest add_***_library() may be used project-specific.

Please be patient that llvm_add_library might be ambiguous against add_llvm_library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201072 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-10 09:05:11 +00:00
NAKAMURA Takumi
70fda366a9 [CMake] LLVMProcessSources.cmake: Prune add_file_dependencies to ${TABLEGEN_OUTPUT}.
I am sure it'd not be required any more.
In trunk, all of tablegen's users depend on ${TABLEGEN_OUTPUT} as not file dependency but inter-target dependency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201063 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-10 03:24:28 +00:00
NAKAMURA Takumi
b1e7bec958 [CMake] Re-apply r200765, "Get rid of llvm_config() to expand dependencies."
CMake's target_link_libraries() will manage dependencies with Brad's LLVMConfig improvements.

Configuration time may be reduced by a few seconds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201062 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-10 03:24:19 +00:00
Bob Wilson
a4122f4746 Remove shell comment in the middle of a single-line command.
You can't put a comment in the middle of a command like this. This is
invalid shell syntax and breaks the build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201057 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-09 22:36:31 +00:00
NAKAMURA Takumi
911a491cb3 Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201054 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-09 16:38:31 +00:00
NAKAMURA Takumi
4c56efbd44 Provide CMake package modules in install tree
Teach the Makefile build system to generate and install CMake modules
LLVMConfig.cmake and LLVMConfigVersion.cmake so that applications that
build with CMake can use 'find_package(LLVM)' even when LLVM is not
built with CMake.  These modules tell such applications about available
LLVM libraries and their dependencies.

Run llvm-config to generate the list of libraries and use the results of
llvm-build to generate the library dependencies.  Use sed to perform
substitutions in the LLVMConfig.cmake.in and LLVMConfigVersion.cmake.in
sources that our CMake build system uses.

Teach the Makefile build system to generate the LLVMExports.cmake file
with content similar to that produced by the CMake install(EXPORT)
command.  Extend llvm-build with an option to generate the library
dependencies fragment for this file.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201053 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-09 16:37:02 +00:00
NAKAMURA Takumi
3e308c868e Load exported lib and exe targets from LLVMConfig
Teach each package configuration file to load the LLVMExports file for
its corresponding tree.  This will allow application CMake code to use
logical library and executable target names from LLVM as if they were in
our own build process (e.g. LLVMSupport).  CMake will have enough
information to propagate LLVM library link dependencies automatically
while configuring applications.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201051 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-09 16:36:28 +00:00
NAKAMURA Takumi
5778c9eb63 Export lib and exe build target names from build tree
Record every logical target that we install with install(TARGETS) in a
global LLVM_EXPORTS property.  Then use the export(TARGETS) command to
provide a "LLVMExports.cmake" file that exports logical targets for
import into applications directly from our build tree.

The "LLVMExports.cmake" file is not meant for direct inclusion by
application code but should be included by "LLVMConfig.cmake" in a
future change.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201050 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-09 16:36:16 +00:00
NAKAMURA Takumi
39fcc71463 Export lib and exe build target names from install tree
Use the install(TARGETS) command EXPORT option for every library and
executable that we install with LLVM.  Then use the install(EXPORT)
command to provide a "LLVMExports.cmake" file that exports logical
targets for import into applications from our install tree.

The "LLVMExports.cmake" file is not meant for direct inclusion by
application code but should be included by "LLVMConfig.cmake" in a
future change.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201049 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-09 16:36:03 +00:00
NAKAMURA Takumi
24ef854ac8 Provide LLVMConfig in both build and install tree
Create separate package configuration files "LLVMConfig.cmake" for the
LLVM build and install trees so that each can have information specific
to its tree.  Configure each with the corresponding include, lib, and
cmake directories.  Include the "LLVM-Config" API modules directly from
the configured cmake modules directory.

In the install tree, compute the installation prefix relative to the
file location.  In the build tree, provide information specific to the
build tree for use by tools like Clang that can build externally against
the LLVM build tree.  Prefix such values in "LLVM_BUILD_" and comment
them as such.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201048 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-09 16:35:51 +00:00
NAKAMURA Takumi
6574a84331 Teach LLVMConfig to avoid modifying CMAKE_MODULE_PATH
Do not modify this value on the application's behalf and just ensure API
modules are always available next to the LLVMConfig module.  This is
already the case in the install tree so use file(COPY) to make it so in
the build tree.  Include the LLVM-Config API module from next to the
LLVMConfig location.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201047 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-09 16:35:40 +00:00
NAKAMURA Takumi
5534cb3f57 De-duplicate references to share/llvm/cmake path
Use a LLVM_INSTALL_PACKAGE_DIR variable to hold the path and reference
it where necessary.

Contributed by Brad King.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201046 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-09 16:35:29 +00:00
Todd Fiala
9cd9208565 Fix configure to find arc4random via header files.
ISSUE:

On Ubuntu 12.04 LTS, arc4random is provided by libbsd.so, which is a
transitive dependency of libedit. If a system had libedit on it that
was implemented in terms of libbsd.so, then the arc4random test,
previously implemented as a linker test, would succeed with -ledit.
However, on Ubuntu this would also require a #include <bsd/stdlib.h>.
This caused a build breakage on configure-based Ubuntu 12.04 with
libedit installed.

FIX:

This fix changes configure to test for arc4random by searching for it
in the standard header files. On Ubuntu 12.04, this test now properly
fails to find arc4random as it is not defined in the default header
locations. It also tweaks the #define names to match the output of the
header check command, which is slightly different than the linker
function check #defines.

I tested the following scenarios:

(1) Ubuntu 12.04 without the libedit package [did not find arc4random,
as expected]

(2) Ubuntu 12.04 with libedit package [properly did not find
arc4random, as expected]

(3) Ubuntu 12.04 with most recent libedit, custom built, and not
dependent on libbsd.so [properly did not find arc4random, as
expected].

(4) FreeBSD 10.0B1 [properly found arc4random, as expected]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200819 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-05 05:04:36 +00:00
Jordan Rose
ab70fcff6b [CMake] Deliberately get all LLVM library dependencies for standalone builds.
CMake won't expand the dependency graph for us if the dependencies are in
another project, which leads to link errors in the standalone build.
This is a refinement of r200765.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200812 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-05 00:02:42 +00:00