1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

993 Commits

Author SHA1 Message Date
NAKAMURA Takumi
0ff6f8a2a4 [autoconf] Install VersionFromVCS.cmake, too. clang/CMakeLists.txt requires it.
llvm-svn: 257856
2016-01-15 02:13:04 +00:00
Chris Bieneman
2de1f4cb59 [CMake] Add support for populating LLVM_REPOSITORY from CMake.
Autoconf does this in the GetRepositoryPath script, CMake's VersionFromVCS does grab the SVN_REVISION, but doesn't populate the repository URL.

llvm-svn: 257826
2016-01-14 22:44:29 +00:00
Axel Naumann
04fcf95002 Explicitly enable OBJECT library "target".
With this, one can build a lib from the objects of other libs:
set(SOURCES
  $<TARGET_OBJECTS:obj.clingInterpreter>
  $<TARGET_OBJECTS:obj.clingMetaProcessor>
  $<TARGET_OBJECTS:obj.clingUtils>
  )

Reviewed by Chris Bieneman - thanks!

llvm-svn: 257459
2016-01-12 07:44:58 +00:00
Andrew Wilkins
a734d141fe Revert r257003
This revision breaks llvm-config if you set
BUILD_SHARED_LIBS=on in a CMake build. Backing
out until the fix is ready to land.

llvm-svn: 257457
2016-01-12 07:23:58 +00:00
Andrew Wilkins
51a57d89a6 tools/llvm-config: improve shared library support
Summary:
r252532 added support for reporting the monolithic library
when LLVM_BUILD_LLVM_DYLIB is used. This would only be done
if the individual components were not found, and the dynamic
library is found.

This diff extends this as follows:
 - If LLVM_LINK_LLVM_DYLIB is set, then prefer the shared
   library, even if all component libraries exist.
 - Two flags, --link-shared and --link-static are introduced
   to provide explicit guidance. If --link-shared is passed
   and the shared library does not exist, an error results.

Additionally, changed the expected shared library names from
(e.g.) LLVM-3.8.0 to LLVM-3.8. The former exists only in an
installation (and then only in CMake builds I think?), and not
in the build tree; this breaks usage of llvm-config during
builds, e.g. by llvm-go.

Reviewers: DiamondLovesYou, beanz

Subscribers: llvm-commits

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

llvm-svn: 257003
2016-01-07 00:18:56 +00:00
Nico Weber
f2a28338f0 Make WinCOFFObjectWriter.cpp's timestamp writing not use ENABLE_TIMESTAMPS
LLVM_ENABLE_TIMESTAMPS controls if timestamps are embedded into llvm's
binaries. Turning it off is useful for deterministic builds.

r246905 made it so that the define suddenly also controls if the binaries that
the llvm binaries _create_ embed timestamps or not – but this shouldn't be a
configure-time option. r256203/r256204 added a driver option to toggle this on
and off, so this patch now passes this driver option in LLVM_ENABLE_TIMESTAMPS
builds so that if LLVM_ENABLE_TIMESTAMPS is set, the build of LLVM is
deterministic – but the built clang can still write timestamps into other
executables when requested.

This also allows removing some of the test machinery added in r292012 to work
around this problem.

See PR24740 for background.
http://reviews.llvm.org/D15783

llvm-svn: 256958
2016-01-06 19:05:19 +00:00
Aaron Ballman
0e898e92c4 Reverting r256836; it causes a build bot failure: http://lab.llvm.org:8011/builders/lldb-x86-win7-msvc/builds/14050/steps/build/logs/stdio
llvm-svn: 256837
2016-01-05 14:35:01 +00:00
Aaron Ballman
a446e7a779 Enable more strict standards conformance in MSVC for rvalue casting and string literal type conversion to non-const types. Also enables generation of intrinsics for more functions.
Patch by Alexander Riccio

llvm-svn: 256836
2016-01-05 14:24:01 +00:00
Nico Weber
4d29f9cae5 win: Pass /W4 in front of all the -wd flags.
This should fix many many -Wunused-parameter warnings in self-host builds on
Windows after r255382.  cl.exe doesn't care about the order of /W4 and
/wd flags, but clang-cl currently does (just like -Wno-foo -Wall order
matters for clang).  We might want to change how clang-cl behaves in
the future, but until then this change makes self-host builds much more
silent.

llvm-svn: 256315
2015-12-23 02:38:31 +00:00
Andy Gibbs
d9ba2c9d06 Revert r254592 (virtual dtor in SCEVPredicate).
Clang has better diagnostics in this case.  It is not necessary therefore
to change the destructor to avoid what is effectively an invalid warning
in gcc.  Instead, better handle the warning flags given to the compiler.

llvm-svn: 255905
2015-12-17 16:43:53 +00:00
Sumanth Gundapaneni
947a2bf7c3 Install runtime dlls in the INSTALL_DIR/bin directory. NFC
One of the earlier patches updated the cmake rule to install the
runtime dlls in INSTALL_DIR/lib which is not correct. This patch
updates the rule to install CMake's RUNTIME in bin directory
Differential Revision: http://reviews.llvm.org/D15505

llvm-svn: 255781
2015-12-16 17:07:15 +00:00
Chris Bieneman
28da4411df [CMake] Add LLVM_BUILD_INSTRUMENTED option to enable building with -fprofile-instr-generate
This is the first step in supporting PGO data generation via CMake. I've marked the option as advanced and experimental until it is fleshed out further.

llvm-svn: 255298
2015-12-10 21:19:07 +00:00
Chris Bieneman
b9a96af62d [CMake] Ignore externalizing debuginfo for unit tests
If you externalize debug info for unit tests the test runner finds the mach-o inside the dsym bundle and tries to execute it as a test.

llvm-svn: 255056
2015-12-08 21:51:48 +00:00
Aaron Ballman
96865a146b Silence all C4592 warnings with MSVC 2015 Update 1. This warning produces false positives that Microsoft says will be fixed in Update 2. Until this produces reliable diagnostics, it is safe to disable the diagnostic -- the compiler is not doing anything different than it previously did aside from issuing the diagnostic.
(Note, this silences at least one false positive in LLVM with FeatureBitset uses.)

llvm-svn: 254915
2015-12-07 15:44:34 +00:00
Chris Bieneman
3c356b4f56 [CMake] Fixing bots
CMake calls to set_property with APPEND string need to have a leading space.

llvm-svn: 254659
2015-12-03 22:55:36 +00:00
Chris Bieneman
00f689303f [CMake] set_target_properties doesn't append link flags
This fixes a bug introduced in r254627, and another occurance of the same bug in this file.

llvm-svn: 254657
2015-12-03 22:51:08 +00:00
Chris Bieneman
57f58fbc10 [CMake] Removing an unnecessary layer of variable indirection
This prevents passthrough variables from having values.

llvm-svn: 254641
2015-12-03 19:47:04 +00:00
Chris Bieneman
fa052602ba [CMake] Add option LLVM_EXTERNALIZE_DEBUGINFO
Summary: This adds support for generating dSYM files and stripping debug info from executables and dylibs. It also supports passing -object_path_lto to the linker to generate dSYMs for LTO builds.

Reviewers: bogner, friss

Subscribers: llvm-commits

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

llvm-svn: 254627
2015-12-03 18:45:39 +00:00
Pavel Labath
f570e610a0 Fix non-PIC build after 253959
CMAKE_EXE_LINKER_FLAGS is a string. Appending a flag using list(APPEND) introduces an extra
semicolon which breaks stuff. Change this to append the value in the same way that everyone else
seems to be doing.

llvm-svn: 253968
2015-11-24 09:46:01 +00:00
Chris Bieneman
fc7b01b423 [CMake] When disabling PIC, also pass -fno-pie when linking if it is supported.
Building clang with -fno-pie generates slightly faster code. In my not-very-rigorous testing I saw about a 4% speed up using the clang test-suite sources.

llvm-svn: 253959
2015-11-24 08:04:59 +00:00
Chris Bieneman
a03449653c [CMake] export_executable_symbols also needs to add -rdynamic to the linker flags on Darwin
Without -rdynamic LLVM built with LTO fails to pass "check" due to loadable modules failing.

llvm-svn: 253944
2015-11-24 00:58:58 +00:00
Chris Bieneman
88e7e42aae NFC. Fixing my consistently incorrect spelling.
llvm-svn: 253936
2015-11-23 23:34:09 +00:00
Yaron Keren
762fa03531 Unbreak build on OpenBSD by not adding -Wl,-z,defs to linker flags.
This is similar to the fix for FreeBSD in r226862. Without this patch,
the build aborts when linkling libLTO.so, complaining about undefined
references to assert2, cxa_atexit, etc.

Patch by Stefan Kempf!

http://reviews.llvm.org/D14236

llvm-svn: 253769
2015-11-21 06:33:54 +00:00
Chris Bieneman
d9f3ae9820 [CMake] Fix handling of passing through semi-colon separated lists.
When passing around CMake arguments as lists of arguments any arguments containing lists need to have their semi-colons escaped otherwise CMake will split the arguments in the middle.

llvm-svn: 253719
2015-11-20 22:08:49 +00:00
Reid Kleckner
131251d95d Don't search for third party libraries while using MSan
On the average user's system, those libraries will not be compiled with
MSan. Prior to this change, the LLVM test suite was full of false
positives from calls from third party libraries to MSan interceptors
like strlen.

We can remove this check if MSan ever grows a suppression mechanism
similar to TSan's.

llvm-svn: 253526
2015-11-19 00:05:21 +00:00
Chris Bieneman
76a5e53fc4 [CMake] Support -fvisibility-inlines-hidden when LLVM_ENABLE_PIC=Off
I'm unaware of any reasons why -fvisibility-inlines-hidden would depend on PIC, and since autoconf supports this flag without PIC, we should support it in CMake too.

llvm-svn: 253517
2015-11-18 22:49:26 +00:00
NAKAMURA Takumi
03c82bdb8b LLVM_ENABLE_MODULES: No need to set -fcxx-modules in trunk, just -fmodules.
llvm-svn: 252996
2015-11-13 01:26:31 +00:00
Chris Bieneman
59a6ab650e [CMake] Fixing passthrough for variables starting with the sub-project name
This allows TEST_SUITE variables to be passed from the top-level CMake into the external project.

llvm-svn: 252810
2015-11-11 21:54:31 +00:00
Chris Bieneman
eb8c2f9160 [CMake] Make llvm_install_library_symlink respect LLVM_LIBDIR_SUFFIX.
This is required to support multilib install targets, and addresses a regression introduced in r252093.

llvm-svn: 252749
2015-11-11 16:19:39 +00:00
Chris Bieneman
610384b321 [CMake] Add support for building the llvm test-suite as part of an LLVM build using clang and lld
Summary:
This patch adds a new CMake module for working with ExternalProjects. This wrapper for ExternalProject supports using just-built tools and can hook up dependencies properly so that projects get cleared out.

The example usage here is for the llvm test-suite. In this example, the test-suite is setup as dependent on clang and lld if they are in-tree. If the clang or lld binaries change the test-suite is re-configured, cleaned, and rebuilt.

This cleanup and abstraction wrapping ExternalProject can be extended and applied to other runtime libraries like compiler-rt and libcxx.

Reviewers: samsonov, jroelofs, rengolin, jmolloy

Subscribers: jmolloy, llvm-commits

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

llvm-svn: 252747
2015-11-11 16:14:03 +00:00
Andrew Wilkins
c444ebb143 [cmake] move SONAME handling to llvm_add_library
Summary:
Move handling of the SONAME option from add_llvm_library
to llvm_add_library, so that it can be used in sub-projects.
In particular, this makes it possible to have consistently
named shared libraries for LLVM, Clang and LLDB.

Also, base the SONAME and symlinks on the output name
by extracting the OUTPUT_NAME property, rather than assuming
it is the same as the target name.

Reviewers: beanz

Subscribers: llvm-commits

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

llvm-svn: 252669
2015-11-10 23:19:21 +00:00
Ramkumar Ramachandra
d29ac7efe7 AddLLVM: squelch CMP0007 by not adding empty elements to list
When configuring various llvm projects that use AddLLVM.cmake, this warning is
emitted many times, flooding the screen:

Policy CMP0007 is not set: list command no longer ignores empty elements.

The fix is removing an extra semicolon.

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

llvm-svn: 252628
2015-11-10 18:26:34 +00:00
Chris Bieneman
c127f2db5e [CMake] Bug 25059 - CMake libllvm.so.$MAJOR.$MINOR shared object name not compatible with ldconfig
Summary:
This change makes the CMake build system generate libraries for Linux and Darwin matching the makefile build system.

Linux libraries follow the pattern lib${name}.${MAJOR}.${MINOR}.so so that ldconfig won't pick it up incorrectly.

Darwin libraries are not versioned.

Note: On linux the non-versioned symlink is generated at install-time not build time. I plan to fix that eventually, but I expect that is good enough for the purposes of fixing this bug.

Reviewers: loladiro, tstellarAMD

Subscribers: axw, llvm-commits

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

llvm-svn: 252093
2015-11-04 23:11:12 +00:00
Tom Stellard
9c18b9c83d llvm-config: Add --has-rtti option
Summary:
This prints NO if LLVM was built with -fno-rtti or an equivalent flag
and YES otherwise.  The reasons to add -has-rtti rather than adding -fno-rtti
to --cxxflags are:

1. Building LLVM with -fno-rtti does not always mean that client
applications need this flag.

2. Some compilers have a different flag for disabling rtti, and the
compiler being used to build LLVM may not be the compiler being used to
build the application.

Reviewers: echristo, chandlerc, beanz

Subscribers: llvm-commits

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

llvm-svn: 252075
2015-11-04 20:57:43 +00:00
David Blaikie
bd89751462 Revert parts accidentally included in r251823
llvm-svn: 251826
2015-11-02 20:05:54 +00:00
David Blaikie
a98b9cfa54 StringRef-ify DiagnosticInfoSampleProfile::Filename
llvm-svn: 251823
2015-11-02 20:01:13 +00:00
Chris Bieneman
ac8e8a99a1 [CMake] Fixing dependency issue with parallel make when building with LLVM_OPTIMIZED_TABLEGEN.
Patch by Alex Wang

llvm-svn: 251138
2015-10-23 19:48:17 +00:00
Manuel Klimek
a014a467dc Fix add_llvm_external_project.
r250835 unintentionally discarded the optional parameter to the
add_llvm_external_project() macro that may point to a path when the said
path is different from ${name}. This should fix it by passing ${ARGN} on
to add_llvm_subdirectory(). The problem manifests itself with e.g.
add_llvm_external_project(clang-tools-extra extra) from
clang/tools/CMakeLists.txt

Patch by Luchesar V. Iliev.

llvm-svn: 251001
2015-10-22 08:31:46 +00:00
Chris Bieneman
fc5c467cf1 [CMake] Refactor subdirectory inclusion code to take a project name.
Summary:
This refactoring makes some of the code used to control including subdirectories parameterized so it can be re-used elsewhere.

Specifically I want to re-use this code in clang to be able to turn off specific tool subdirectories.

Reviewers: chapuni, filcab, bogner, Bigcheese

Subscribers: emaste, llvm-commits

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

llvm-svn: 250835
2015-10-20 16:42:58 +00:00
Chris Bieneman
f6944257e9 [CMake] Cleaning up and generalizing the LLVMInstallSymlink script so that it can be used for libraries too.
In order to resolve PR25059, we're going to need to be able to generate symlinks to libraries manually, so I need this code to be reusable.

llvm-svn: 250573
2015-10-16 23:17:13 +00:00
Eric Fiselier
064bc4af87 Split -pedantic and -Wno-long-long into two separate flags so libc++ can remove -pedantic
llvm-svn: 250255
2015-10-13 23:51:58 +00:00
Pawel Bylica
51dcd3d0fd cmake: Avoid leading space in LLVM_DEFINITIONS.
Summary: Unnecessary space at the beginning of LLVM_DEFINITIONS in cmake shared files can break projects that use the variable.

Subscribers: llvm-commits

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

llvm-svn: 250025
2015-10-12 10:42:03 +00:00
Chris Bieneman
b8bce812e5 [CMake] Parallel make breaks on native tablegen
Patch by Alex Wang

This patch resolves a parallelization issue that occurs when native tablegen targets are built at the same time. They both try to build libSupport and clobber each other causing the builds to fail.

llvm-svn: 249911
2015-10-09 22:26:04 +00:00
Reid Kleckner
1ea7758a17 Enable gtest SEH when building with clang-cl
Clang supports SEH well enough that this should work out of the box.  If
it doesn't, we'll hear about it.

llvm-svn: 249766
2015-10-08 22:44:39 +00:00
David Blaikie
0c7821b2aa Revert "Enable -Wdeprecated in the cmake build now that LLVM (& Clang, Polly, and LLD) are -Wdeprecated clean"
This reverts commit r248963.

Seems there's some standard libraries (and libcxxabi implementations)
that aren't -Wdeprecated clean... hrm.

llvm-svn: 248972
2015-10-01 00:44:21 +00:00
David Blaikie
818afe7a1c Enable -Wdeprecated in the cmake build now that LLVM (& Clang, Polly, and LLD) are -Wdeprecated clean
This particularly helps enforce the C++ Rule of 5 (for new move ops this
is already an error, but for a type only using C++98 features (copy
ctor/assign, dtor) it is only deprecated, not invalid)

Applying the flag for any GCC compatible compiler - GCC doesn't warn on
the Rule of 5 cases that C++11 deprecates, but it doesn't have other
false positives so far as I could see (compiling with GCC 4.8 didn't
produce any -Wdeprecated warnings I could spot).

Reviewers: aaron.ballman

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

llvm-svn: 248963
2015-09-30 23:36:12 +00:00
John Brawn
7f04c1f289 [CMake] Make the bindir and libdir arguments to set_output_directory optional
When building a plugin against an installed LLVM toolchain using
add_llvm_loadable_module (in the documented manner) doesn't work as nothing sets
the *_OUTPUT_INTDIR variables causing an error when set_output_directory is
called. Making those arguments optional (causing the default output directory
to be used) fixes this.

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

llvm-svn: 248911
2015-09-30 15:20:51 +00:00
John Brawn
4db280055c [CMake] Adjust the variables set by LLVMConfig.cmake
When using LLVMConfig.cmake from an installed toolchain in order to build a
loadable pass using add_llvm_loadable_module LLVM_ENABLE_PLUGINS and
LLVM_PLUGIN_EXT must be set. Also make LLVM_DEFINITIONS be set to what it
actually is.

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

llvm-svn: 248884
2015-09-30 10:34:06 +00:00
John Brawn
820801b9dd [CMake] Move the setting of LLVM_COMPILER_IS_GCC_COMPATIBLE to a separate file
Currently LLVM_COMPILER_IS_GCC_COMPATIBLE is set as a side-effect of determining
the stdlib to use in HandleLLVMStdlib, which causes problems when attempting to
use AddLLVM from an installed LLVM toolchain, as HandleLLVMStdlib is not used.
Move the setting of this variable into DetermineGCCCompatible and include that
from both AddLLVM and HandleLLVMStdlib.

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

llvm-svn: 248798
2015-09-29 14:33:58 +00:00
Chris Bieneman
002bf95a73 [CMake] Adding ALWAYS_GENERATE option to symlink utility functions.
This implements the behavior required for clang symlinks which should be always generated.

llvm-svn: 248039
2015-09-18 21:08:32 +00:00
Chris Bieneman
e2c4179166 [CMake] More cleanup of installing symlinks.
In order to support building clang out-of-tree the install_symlink script needs to be installed, and it needs to be found by searching the CMAKE_MODULE_PATH.

This change renames install_symlink -> LLVMInstallSymlink so it doesn't conflict with naming from other projects, and adds searching behavior in AddLLVM.cmake

llvm-svn: 248009
2015-09-18 17:39:58 +00:00
Chris Bieneman
1413d45737 [CMake] More refactoring of symlink creation.
This refactoring is to enable clang to re-use this code.

llvm-svn: 247850
2015-09-16 20:49:59 +00:00
Chris Bieneman
9cb04235f5 [CMake] Rename target->dest as per feedback from Chapuni on http://reviews.llvm.org/D12864
llvm-svn: 247658
2015-09-15 02:15:53 +00:00
Chris Bieneman
965f23f273 [CMake] Refactor and cleanup generating and installing symlinks to tools.
Summary: This change generalizes symlink generation and makes symlinks to tools obey LLVM_TOOLCHAIN_TOOLS. It makes it so that if you exclude llvm-ar from LLVM_TOOLCHAIN_TOOLS you don't end up with broken symlinks to llvm-lib and llvm-ranlib in your install.

Reviewers: bogner, chapuni, rafael

Subscribers: llvm-commits

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

llvm-svn: 247632
2015-09-14 23:09:06 +00:00
Jordan Rose
e4e9a1db02 [CMake] s/LLVM_SOURCE_DIR/LLVM_MAIN_SRC_DIR/
Fix-up for r247305 to use the right variable. There's another use of
LLVM_SOURCE_DIR in this file that is probably also questionable, but it's
for Windows so I'm going to leave it alone.

llvm-svn: 247311
2015-09-10 17:55:02 +00:00
Chris Bieneman
254674c58d [CMake] Allow LLVM_TOOLCHAIN_TOOLS to be overridden
llvm-svn: 247306
2015-09-10 17:23:32 +00:00
Jordan Rose
a29c8fc9ce [CMake] Fix Xcode build with LLVM_ENABLE_OBJLIB.
This amends chapuni's r246156 to handle an Xcode quirk, one even called out
in the CMake documentation:

    Some native build systems may not like targets that have only object files,
    so consider adding at least one real source file to any target that
    references $<TARGET_OBJECTS:objlib>.

I've limited the scope of this hack to Xcode for now.

llvm-svn: 247305
2015-09-10 17:18:51 +00:00
Aaron Ballman
5197b310f6 Silencing C4141 warnings that were introduced en masse because __forceinline cannot be combined with inline in MSVC without triggering this diagnostic. This is safe to disable because clang will catch instances of the issue with -Wduplicate-decl-specifier, so we are not losing diagnostic coverage.
llvm-svn: 247275
2015-09-10 12:53:40 +00:00
Joseph Tremoulet
69441e6c62 [CMake] Flag recursive cmake invocations for cross-compile
Summary:
Cross-compilation uses recursive cmake invocations to build native host
tools.  These recursive invocations only forward a fixed set of
variables/options, since the native environment is generally the default.
This change adds -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE to the recursive
cmake invocations, so that cmake files can distinguish these recursive
invocations from top-level ones, which can explain why expected options
are unset.

LLILC will use this to avoid trying to generate its build rules in the
crosscompile native host target (where it is not needed), which would fail
if attempted because LLILC requires a cmake variable passed on the command
line, which is not forwarded in the recursive invocation.

Reviewers: rnk, beanz

Subscribers: llvm-commits

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

llvm-svn: 247151
2015-09-09 14:57:06 +00:00
NAKAMURA Takumi
5d0503a7a9 [CMake][CMP0051] Avoid for user of objlib to use llvm_update_compile_flags().
$<TARGET_OBJECTS> shouldn't require compile flags. Flags are set in obj.${name}.

llvm-svn: 246984
2015-09-08 07:42:06 +00:00
Andrew Wilkins
fe6b559032 [cmake] rework LLVM_LINK_LLVM_DYLIB option handling
Summary:
This diff attempts to address the concerns raised in
http://reviews.llvm.org/D12488.

We introduce a new USE_SHARED option to llvm_config,
which, if set, causes the target to be linked against
libLLVM.

add_llvm_utility now uniformly disables linking against
libLLVM. These utilities are not intended for distribution,
and this keeps the option handling more centralised.

llvm-shlib is now processes before any other "tools"
subdirectories, ensuring the libLLVM target is defined
before its dependents.

One main difference from what was requested: llvm_config
does not prune LLVM_DYLIB_COMPONENTS from the components
passed into explicit_llvm_config. This is because the "all"
component does something special, adding additional
libraries (namely libLTO). Adding the component libraries
after libLLVM should not be a problem, as symbols will be
resolved in libLLVM first.

Finally, I'm not really happy with the
DISABLE_LLVM_LINK_LLVM option, but I'm not sure of a
better way to get the following:
 - link all tools and shared libraries to libLLVM if
   LLVM_LINK_LLVM_DYLIB is set
 - some way of explicitly *not* doing so for utilities
   and libLLVM itself
Suggestions for improvement here are particularly welcome.

Reviewers: beanz

Subscribers: llvm-commits

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

llvm-svn: 246918
2015-09-05 08:27:33 +00:00
NAKAMURA Takumi
5a0f275147 [CMake] Don't use OBJLIB on Xcode.
I got a few reports it didn't work.

llvm-svn: 246629
2015-09-02 10:11:26 +00:00
Justin Bogner
d7f80181b8 cmake: Error instead of warning and dropping invalid LLVM_USE_SANITIZER
Currently, if you call cmake with a typo in an LLVM_USE_SANITIZER
value, there's a cmake warning and the build goes on with no
sanitizers at all. This isn't a good behaviour, since cmake warnings
are fairly easy to miss and the resulting behaviour is that it looks
like the build is sanitizer clean.

Upgrade these warnings to errors so misconfigurations are more
obvious.

llvm-svn: 246531
2015-09-01 05:45:07 +00:00
Andrew Wilkins
55390f2377 Enable linking tools, shared libraries against libLLVM
Summary:
Three closely related changes, to have a mode in which we link all
executables and shared libraries against libLLVM. 

1. Add a new LLVM_LINK_LLVM_DYLIB cmake option, which, when ON, will link
   executables and shared libraries against libLLVM. For this to work, it
   is necessary to also set LLVM_BUILD_LLVM_DYLIB and LLVM_DYLIB_EXPORT_ALL.

   It is not strictly necessary to set LLVM_DISABLE_LLVM_DYLIB_ATEXIT, but
   we also default to OFF in this mode, or tools tend to misbehave (e.g.
   stdout may not flush on exit when output is buffered.)

   llvm-config and Tablegen do not use libLLVM, as they are dependencies of
   libLLVM.

2. Modify llvm-go to take a new flag, "linkmode=component-libs|dylib".
   Depending on which one is passed (default is component-libs), we link
   with the individual libraries or libLLVM respectively. We pass in dylib
   when LLVM_LINK_LLVM_DYLIB is ON.

3. Fix LLVM_DYLIB_EXPORT_ALL on Linux, and expand the symbols exported to
   actually export all. Don't strip leading underscore from symbols on Linux,
   and make sure we get all exported symbols and weak-with-default symbols
   ("W" in nm output). Without these changes, passes won't load because
   the "Annotate..." symbols defined in lib/Support/Valigrind.cpp are not
   found.

Testing:
 - Ran default build ("ninja") with LLVM, clang, compiler-rt, llgo, lldb.
 - Ran "check", "check-clang", "check-tsan", "check-libgo" targets. I've
   never had much success with LLDB tests, and llgoi is currently broken
   so check-llgo fails for an unrelated reason.
 - Ran "lldb" to ensure it loads.

Reviewers: chandlerc, beanz, pcc, rnk

Subscribers: rnk, chapuni, sylvestre.ledru, llvm-commits

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

llvm-svn: 246527
2015-09-01 03:14:31 +00:00
NAKAMURA Takumi
3b818a7527 [CMake] Fix build on MSVC in r246156.
add_windows_version_resource_file() affects ALL_FILES. OBJLIB shouldn't have *.obj as SOURCES.

llvm-svn: 246241
2015-08-28 00:36:58 +00:00
NAKAMURA Takumi
6c960875f9 [CMake] OBJLIB-ize *-tblgen.
This improves dependency chain of;

  (LLVMSupport && LLVMTableGen) && (*.cpp in *-tblgen) && (linking *-tblgen)

with;

  (LLVMSupport && LLVMTableGen && *.cpp) && (linking *-tblgen)

llvm-svn: 246156
2015-08-27 16:10:47 +00:00
Reid Kleckner
ef6f724429 [cmake] Pass /manifest:no to the linker when asan is enabled
This is a workaround for PR24476.

llvm-svn: 245945
2015-08-25 16:06:40 +00:00
NAKAMURA Takumi
5f184b4bb7 [CMake] add_llvm_external_project: Just warn about nonexistent directories.
These entries were generated accidentally.

llvm-svn: 245783
2015-08-22 05:11:02 +00:00
NAKAMURA Takumi
4cfca08317 [CMake] Make LLVM_EXTERNAL_*_SOURCE_DIR consistent against older buildsites.
If corresponding in-tree subdirectory exists, just ignore LLVM_EXTERNAL* stuff.
Otherwise, set LLVM_TOOL_*_BUILD ON/OFF properly according to LLVM_EXTERNAL_*.

This makes easier to walk among old revisions *without* deleteing CMakeCache.txt.

Before r242059, LLVM_EXTERNAL_* was working like;

  if(EXISTS ${*_SOURCE_DIR}/CMakeLists.txt)
    set(*_BUILD ON CACHE)
    if(*_BUILD is ON)
      add_subdirectory(*_SOURCE_DIR)
    endif()
  endif()

llvm-svn: 245782
2015-08-22 04:53:52 +00:00
Dan Liew
dd489fffd3 Filter libraries that are not installed out of CMake exports (currently
gtest and gtest_main) when generating ``Makefile.llvmbuild``.

Libraries that are not installed should not be exported because they
won't be available from an install tree.  Rather than filtering out the
gtest libraries in cmake/modules/Makefile, simply teach llvm-build to
filter out libraries that will not be installed from its generated list
of exported libraries.

Note that LLVMBUILD_LIB_DEPS_* are used during our own CMake build
process so we cannot filter LLVMBUILD_LIB_DEPS_gtest* out in llvm-build.
We must leave this gtest filter logic in cmake/modules/Makefile.

llvm-svn: 245718
2015-08-21 18:10:57 +00:00
Dan Liew
3e6b9ffdd7 llvm-build: Adopt generation of LLVM_LIBS_TO_EXPORT. Patch by
Brad King.

Move `LLVM_LIBS_TO_EXPORT` over to Makefile.llvmbuild and generate it
from `llvm-build` using the same logic used to export the dependencies
of these libraries.  This avoids depending on `llvm-config`.

This refactoring was originally motivated by issue #24154 due to commit
r243297 (Fix `llvm-config` to emit the linker flag for the combined
shared object, 2015-07-27) changing the output of `llvm-config --libs`
to not have the individual libraries when we configure with
`--enable-shared`.  That change was reverted by r244108 but this
refactoring makes sense on its own anyway.

llvm-svn: 245717
2015-08-21 18:10:55 +00:00
Yaron Keren
6479d6085a Disable Visual C++ 2013 Debug mode assert on null pointer in some STL algorithms,
such as std::equal on the third argument. This reverts previous workarounds.

Predefining _DEBUG_POINTER_IMPL disables Visual C++ 2013 headers from defining
it to a function performing the null pointer check. In practice, it's not that
bad since any function actually using the nullptr will seg fault. The other
iterator sanity checks remain enabled in the headers.

Reviewed by Aaron Ballmanþ and Duncan P. N. Exon Smith.

llvm-svn: 245711
2015-08-21 17:31:03 +00:00
Reid Kleckner
d2823e636e [cmake] Start adding support for LLVM_USE_SANITIZER=Address on Windows
Pass "-fsanitize=address" to the compiler and "-debug" to the linker.

llvm-svn: 245070
2015-08-14 16:48:34 +00:00
Rafael Espindola
340e0df2ed Use /Zc:inline when building with MSVC.
This reduces the total .obj size when building llvm from
496,690,342 to 219,334,936 bytes.

llvm-svn: 244767
2015-08-12 17:09:25 +00:00
Reid Kleckner
3c27958d3f Revert "[cmake] Add helper for finding potentially external projects"
This reverts commit r244633.

We aren't going to be able to use it because the compiler-rt build can
be built standalone without an LLVM source dir *or* an installed copy of
LLVM.

llvm-svn: 244648
2015-08-11 19:02:57 +00:00
Reid Kleckner
680373b126 [cmake] Add helper for finding potentially external projects
I plan to use this from compiler-rt, but it's useful for any LLVM
project that depends on more than just LLVM.

llvm-svn: 244633
2015-08-11 17:16:35 +00:00
Justin Bogner
59cbd5e6a5 Remove the configure and cmake checks for sys/wait.h
If we don't have sys/wait.h and we're on a unix system there's no way
that several of the llvm tools work at all. This includes clang.

Just remove the configure and cmake checks entirely - we'll get a
build error instead of building something broken now.

llvm-svn: 243957
2015-08-04 06:29:58 +00:00
Douglas Katzman
97a4d33479 Use a specified list of languages in cmake project() command.
This allows asm files and Cxx files to be compiled with different flags
rather than treating them identically. LLVM itself has no asm files
other than tests, but this setting is inherited by the compiler-rt
project (unless compiled standalone), which does have asm files.

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

llvm-svn: 243419
2015-07-28 14:43:53 +00:00
Saleem Abdulrasool
52d579554f build: fix small typo in cmake doxygen build
A search word spelled as "searhc" in the LLVM_DOXYGEN_SEARCHENGINE_URL cmake
variable docstring.

Patch by Daniel Otero!

llvm-svn: 243082
2015-07-24 01:14:25 +00:00
Yaron Keren
2ec88a0c61 Avoid using -Wl,-z,defs on Cygwin.
Prior to CMAKE 2.8.4 that was covered by the WIN32 conditional but
from 2.8.4 CMAKE no longer defined WIN32 when running under Cygwin
and it needs its own test.

Patch by Martell Malone!

http://reviews.llvm.org/D11347

llvm-svn: 242993
2015-07-23 08:06:12 +00:00
Chris Bieneman
db73898a0e [CMake] Projects supported via LLVM_EXTERNAL_*_SOURCE_DIR need to be explicitly specified.
One part of my refactoring from r242705 is untenable due to how CMake caches variables. There is no way other than caching to allow variables to be set in one directory and globally readable, but we really don't want to cache the temporary value marking that a directory has already been included.

llvm-svn: 242793
2015-07-21 15:53:09 +00:00
Andrew Wilkins
d655ae71f1 [cmake] pass GO_EXECUTABLE to llgo-go
Summary:
When calling llgo-go from the llvm_add_go_executable
cmake function, specify $GO_EXECUTABLE as the go
command to call. Without this, llgo-go searches $PATH
which may be inconsistent with $GO_EXECUTABLE.

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 242749
2015-07-21 00:46:23 +00:00
Chris Bieneman
f446b9894e [CMake] Fixing inconsistency caused by copy-pasta.
This will actually fix the PR 24194.

llvm-svn: 242748
2015-07-21 00:44:47 +00:00
Chris Bieneman
12cdd5a5a4 [CMake] Fixing a problem with external projects that aren't getting enabled properly.
This should address PR 24194, and some builedbot failures.

llvm-svn: 242746
2015-07-21 00:39:53 +00:00
Aaron Ballman
2bf3f3dd45 Suppress two warnings from MSVC 2015 that are triggered under /W4. Since we turn off exceptions in the code base, C4577 is moot. C4091 triggers on system headers and is a benign construct.
llvm-svn: 242708
2015-07-20 21:14:14 +00:00
Chris Bieneman
136e6dc16b [CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registration that was already partially working.
Re-landing r242059 which re-landed r241621... I'm really bad at this.

Summary (r242059):
This change re-lands r241621, with an additional fix that was required to allow tool sources to live outside the llvm checkout. It also no longer renames LLVM_EXTERNAL_*_SOURCE_DIR. This change was reverted in r241663, because it renamed several variables of the format LLVM_EXTERNAL_*_* to LLVM_TOOL_*_*.

Summary (r241621):
The tools CMakeLists file already had implicit tool registration, but there were a few things off about it that needed to be altered to make it work. This change addresses all that. The changes in this patch are:

* factored out canonicalizing tool names from paths to CMake variables * removed the LLVM_IMPLICIT_PROJECT_IGNORE mechanism in favor of LLVM_EXTERNAL_${nameUPPER}_BUILD which I renamed to LLVM_TOOL_${nameUPPER}_BUILD because it applies to internal and external tools
* removed ignore_llvm_tool_subdirectory() in favor of just setting LLVM_TOOL_${nameUPPER}_BUILD to Off
* Added create_llvm_tool_options() to resolve a bug in add_llvm_external_project() - the old LLVM_EXTERNAL_${nameUPPER}_BUILD would not work on a clean CMake directory because the option could be created after it was set in code.
* Removed all but the minimum required calls to add_llvm_external_project from tools/CMakeLists.txt

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

llvm-svn: 242705
2015-07-20 20:36:06 +00:00
NAKAMURA Takumi
07289582f7 [CMake] Unbreak add_llvm_external_project when external projects are specified.
LLVM_EXTERNAL_*_SOURCE_DIR is reset as PATH with set(CACHE PATH).
Then the CACHE PATH variable, LLVM_EXTERNAL_*_SOURCE_DIR, is normalized as
${CMAKE_SOURCE_DIR}/${path_var} if ${path_var} is relative.

llvm-svn: 242120
2015-07-14 05:12:53 +00:00
Chris Bieneman
e9b932f094 [CMake] Forgot to quote the first part of STREQUAL.
llvm-svn: 242103
2015-07-14 01:19:07 +00:00
Chris Bieneman
efe18d13a6 [CMake] We shouldn't be storing values in the cache unless they actually need CMake cache behavior.
add_llvm_external_project puts LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR into the cache even if it is just the in-tree default path. This causes all sorts of oddness, and makes it so that I can't change the behavior of this variable.

This patch never puts LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR into the cache. It will only end up in the cache if it is specified on the command line, which is the correct behavior.

There is also a temporary change to remove non-default values from the cache if they are already present. This should have the impact of cleaning out unncecissary values from the caches on the buildbots and people's local build directories. This part of the change is marked with a TODO and can be removed in a few days.

llvm-svn: 242102
2015-07-14 01:17:43 +00:00
Chris Bieneman
4f92ca8a9e Revert "[CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registration that was already partially working."
Reverting r242059 because it broke some bots. I'm attempting to reproduce the failures now.

llvm-svn: 242060
2015-07-13 20:30:58 +00:00
Chris Bieneman
3076439d02 [CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registration that was already partially working.
Summary:
This change re-lands r241621, with an additional fix that was required to allow tool sources to live outside the llvm checkout. It also no longer renames LLVM_EXTERNAL_*_SOURCE_DIR. This change was reverted in r241663, because it renamed several variables of the format LLVM_EXTERNAL_*_* to LLVM_TOOL_*_*.

Original Summary:
The tools CMakeLists file already had implicit tool registration, but there were a few things off about it that needed to be altered to make it work. This change addresses all that. The changes in this patch are:

* factored out canonicalizing tool names from paths to CMake variables * removed the LLVM_IMPLICIT_PROJECT_IGNORE mechanism in favor of LLVM_EXTERNAL_${nameUPPER}_BUILD which I renamed to LLVM_TOOL_${nameUPPER}_BUILD because it applies to internal and external tools
* removed ignore_llvm_tool_subdirectory() in favor of just setting LLVM_TOOL_${nameUPPER}_BUILD to Off
* Added create_llvm_tool_options() to resolve a bug in add_llvm_external_project() - the old LLVM_EXTERNAL_${nameUPPER}_BUILD would not work on a clean CMake directory because the option could be created after it was set in code.
* Removed all but the minimum required calls to add_llvm_external_project from tools/CMakeLists.txt

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

llvm-svn: 242059
2015-07-13 20:23:15 +00:00
NAKAMURA Takumi
4e774b69fd Revert r241621, "[CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registration that was already partially working."
It broke the build that relies on LLVM_EXTERNAL_CLANG_*.

llvm-svn: 241663
2015-07-08 02:35:43 +00:00
Chris Bieneman
13e1693131 [CMake] Cleanup tools/CMakeLists.txt to take advantage of the auto-registration that was already partially working.
Summary:
The tools CMakeLists file already had implicit tool registration, but there were a few things off about it that needed to be altered to make it work. This change addresses all that. The changes in this patch are:

* factored out canonicalizing tool names from paths to CMake variables
* removed the LLVM_IMPLICIT_PROJECT_IGNORE mechanism in favor of LLVM_EXTERNAL_${nameUPPER}_BUILD which I renamed to LLVM_TOOL_${nameUPPER}_BUILD because it applies to internal and external tools
* removed ignore_llvm_tool_subdirectory() in favor of just setting LLVM_TOOL_${nameUPPER}_BUILD to Off
* Added create_llvm_tool_options() to resolve a bug in add_llvm_external_project() - the old LLVM_EXTERNAL_${nameUPPER}_BUILD would not work on a clean CMake directory because the option could be created after it was set in code.
* Removed all but the minimum required calls to add_llvm_external_project from tools/CMakeLists.txt

Reviewers: bogner, samsonov, chapuni, beanz

Subscribers: llvm-commits

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

llvm-svn: 241621
2015-07-07 20:24:55 +00:00
NAKAMURA Takumi
843c7b07fa [CMake] add_llvm_symbol_exports: Use Python oneliner instead of "cmd.exe /c type" to generate *.def.
llvm-svn: 241402
2015-07-05 08:56:38 +00:00
Leny Kholodov
76adfcc946 [Support] Lazy load of dbghlp.dll on Windows
This patch changes linkage with dbghlp.dll for clang from static (at load time)
to on demand (at the first use of required functions). Clang uses dbghlp.dll
only in minor use-cases. First of all in case of crash and in case of plugin load.
The dbghlp.dll library can be absent on system. In this case clang will fail
to load. With lazy load of dbghlp.dll clang can work even if dbghlp.dll
is not available.

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

llvm-svn: 241271
2015-07-02 14:34:57 +00:00
Dan Liew
2ad7bffa0f [CMake] Make the CMake files (LLVMConfig.cmake and LLVMExports.cmake)
generated by the Autoconf/Makefile build system relocatable.

Previously the generated CMake files contained hardcoded paths which
prevented a binary installation from being relocated to a different
place in the file system. This problem was most noticeable in LLVM's
official binary releases which were completely unusable by a downstream
project trying to import the CMake targets.

Package maintainers who choose to modify the install location of the
CMake directory without using the ``PROJ_cmake`` Makefile variable
override will need to patch the generated``LLVMConfig.cmake`` so that
``LLVM_INSTALL_PREFIX`` and ``_LLVM_CMAKE_DIR`` variables are set
correctly.

llvm-svn: 241080
2015-06-30 17:16:39 +00:00
Dan Gohman
e04339a4ce [WebAssembly] Initial WebAssembly backend
This WebAssembly backend is just a skeleton at this time and is not yet
functional.

llvm-svn: 241022
2015-06-29 23:51:55 +00:00
Dan Liew
290240ec68 Fix bug #23967. The gtest and gtest_main targets were exported into the
CMake files and should not be by both build systems and also the targets
were also installed by the CMake build system which they should not be.

The problem was that

- the CMake build of LLVM installs and exports the gtest library
targets. We should not being doing this, these are not part of LLVM.

- the Autoconf/Makefile build of LLVM still had gtest libraries in the
installed LLVMConfig.cmake.

These problems would cause problems for an external project because when
calling llvm_map_components_to_libnames(XXX all) ${XXX} would to contain
LLVM's internal gtest libraries.

llvm-svn: 240981
2015-06-29 18:45:56 +00:00
Peter Zotov
7ae792d667 [OCaml] Bump ctypes dependency to 0.4.
ctypes 0.3 and earlier contains an interface-definig bug:
its ptr_of_raw_address accepts Int64 and not Nativeint. ctypes 0.4
was not released during the 3.6 cycle, and because of that, LLVM 3.6
was released with ctypes 0.3 as a dependency, which now breaks
the build on modern ctypes.

Unbreak.

llvm-svn: 240882
2015-06-27 14:32:30 +00:00
Douglas Katzman
d3fbf4c212 Spelling fixes in comments.
llvm-svn: 240594
2015-06-24 21:46:53 +00:00
Rafael Espindola
c87c2aa297 Support Solaris unused sections' gc link syntax.
It is not clear if this would work or not with LLVM_NO_DEAD_STRIP
binaries, so be conservative for now.

Patch by Xan López.

llvm-svn: 240287
2015-06-22 15:06:17 +00:00
Rafael Espindola
2c6ed3c85c Do not pass optimization flags to Solaris' linker.
It is not supported.

Patch by Xan López.

llvm-svn: 240276
2015-06-22 12:41:52 +00:00
Rafael Espindola
5fb5fa8872 Use right syntax to pass version script to Solaris' ld.
Patch by Xan Lopez!

llvm-svn: 240275
2015-06-22 12:34:54 +00:00
Filipe Cabecinhas
d3cef61b59 CMake: Stop using LLVM's custom parse_arguments (delete implementation). NFC
Summary:
Finally, delete LLVM's parse_arguments() definition.
Second part of D10531.

This is dependent on http://reviews.llvm.org/D10529

Reviewers: pcc, beanz, chapuni

Subscribers: llvm-commits

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

llvm-svn: 240122
2015-06-19 03:45:42 +00:00
Filipe Cabecinhas
e0b15f1053 CMake: Stop using LLVM's custom parse_arguments. NFC
Summary:
Use CMake's cmake_parse_arguments() instead.
It's called in a slightly different way, but supports all our use cases.
It's in CMake 2.8.8, which is our minimum supported version.

CMake 3.0 doc (roughly the same. No direct link to 2.8.8 doc):
http://www.cmake.org/cmake/help/v3.0/module/CMakeParseArguments.html?highlight=cmake_parse_arguments

Reviewers: pcc, beanz, chapuni

Subscribers: llvm-commits

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

llvm-svn: 240121
2015-06-19 03:45:40 +00:00
Peter Collingbourne
390eab456d Silence resource compiler using /nologo flag.
llvm-svn: 239983
2015-06-18 01:15:18 +00:00
James Y Knight
a72dd36d78 Repair cmake libatomic check.
The cmake check for whether libatomic could be used had been
unconditionally setting the result to false. Which was somewhat
fortunate, because the prerequisite check for whether it was *needed*
was always claiming it was, even if it was not.

However, this made platforms where libatomic is actually necessary
fail to link.

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

llvm-svn: 239819
2015-06-16 14:00:01 +00:00
NAKAMURA Takumi
88867efd68 [CMake] Try to fix r239612, not to miss resources/windows_version_resource.rc in clang build.
- Who defines ${LLVM_SOURCE_DIR} ?
  - Would windows_version_resource.rc be available in an *installed* llvm tree?
    I suggest it may be installed in ${PREFIX}/share.

llvm-svn: 239703
2015-06-14 21:47:29 +00:00
Greg Bedwell
46ad93c20c In MSVC builds embed a VERSIONINFO resource in our exe and DLL files.
This reinstates my commits r238740/r238741 which I reverted due to a failure
in the clang-cl selfhost tests on Windows.  I've now fixed the issue in
clang-cl that caused the failure so hopefully all should be well now.

llvm-svn: 239612
2015-06-12 15:58:29 +00:00
Peter Zotov
c1bd6359e1 [cmake] [OCaml] Make ocamldoc targets depend on output files
OCaml doc builds fail without .cmi files, and .cmi files are collected
in ocaml_outputs. Therefore, make doc targets depend on ocaml_outputs as
well.

Fixes: https://llvm.org/bugs/show_bug.cgi?id=23777

Patch by Michał Górny <mgorny@gentoo.org>

llvm-svn: 239259
2015-06-07 19:22:22 +00:00
Greg Bedwell
694d2315ee [CMake] Revert commits r238740/r238741 for embedding Windows version info.
The clang Windows bots are showing mysterious failures.
Reverting until I can figure out what's going on.

llvm-svn: 238744
2015-06-01 13:40:14 +00:00
Greg Bedwell
9e79c1bce3 remove the use of the LOCATION CMake variable from r238740.
It caused the following failure:
"Policy CMP0026 is not set: Disallow use of the LOCATION target property."

llvm-svn: 238741
2015-06-01 13:06:10 +00:00
Greg Bedwell
6bfe85af79 In MSVC builds embed a VERSIONINFO resource in our exe and DLL files.
This embeds Windows version information into our executables and DLLs.
The most visible place to view this data is in the details tab of the file
properties window in Windows explorer.

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

llvm-svn: 238740
2015-06-01 12:41:55 +00:00
Chris Bieneman
0f8139f9c6 [CMake] Bug 23468 - LLVM_OPTIMIZED_TABLEGEN does not work with Visual Studio
Summary: Multi-configuration builds put their binaries into ${CMAKE_BINARY_DIR}/Release/bin/. The table-gen cross-compilation support needs to take that into account.

Reviewers: yaron.keren

Reviewed By: yaron.keren

Subscribers: llvm-commits

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

llvm-svn: 238592
2015-05-29 18:34:41 +00:00
Reid Kleckner
7c81755db9 Try to fix the build with MSVC 2015 by disabling sized deallocation
I can't actually test this properly because uninstalling MSVC 2015 CTP 6
and reinstalling the 2015 RC takes hours. I can only verify that this
doesn't mess up MSVC 2013 and 2015 CTP 6 builds, which is what I've
done.

Should fix PR23513.

llvm-svn: 237743
2015-05-19 23:28:23 +00:00
Yaron Keren
3bde7c1cd0 Use cat and not type Under MSYS, same as Cygwin.
type means something else under the MSYS shell.

Patch by Tzafrir Poupko!

llvm-svn: 237692
2015-05-19 12:59:23 +00:00
Justin Bogner
8efc73255a cmake: Use -fno-sanitize-recover=all - the old spelling is deprecated
llvm-svn: 237334
2015-05-14 04:52:57 +00:00
Eric Fiselier
f17438b6f2 Allow the CMake option 'LLVM_ABI_BREAKING_CHECKS' to be undefined.
When building libc++abi in a standalone configuration the CMake option
'LLVM_ABI_BREAKING_CHECKS` will not be defined.

llvm-svn: 237204
2015-05-12 22:49:18 +00:00
Kostya Serebryany
9387837867 [lib/Fuzzer] use -fsanitize-coverage=trace-cmp when building LLVM with LLVM_USE_SANITIZE_COVERAGE; in lib/Fuzzer try to reload the corpus to pick up new units from other processes
llvm-svn: 236906
2015-05-08 21:30:55 +00:00
Alexey Samsonov
9792622ab9 Update CMake flags, LibFuzzer comments and docs for new -fsanitize-coverage= flags.
llvm-svn: 236797
2015-05-07 23:33:24 +00:00
Niels Ole Salscheider
1fd7063a03 [CMake] Also search for prefixed versions of ld.gold
llvm-svn: 236312
2015-05-01 11:58:30 +00:00
Rafael Espindola
5f983534c5 Allow building the gold plugin even if the gold binary is not found.
The gold binary is not required to build the plugin. All that is
needed is for LLVM_BINUTILS_INCDIR to point to the directory
containing plugin-api.h.

llvm-svn: 235918
2015-04-27 21:08:47 +00:00
Chris Bieneman
a1179aa9bb [CMake] Fix for PR 23328: LLVM_OPTIMIZED_TABLEGEN broken
In CMake dependencies can be filenames or targets, and targets can't be filenames. The Ninja generator handles filename dependencies because it generates targets for every output file from a command. For example:

add_custom_command(OUTPUT foo.txt COMMAND touch foo.txt)

With the Ninja generator this generates a target foo.txt, but with the Makefile generator it doesn't. This is probably because Ninja explicitly requires these hard dependency ties, and Make just behaves oddly in general.

To fix this we need to make the tablegen actions depend on a target rather than a filename.

llvm-svn: 235732
2015-04-24 17:09:20 +00:00
Reid Kleckner
02acaa27c4 [cmake] Quote the path to the target exports file, fixes PR23313
llvm-svn: 235519
2015-04-22 16:23:00 +00:00
Andrew Kaylor
74cb37d4e7 Silence MSVC build alignment warnings
llvm-svn: 235450
2015-04-21 22:29:38 +00:00
Pete Cooper
8e43f16a62 Add targets to cmake for specific target components.
This adds the following targets to cmake.  These can be used to build and link only specific parts of a backend, instead of having to link the whole backend.

- AllTargetsAsmPrinters, AllTargetsAsmParsers, AllTargetsDescs, AllTargetsDisassemblers, AllTargetsInfos

A typical use for these is instead of linking ${LLVM_TARGETS_TO_BUILD}.  This commit changes llvm-mc to show how to use the new targets.

Reviewed by Chris Bieneman.

llvm-svn: 235324
2015-04-20 18:22:05 +00:00
Chris Bieneman
c7ef6f1aee Cleanup based on rnk's feedback.
llvm-svn: 235125
2015-04-16 18:08:33 +00:00
Chris Bieneman
2f7d2a1370 Fixing windows bots.
Third time's the try.

llvm-svn: 235123
2015-04-16 17:40:51 +00:00
Chris Bieneman
181b63c6b5 Better fix to the windows conditional.
llvm-svn: 235121
2015-04-16 17:26:50 +00:00
Chris Bieneman
44637ea047 Fix Windows bots.
Turns out Windows is special. All library installs are RUNTIME.

llvm-svn: 235120
2015-04-16 17:25:17 +00:00
Chris Bieneman
8d45f1b149 Fixing a mis-use of the CMake install command.
The CMake install command is defined as:

install(TARGETS targets... [EXPORT <export-name>]
        [[ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE|
          PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE]
         [DESTINATION <dir>]
         [INCLUDES DESTINATION [<dir> ...]]
         [PERMISSIONS permissions...]
         [CONFIGURATIONS [Debug|Release|...]]
         [COMPONENT <component>]
         [OPTIONAL] [NAMELINK_ONLY|NAMELINK_SKIP]
        ] [...])

This means it can only take one parameter from the set of RUNTIME, LIBRARY, or ARCHIVE. If you set more than one of these it seems to gobble up the extra arguments and ignore the COMPONENT argument.

This adds a check to only set LIBRARY or ARCHIVE based on whether or not the library being built is shared.

llvm-svn: 235113
2015-04-16 16:56:18 +00:00
Zachary Turner
8e996791d5 [msvc] Strip /W[0-4] before appending /W4
Certain versions of CMake specify /W3 as part of CMAKE_CXX_FLAGS
by default, before you do anything.  Appending /W4 to the end of
this and using the Ninja generator results in

cl : Command line warning D9025 : overriding '/W3' with '/W4'.

It is not possible to suppress this since it is a command line
warning and not a compiler warning, so we must fix the command
line to contain only one value for /Wn.

llvm-svn: 234907
2015-04-14 16:57:54 +00:00
NAKAMURA Takumi
bcb0a1f5fc [CMake] Uniquify LLVM_ABI_BREAKING_CHECKS. It reverts r233784, "[CMake] Cache in LLVMConfig.cmake."
llvm-svn: 234720
2015-04-13 04:54:12 +00:00
Rafael Espindola
3e664c2fee Disable all link optimizations in a debug build.
This taking linking clang on my machine with gold from 16.980257914 to
15.933037649 seconds.

llvm-svn: 234161
2015-04-06 15:04:31 +00:00
Rafael Espindola
17068f343b Don't pass -O3 to the linker in debug builds.
This takes linking clang in a debug build with gold form 19.518925697 to
16.406388685 seconds.

llvm-svn: 234160
2015-04-06 14:51:01 +00:00
Rafael Espindola
e72663a555 Don't use -ffunction-sections -fdata-sections on debug builds.
Unfortunately, on ELF there is not used attribute on the .o files,
so there is no easy way to keep the dump function alive.

If we are not gcing, we may as well produce non gcable files and
avoid the cost.

Linking a debug clang now takes 18.856225992 seconds, before it
took 21.206897447.

I will try avoiding --gc-sections -O3 on a followup patch.

llvm-svn: 234159
2015-04-06 14:34:43 +00:00
NAKAMURA Takumi
52594548a7 Try to unbreak Clang build to export LLVM_ABI_BREAKING_CHECKS, fixup for r233310.
FIXME: Should ENABLE_ABI_BREAKING_CHECKS be tri-state, "ON/OFF/blank"?
llvm-svn: 233801
2015-04-01 11:46:15 +00:00
Sanjoy Das
e31f623da1 [CMake] Cache LLVM_ABI_BREAKING_CHECKS in LLVMConfig.cmake.
Not having this breaks clang builds that use an already-built LLVM.

llvm-svn: 233784
2015-04-01 03:16:10 +00:00
Chris Bieneman
ce44007143 [CMake] Removing duplicates from the list of test suites to generate targets for.
Not doing this causes some headaches for users migrating from autoconf to CMake.

llvm-svn: 233428
2015-03-27 21:45:49 +00:00
Derek Schuff
22a695cbe1 CMake: enable installing utils
Added a new boolean CMake flag, LLVM_INSTALL_UTILS. When set,
the 'install' target will include in the bin directory the
utils binaries - e.g. FileCheck. This mirrors the autoconfig
behavior.

Test Plan:
Locally verified that utils binaries are copied when flag is set,
and not copied when flag is not set.

Reviewers: jfb, dschuff, beanz

Reviewed By: beanz

Subscribers: llvm-commits

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

Patch by Mircea Trofin

llvm-svn: 233385
2015-03-27 16:53:06 +00:00
Sanjoy Das
d429dd288c [ADT][CMake][AutoConf] Fail-fast iterators for DenseMap
Summary:
This patch is an attempt at making `DenseMapIterator`s "fail-fast".
Fail-fast iterators that have been invalidated due to insertion into
the host `DenseMap` deterministically trip an assert (in debug mode)
on access, instead of non-deterministically hitting memory corruption
issues.

Enabling fail-fast iterators breaks the LLVM C++ ABI, so they are
predicated on `LLVM_ENABLE_ABI_BREAKING_CHECKS`.
`LLVM_ENABLE_ABI_BREAKING_CHECKS` by default flips with
`LLVM_ENABLE_ASSERTS`, but can be clamped to ON or OFF using the CMake /
autoconf build system.

Reviewers: chandlerc, dexonsmith, rnk, zturner

Subscribers: llvm-commits

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

llvm-svn: 233310
2015-03-26 19:25:01 +00:00
Andrew Kaylor
614de5f815 Disabling warnings for MSVC build to enable /W4 use.
Differential Revision: http://reviews.llvm.org/D8572

llvm-svn: 233133
2015-03-24 23:37:10 +00:00
Chris Bieneman
12a0a5d060 Re-land: Generate targets for each lit suite.
Summary:
This change makes CMake scan for lit suites and generate a target for each lit test suite. The targets follow the format check-<project>-<suite path>.

For example:
check-llvm-unit - Runs the LLVM unit tests
check-llvm-codegen-arm - Runs the ARM codeine tests

Note: These targets are not generated during multi-configuration generators (i.e. Xcode and Visual Studio) because target clutter impacts UI usability.

* Also fixed a minor issue that Duncan pointed out to me I was passing the suite to lit twice

Reviewers: chandlerc

Subscribers: aemerson, llvm-commits

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

llvm-svn: 233009
2015-03-23 20:04:00 +00:00
Chris Bieneman
513563f41e Raising minimum required CMake version to 2.8.12.2.
This commit is in reference to the llvm-dev thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/083672.html

llvm-svn: 233008
2015-03-23 20:03:57 +00:00
Peter Collingbourne
a47e3b75e5 test: Make a start on a test suite for libLTO.
This works in a similar way to the gold plugin tests. We search for a compatible
linker on $PATH and use it to run tests against our just-built libLTO. To start
with, test the just added opt level functionality.

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

llvm-svn: 232785
2015-03-19 23:55:38 +00:00
Chris Bieneman
e6f4b4012c Fixing dependencies for native tablegen.
The dependencies for cross-built tablegen were a bit confused. This fixes that. The following dependencies are now enforced:

(1) Tablegen tasks depend on the native tablegen
(2) Native tablegen depends on the cross-compiled tablegen

Although the native tablegen doesn't actually require the cross tablegen, having this dependency forces the native tablegen to rebuild whenever the cross tablegen changes.

llvm-svn: 232730
2015-03-19 16:49:44 +00:00
Greg Bedwell
b3d2075d40 [CMake] Don't pass in MSVC warning flags as definitions.
NFC currently but required as a prerequisite for using
the Microsoft resource compiler in conjunction with
CMake's ninja generator, which knows how to filter flags
appropriately, but not definitions.

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

llvm-svn: 232727
2015-03-19 16:32:47 +00:00
Chris Bieneman
52e1e1f609 Revert "Generate targets for each lit suite."
This change broke Polly. I'll track down the failure when I have a chance and re-apply the change.

llvm-svn: 232676
2015-03-18 21:53:29 +00:00
Chris Bieneman
d37a9d1b50 Generate targets for each lit suite.
Summary:
This change makes CMake scan for lit suites and generate a target for each lit test suite. The targets follow the format check-<project>-<suite path>.

For example:
check-llvm-unit - Runs the LLVM unit tests
check-llvm-codegen-arm - Runs the ARM codeine tests

Note: These targets are not generated during multi-configuration generators (i.e. Xcode and Visual Studio) because target clutter impacts UI usability.

Reviewers: chandlerc

Subscribers: aemerson, llvm-commits

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

llvm-svn: 232671
2015-03-18 21:19:06 +00:00
Reid Kleckner
8387c0d5ea CMake: Disable ENABLE_EXPORTS for executables with MSVC
The MSVC linker won't produce a .lib file for an executable that doesn't
export anything, and LLVM doesn't maintain dllexport annotations or .def
files listing all C++ symbols. It also doesn't support exporting all
symbols, like binutils ld.

CMake 3.2 changed the Ninja generator to list both the .exe and .lib
files as outputs of executable build targets. Ninja would always re-link
executables with ENABLE_EXPORTS because the .lib output file was not
present, and therefore the target was out of date.

llvm-svn: 232662
2015-03-18 20:09:13 +00:00