Commit Graph

605 Commits

Author SHA1 Message Date
Yaron Keren 03759bd9c0 Visual C++ does not support -ffunction-sections -fdata-sections.
llvm-svn: 198203
2013-12-30 05:31:53 +00:00
Nico Weber 62588e1a86 Port r198087 and r198089 (strip dead code by default) from make to cmake.
llvm-svn: 198198
2013-12-30 03:36:05 +00:00
Nico Weber dc78dc9ac6 [cmake] In add_llvm_loadable_module, don't clobber existing LINK_FLAGS on OS X.
Also add leading spaces to the LINK_FLAGS setters, since that's what the cmake
folks recommend: http://www.cmake.org/pipermail/cmake/2012-October/052399.html

llvm-svn: 198182
2013-12-29 23:04:48 +00:00
NAKAMURA Takumi faabd7cf37 Fix mis-merging in AddLLVM.cmake, take #2. LINK.EXE's options had been broken. Sorry again.
llvm-svn: 198169
2013-12-29 16:50:15 +00:00
NAKAMURA Takumi 0a062bd225 Fix mis-merging in AddLLVM.cmake. Sorry.
llvm-svn: 198166
2013-12-29 16:19:13 +00:00
NAKAMURA Takumi 14d09b872f [CMake] Fix add_llvm_loadble_module.
Thanks to Edward-san, to let me know.

llvm-svn: 198165
2013-12-29 16:15:31 +00:00
NAKAMURA Takumi bbd2aaa257 [CMake] add_llvm_symbol_exports: Use unique name for each target.
llvm-svn: 198164
2013-12-29 16:15:26 +00:00
NAKAMURA Takumi 812107527c [CMake] add_llvm_symbol_exports: Use ${native_export_file} instead of equivalent constant "symbol.*', since it is defined.
llvm-svn: 198163
2013-12-29 16:15:18 +00:00
Nico Weber 49d6f485ce Yet another attempt at getting cmake-clang-i686-mingw32 green.
llvm-svn: 198159
2013-12-29 07:43:09 +00:00
Nico Weber 49da758cbf Windows build fixes, hopefully last part.
r198153 fixed the msvs bot problem, but broke a msysgit bot. This change
hopefully makes both variants happy.

llvm-svn: 198156
2013-12-29 06:56:28 +00:00
Nico Weber 1946f3a01b Another windows build fix attempt.
Inspired by http://public.kitware.com/pipermail/cmake-developers/2012-March/003768.html

llvm-svn: 198153
2013-12-29 06:12:40 +00:00
Nico Weber 06473f855d More windows build fix attempts.
The windows ninja build is now green, but msvs is still unhappy. Maybe that's
because the .def file was passed when building LTO_static, so only pass
symbol lists for shared libraries.

llvm-svn: 198151
2013-12-29 05:39:01 +00:00
Nico Weber 5c8a4a3e3e The same we do every commit, Pinky: Try to fix the windows build (after r198136).
llvm-svn: 198148
2013-12-29 04:05:23 +00:00
Nico Weber 35ea47d0d2 Another windows build fix attempt after r198136.
The current quoting is stripped by cmake, try quoting more.

llvm-svn: 198143
2013-12-29 00:50:09 +00:00
Nico Weber 2534017ad1 Try to fix windows build more after r198136.
The command that cmd.exe is complaining about is:
cmd.exe /c cd /D C:\bb-win7\cmake-clang-i686-mingw32\build\tools\lto && cmake -E echo EXPORTS > symbol.def && type C:/bb-win7/cmake-clang-i686-mingw32/llvm-project/llvm/tools/lto/lto.exports >> symbol.def

Maybe quoting the filename helps.

llvm-svn: 198140
2013-12-29 00:27:49 +00:00
Nico Weber b42359d74b Use `${CMAKE_COMMAND}` instead of `cmake`.
llvm-svn: 198139
2013-12-29 00:11:20 +00:00
Nico Weber fc9ddcde82 Try to fix windows build after r198136.
`type` can't read from stdin.

llvm-svn: 198138
2013-12-28 23:50:01 +00:00
Nico Weber a69d1a88a6 Try to fix linux build after r198136.
$ needs to be written $$ in makefiles, but not in cmakefiles.

llvm-svn: 198137
2013-12-28 23:39:49 +00:00
Nico Weber c27118ddb6 EXPORTED_SYMBOL_FILE support for cmake
The cmake build didn't support EXPORTED_SYMBOL_FILE. Instead, it had a
Windows-only implementation in tools/lto/CMakeLists.txt, a linux-only
implementation in tools/gold/CMakeLists.txt, and a darwin-only implementation
in tools/clang/tools/libclang/CMakeLists.txt.

This attempts to consolidate these one-offs into a single place. Clients can now
just set LLVM_EXPORTED_SYMBOL_FILE and things (hopefully) Just Work, like in
the make build.

llvm-svn: 198136
2013-12-28 23:31:44 +00:00
Nico Weber d16b48a203 Remove windows newlines.
llvm-svn: 198135
2013-12-28 23:26:51 +00:00
Alp Toker 171b0c36a3 Fix documentation typos
llvm-svn: 197757
2013-12-20 00:33:39 +00:00
NAKAMURA Takumi 69a89c7849 Revert r197682, "[CMake] Introduce LIT in add_lit_target."
llvm-svn: 197703
2013-12-19 17:11:08 +00:00
NAKAMURA Takumi 716198d61c [CMake] Introduce LIT in add_lit_target.
llvm-svn: 197682
2013-12-19 16:02:17 +00:00
Jordan Rose b96aae233c [CMake] Don't put every project's tblgen executable in the LLVM bin directory.
This changes Clang standalone builds so that clang-tblgen lives in
clang/build/bin instead of llvm/build/bin, and so that with the Xcode
generator it's in clang/build/bin/Debug instead of llvm/build/bin/Debug/Debug/.
Yes, really.

llvm-svn: 197590
2013-12-18 17:50:33 +00:00
NAKAMURA Takumi 0adf24a02d [CMake] Prune LLVM_TOOLS_BINARY_DIR in LLVMConfig.cmake, since it always points build directory.
llvm-svn: 197581
2013-12-18 15:57:58 +00:00
NAKAMURA Takumi 76f4f3809d [CMake] ${LLVM_MAIN_SRC_DIR}/include can be represented as ${LLVM_MAIN_INCLUDE_DIR}.
llvm-svn: 197396
2013-12-16 16:14:19 +00:00
NAKAMURA Takumi e73df85038 [CMake] Introduce LLVM_RUNTIME_OUTPUT_INTDIR and LLVM_LIBRARY_OUTPUT_INTDIR to reduce references to CMAKE_CFG_INTDIR.
Each of them forms like;
  ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}
  ${CMAKE_BINARY_DIR}/lib/${CMAKE_CFG_INTDIR}

llvm-svn: 197394
2013-12-16 16:03:08 +00:00
NAKAMURA Takumi 0dc10d55da [CMake] add_lit_target: Let lit.site.cfg free from "--param build_mode" on single configuration builds, like autoconf build.
llvm-svn: 196377
2013-12-04 11:15:17 +00:00
NAKAMURA Takumi 03fc730c3c [CMake] add_lit_target: Tests should be excluded from "Build Solution".
llvm-svn: 196093
2013-12-02 11:31:19 +00:00
NAKAMURA Takumi 226e10edff [CMake] Let add_public_tablegen_target() provide intrinsics_gen, too.
I think, in principle, intrinsics_gen may be added explicitly.
That said, it can be added incidentally, since each target already has dependencies to llvm-tblgen.
Almost all source files depend on both CommonTaleGen and intrinsics_gen.

Explicit add_dependencies() have been pruned under lib/Target.

llvm-svn: 195929
2013-11-28 17:04:31 +00:00
NAKAMURA Takumi ce746c6c49 [CMake] Let add_public_tablegen_target responsible to provide dependency to CommonTableGen.
add_public_tablegen_target adds *CommonTableGen to LLVM_COMMON_DEPENDS.
LLVM_COMMON_DEPENDS affects add_llvm_library (and other add_target stuff) within its scope.

llvm-svn: 195927
2013-11-28 17:04:04 +00:00
Arnaud A. de Grandmaison b697b538dc CMake : optionaly enable LLVM to be compiled with -std=c++11 (default: off)
In some case, it may be required to build LLVM in C++11 mode, as some the subprojects (like lldb) requires it.

This mimics the autoconf behaviour.

However, given the discussions on the switch to C++11 of the codebase, this behaviour should evolve to default to C++11 with some checks of the compiler capabilities.

llvm-svn: 195727
2013-11-26 10:33:53 +00:00
Hans Wennborg 4656ec1e70 Revert my CMake patches concerning building with /MT (r194589, r194596)
Reid pointed out we already have LLVM_USE_CRT_{buildtype} to set it.

llvm-svn: 194604
2013-11-13 20:29:10 +00:00
Hans Wennborg fc59812bee CMake: make building with /MT an option instead of always forcing it
for release builds.

This is a follow-up to r194589. Aaron pointed out that building
libraries with /MT and using them in an application that uses a
different run-time library can be a bad idea.

Move the option to build with /MT behind a CMake option so it can be
turned on selectively, such as when building the toolchain installer.

llvm-svn: 194596
2013-11-13 19:12:02 +00:00
Hans Wennborg 079cb9b3e5 cmake: link release builds statically against run-time library on windows (use /MT instead of /MD)
This should fix the problem of snapshot builds created with MSVC 2012 not
working for users with MSVC 2010, etc.

Differential Revision: http://llvm-reviews.chandlerc.com/D2157

llvm-svn: 194589
2013-11-13 18:16:23 +00:00
Yaron Keren 9ea4ea56d1 Remove NDBEUG from all release types compile flags.
llvm-svn: 193031
2013-10-19 07:30:37 +00:00
Hans Wennborg bef50abea9 CMake: set stack size for MSVC in just one place
After r192904, Reid pointed out he thought we already set the stack
size for MSVC. Turns out we did, but it didn't seem to work.

This commit sets the stack size in a single place, using
CMAKE_EXE_LINKER_FLAGS because that seems to be the way that works
best.

llvm-svn: 192912
2013-10-17 18:39:47 +00:00
Hans Wennborg fd541f001b CMake: set stack size to 2MB for MSVC builds
Compiling under Visual C++ 2012 with the default stack size of 1MB, the stack
overflows at a depth of 216 template instantiations, well before the 256
default limit. This patch modifies the default MSVC stack size to 2MB.

Patch by Yaron Keren!

llvm-svn: 192904
2013-10-17 17:49:57 +00:00
Hans Wennborg 3e67a65729 cmake: don't set LLVM_COMPILER_IS_GCC_COMPATIBLE when using clang-cl
Tip-of-tree CMake has become clang-cl aware [1]. In this case,
CMAKE_CXX_COMPILER_ID will still be Clang, but MSVC will be true.

[1] See http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3d8356d4

llvm-svn: 192139
2013-10-07 22:03:23 +00:00
David Majnemer 61eae2e30c Revert "Revert "Windows: Add support for unicode command lines""
This reverts commit r192070 which reverted r192069, I forgot to
regenerate the configure scripts.

llvm-svn: 192079
2013-10-07 01:00:07 +00:00
David Majnemer f636cf422e Revert "Windows: Add support for unicode command lines"
This is causing MinGW bots to fail.
This reverts commit r192069.

llvm-svn: 192070
2013-10-06 20:44:34 +00:00
David Majnemer 80bea0c315 Windows: Add support for unicode command lines
Summary:
The MSVCRT deliberately sends main() code-page specific characters.
This isn't too useful to LLVM as we end up converting the arguments to
UTF-16 and subsequently attempt to use the result as, for example, a
file name.  Instead, we need to have the ability to access the Unicode
command line and transform it to UTF-8.

This has the distinct advantage over using the MSVC-specific wmain()
function as our entry point because:
 - It doesn't work on cygwin.
 - It only work on MinGW with caveats and only then on certain versions.
 - We get to keep our entry point as main(). :)

N.B.  This patch includes fixes to other parts of lib/Support/Windows
s.t. we would be able to take advantage of getting the Unicode paths.
E.G.  clang spawning clang -cc1 would want to give it Unicode arguments.

Reviewers: aaron.ballman, Bigcheese, rnk, ruiu

Reviewed By: rnk

CC: llvm-commits, ygao

Differential Revision: http://llvm-reviews.chandlerc.com/D1834

llvm-svn: 192069
2013-10-06 20:25:49 +00:00
Rafael Espindola 8cc523f5f7 Reverts commit r190808 and r190556.
The use of these features in clang has been reverted.

llvm-svn: 191785
2013-10-01 17:40:47 +00:00
Jordan Rose 66ea0363e4 [CMake] Hack GetSVN.cmake to handle unusual terminals.
I got a report of a hang in git's helper functions trying to figure out
how to display results of "git svn info" when run inside ninja, even though
the result is immediately piped to grep. This seems to avoid that.

llvm-svn: 190808
2013-09-16 21:38:01 +00:00
Alexey Samsonov 9c0748a90c Fixup for r190409: add dep on LZMA only if CMake is cross-compiling
llvm-svn: 190591
2013-09-12 08:26:53 +00:00
Jordan Rose 04801d549a [CMake] Update GetSVN.cmake to use LLVM version control helper scripts.
This allows the logic to work with Git, and also uses the variable names
to match what Clang is actually looking for.

This changes the interface of GetSVN.cmake. Clang change to follow.

llvm-svn: 190556
2013-09-11 22:46:41 +00:00
NAKAMURA Takumi 7230246d14 config-ix.cmake: Tweak stray endif(...) to suppress a warning in CMake.
llvm-svn: 190502
2013-09-11 09:42:03 +00:00
Hans Wennborg bac9d13647 cmake: Install llvm-tblgen again
It was removed in r189130, but it turns out this makes life hard for
folks packaging LLVM and Clang and building the latter based on the
LLVM package.

Note that this only adds back the LLVM tblgen, and it's obviously
not included when LLVM_INSTALL_TOOLCHAIN_ONLY is set.

llvm-svn: 190419
2013-09-10 18:35:14 +00:00
Renato Golin 74c652eb3f Adding LZMA as dep for XML2 on 2.8.0 or higher
LibXML2 config doesn't specify lzma as a dependency, which breaks
cross-compilation builds using new linkers (ld 2.21 or higher).

There is a bug on libxml2 to fix that, but since it's going to take
a while for things to go round and back, so we should have a harmless
addition of the library until then.

llvm-svn: 190409
2013-09-10 14:24:17 +00:00
Alexey Samsonov f9ab351b8a [CMake] Add -O1 in debug builds with LLVM_USE_SANITIZER
llvm-svn: 189747
2013-09-02 09:15:01 +00:00
Michael Gottesman 406525d2df [doxygen] Use correct variable names for external variable configuration and make EXTRA_SEARCH_MAPPINGS a "dumb" variable.
I do not think the massaging that I was doing for EXTRA_SEARCH_MAPPINGS was
truly necessary.

llvm-svn: 189522
2013-08-28 21:55:26 +00:00
Michael Gottesman 7ed90880bc [doxygen] Added support for doxygen external search.
llvm-svn: 189507
2013-08-28 20:28:35 +00:00
Michael Gottesman 9cc5a45270 [cmake] Created an aggregate doxygen target for generating doxygen documentation for llvm/all subprojects. Renamed llvm's doxygen generation command to doxygen-llvm.
llvm-svn: 189506
2013-08-28 20:28:32 +00:00
Roman Divacky c987111b82 Translate ENABLE_CLANG_{ARCMT,REWRITER,STATIC_ANALYZER} when generating
lit.site.cfg.

llvm-svn: 189394
2013-08-27 19:25:01 +00:00
Alexey Samsonov 30c0ecc5cf [cmake] Check for realpath availability in CMake
llvm-svn: 189249
2013-08-26 18:11:25 +00:00
Douglas Gregor 047b16a665 CMake Xcode builds: symlink tblgen targets out to bin/.
Xcode always puts executable targets in the directory
bin/<Config>. When building separate LLVM and Clang projects for
Xcode, this prevents the CMake-configured project for Clang from
finding llvm-tblgen. Add a symlink so that tblgen executables are
always available in bin/ (regardless of the configuration LLVM is
built with).

llvm-svn: 189220
2013-08-26 14:43:19 +00:00
Michael Gottesman 4d35b909ad [autotools->cmake] Enable generation of doxygen documentation via cmake.
I am going to add in a subsequent patch support for generating the llvm
manpage.

llvm-svn: 189164
2013-08-24 07:25:21 +00:00
Hans Wennborg 1654627f27 CMake: Add LLVM_INSTALL_TOOLCHAIN_ONLY option.
Differential Revision: http://llvm-reviews.chandlerc.com/D1428

llvm-svn: 189155
2013-08-24 00:20:36 +00:00
Hans Wennborg 361c287f0d CMake: don't install tablegen
Since it's an llvm-internal tool, we shouldn't install it.

(This depends on Clang r189127 and lld r189128.)

llvm-svn: 189130
2013-08-23 18:28:10 +00:00
Argyrios Kyrtzidis 7eec9d0c04 [CMake] Automatically pick up subdirectories in llvm/tools as 'external projects' if they contain a 'CMakeLists.txt' file.
Allow CMake to pick up external projects in llvm/tools without the need to modify the "llvm/tools/CMakeLists.txt" file.
This makes it easier to work with projects that live in other repositories, without needing to specify each one in "llvm/tools/CMakeLists.txt".

llvm-svn: 188921
2013-08-21 19:13:44 +00:00
Reid Kleckner 67ed6f68f3 Suppress an annoying CMake warning in ChooseMSVCCRT.cmake
Warning was:
  Argument not separated from preceding token by whitespace.

llvm-svn: 188701
2013-08-19 20:25:26 +00:00
Joerg Sonnenberger 4e5a399b60 Recognize NetBSD's terminfo implementation.
llvm-svn: 188606
2013-08-17 11:06:00 +00:00
Aaron Ballman 99ea291494 Re-disabling C4291 warnings for MSVC because AttributeList.h requires it. This was accidentally removed in r187279.
llvm-svn: 188530
2013-08-16 03:06:38 +00:00
Hans Wennborg 89065d8632 CMake: polish the Windows packaging rules
This tweaks the CMake rules for building an installation package on Windows:
 - Sets license file (otherwise nsis shows an ugly default)
 - Adds LLVM logo
 - Shows "do you want to add this to the system path" dialog.

Differential Revision: http://llvm-reviews.chandlerc.com/D1414

llvm-svn: 188509
2013-08-15 23:44:31 +00:00
NAKAMURA Takumi cb065a6713 [CMake] add_llvm_library: Specify explicit suffix .imp to import library to avoid a warning between profile_rt-static and profile_rt-shared with lib/profile_rt.lib.
FIXME: It seems MS version of profile_rt.dll doesn't contain any export symbols.
llvm-svn: 188351
2013-08-14 03:34:49 +00:00
Chandler Carruth 912198585d Remove all checking for the various terminfo headers (term.h and
curses.h). Finding these headers is next to impossible. For example, on
Debian systems libtinfo-dev provides the terminfo reading library we
want, but *not* term.h. For the header, you have to use libncurses-dev.
And libncursesw-dev provides a *different* term.h in a different
location!

These headers aren't worth it. We want two functions the signatures of
which are clearly spec'ed in sys-v and other documentation. Just declare
them ourselves and call them. This should fix some debian builders and
provide better support for "minimal" debian systems that do want color
autodetection.

llvm-svn: 188165
2013-08-12 10:40:11 +00:00
Chandler Carruth f11f1e43de Target a minimal terminfo library rather than necessarily a full curses
library for color support detection. This still will use a curses
library if that is all we have available on the system. This change
tries to use a smaller subset of the curses library, specifically the
subset that is on some systems split off into a separate library. For
example, if you install ncurses configured --with-tinfo, a 'libtinfo' is
install that provides just the terminfo querying functionality. That
library is now used instead of curses when it is available.

This happens to fix a build error on systems with that library because
when we tried to link ncurses into the binary, we didn't pull tinfo in
as well. =]

It should also provide an easy path for supporting the NetBSD
libterminfo library, but as I don't have access to a NetBSD system I'm
leaving adding that support to those folks.

llvm-svn: 188160
2013-08-12 09:49:17 +00:00
Chandler Carruth 7f6e633174 Add three missing CMake variables that need to make it to the
LLVMConfig.cmake file that is (I think) used in the stand-alone Clang
build, and causing link errors there w.r.t. curses.

llvm-svn: 187950
2013-08-08 01:15:37 +00:00
Chandler Carruth cad7e5e0b4 Add support for linking against a curses library when available and
using it to detect whether or not a terminal supports colors. This
replaces a particularly egregious hack that merely compared the TERM
environment variable to "dumb". That doesn't really translate to
a reasonable experience for users that have actually ensured their
terminal's capabilities are accurately reflected.

This makes testing a terminal for color support somewhat more expensive,
but it is called very rarely anyways. The important fast path when the
output is being piped somewhere is already in place.

The global lock may seem excessive, but the spec for calling into curses
is *terrible*. The whole library is terrible, and I spent quite a bit of
time looking for a better way of doing this before convincing myself
that this was the fundamentally correct way to behave. The damage of the
curses library is very narrowly confined, and we continue to use raw
escape codes for actually manipulating the colors which is a much sane
system than directly using curses here (IMO).

If this causes trouble for folks, please let me know. I've tested it on
Linux and will watch the bots carefully. I've also worked to account for
the variances of curses interfaces that I could finde documentation for,
but that may not have been sufficient.

llvm-svn: 187874
2013-08-07 08:47:36 +00:00
Reid Kleckner a3ae94e83f Check for _strtoi64 in the cmake build if strtoll is missing
Previously this check was guarded by MSVC, which doesn't distinguish
between the compiler and the headers/library.  This enables clang to
compile more of LLVM on Windows with Microsoft headers.

Remove some unused macros while I'm here: error_t and LTDL stuff.

llvm-svn: 187839
2013-08-07 00:29:15 +00:00
Aaron Ballman bde2cd11e8 Replacing /GR with /GR- instead of applying both options to the project. This should reduce some build bot warnings (D9025: "overriding '/GR' with '/GR-'").
llvm-svn: 187836
2013-08-06 23:34:04 +00:00
Simon Atanasyan cc53ec4c84 Pass -G argument to cmake with the same generator's name as used for the
initial cmake invocation.

Patch reviewed by Reid Kleckner.

llvm-svn: 187591
2013-08-01 18:04:07 +00:00
Eric Christopher 83afc1e43b Make sure that -gsplit-dwarf isn't passed to the linker.
llvm-svn: 187456
2013-07-30 22:34:30 +00:00
Eric Christopher 3987806087 Add capability for building with -gsplit-dwarf to the cmake build.
In limited testing this seems to work. Caveat emptor.

llvm-svn: 187452
2013-07-30 21:44:10 +00:00
Aaron Ballman f5aacd34e4 Re-application of 187310. Re-enabling warning C4275 for MSVC 11 and up, but not MSVC 10 since it is still required there.
llvm-svn: 187354
2013-07-29 13:02:08 +00:00
Aaron Ballman d1594bdaa9 Partial revert of 187310; it seems MSVC 10 still spits out this warning, but MSVC 11 does not.
llvm-svn: 187331
2013-07-28 18:04:26 +00:00
Aaron Ballman 437c9f92bc Re-enabling some more MSVC warnings; all of these compile cleanly with no further changes required.
llvm-svn: 187310
2013-07-27 20:20:28 +00:00
Aaron Ballman 6436940e38 Re-enabling a warning in MSVC mode now that r187292 fixed the only instance of the warning.
llvm-svn: 187293
2013-07-27 03:35:44 +00:00
Aaron Ballman 568cb27833 Re-enabling some more MSVC warnings; all of these compile cleanly with no further changes required.
llvm-svn: 187279
2013-07-27 00:13:11 +00:00
Aaron Ballman dc424e9780 Re-enabling the C4065 warning for MSVC builds as it no longer fires due to tablegen.
llvm-svn: 187252
2013-07-26 22:03:03 +00:00
Reid Kleckner 37f69de11b Remove dead or useless header checks from cmake and autoconf
On Windows, this improves clean cmake configuration time on my
workstation from 1m58s to 1m32s, which is pretty significant.  There's
probably more that can be done here, but this is the low hanging fruit.

Eric volunteered to regenerate ./configure for me.

llvm-svn: 187209
2013-07-26 16:54:23 +00:00
Duncan Sands 80f122fefb Tweak the cmake interaction between CMAKE_BUILD_TYPE and LLVM_ENABLE_ASSERTIONS.
The issue is that CMAKE_BUILD_TYPE=RelWithDebInfo LLVM_ENABLE_ASSERTIONS=ON was
not building with assertions enabled.  (I was unable to find what in the LLVM
source tree was adding -DNDEBUG to the build line in this case, so decided that
it must be cmake itself that was adding it - this may depend on the cmake
version).  The fix treats any mode that is not Debug as being the same as
Release for this purpose (previously it was being assumed that cmake would only
add -DNDEBUG for Release and not for RelWithDebInfo or MinSizeRel).  If other
versions of cmake don't add -DNDEBUG for RelWithDebInfo then that's OK: with
this change you just get a useless but harmless -UNDEBUG or -DNDEBUG.

llvm-svn: 186499
2013-07-17 09:34:51 +00:00
Matt Arsenault fe56cc67c5 Find xdot or xdot.py.
Ubuntu installs this as xdot, so finding xdot.py would fail.

llvm-svn: 185860
2013-07-08 20:24:54 +00:00
Matt Arsenault 9096217280 Allow llvm_find_program to find alternate names
llvm-svn: 185859
2013-07-08 20:24:49 +00:00
Eric Christopher a24dc7fa8c Reapply r185601 with a fix for the cmake build.
llvm-svn: 185605
2013-07-04 01:10:38 +00:00
Eric Christopher 3eb07a0963 Temporarily revert 185601 as it caused cmake build regressions.
llvm-svn: 185603
2013-07-04 00:51:26 +00:00
Eric Christopher aaf58cc3c4 Add support for futimens for platforms that don't support futimes.
Patch by pashev.igor.

llvm-svn: 185601
2013-07-04 00:47:09 +00:00
Andy Gibbs f5dede1beb Support using "host" as a target in LLVM_TARGETS_TO_BUILD when using cmake.
llvm-svn: 184923
2013-06-26 07:57:53 +00:00
Rafael Espindola 6f2564cb36 Revert "Cmake: add compiler option in a more idiomatic way"
This reverts commit 183995.

It broke the bots:
http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/9730/steps/build_clang/logs/stdio

llvm-svn: 183997
2013-06-14 19:41:05 +00:00
Arnaud A. de Grandmaison ba0d5424e1 Cmake: add compiler option in a more idiomatic way
llvm-svn: 183995
2013-06-14 19:26:57 +00:00
Rafael Espindola d45b9f15f9 Don't define LTDL_SHLIBPATH_VAR.
llvm-svn: 183771
2013-06-11 19:04:13 +00:00
Arnaud A. de Grandmaison 916f3ccacf Add colored diagnostics when building LLVM with cmake + ninja + clang
When invoked from Ninja, clang does not detect that it can use colors : see https://github.com/martine/ninja/issues/174

llvm-svn: 182878
2013-05-29 20:41:35 +00:00
Evgeniy Stepanov 0209f29528 Allow overriding the location of C/C++ compilers in Android CMake build.
Patch by Greg Fitzgerald.

llvm-svn: 182831
2013-05-29 07:23:20 +00:00
Ulrich Weigand 1ceebf6ee0 [SystemZ] Add configure bits
This patch wires up the SystemZ target in configure, so that it can now be
built using --enable-targets=systemz.   It is not yet included in the default
build (--enable-targets=all); this will be done by a follow-up patch.

Patch by Richard Sandiford.

llvm-svn: 181208
2013-05-06 16:22:34 +00:00
Tim Northover a958a57081 Build system changes to enable MCJIT on AArch64
These changes just allow AArch64 to take part in the MCJIT world when
built correctly.

llvm-svn: 181130
2013-05-04 20:13:52 +00:00
Tim Northover fee13d1e11 Allow host triple to be correctly overridden in CMake builds
The intended semantics mirror autoconf, where the user is able to
specify a host triple, but if it's left to the build system then
"config.guess" is invoked for the default.

This also renames the LLVM_HOSTTRIPLE define to LLVM_HOST_TRIPLE to
fit in with the style of the surrounding defines.

llvm-svn: 181112
2013-05-04 07:36:23 +00:00
Benjamin Kramer ff2be22b91 CMake: cxxabi.h is only available to C++ compilers, use the right check macro.
llvm-svn: 181019
2013-05-03 14:48:29 +00:00
Joerg Sonnenberger 66241831dc Only use cxxabi.h's demangler, if it is actually available.
llvm-svn: 180684
2013-04-27 22:12:32 +00:00
Alexey Samsonov 068fc8ae6e Use zlib to uncompress debug sections in DWARF parser.
This makes llvm-dwarfdump and llvm-symbolizer understand
debug info sections compressed by ld.gold linker.

llvm-svn: 180088
2013-04-23 10:17:34 +00:00
Alexey Samsonov 2fb337e77a Add basic zlib support to LLVM. This would allow to use compression/uncompression in selected LLVM tools.
llvm-svn: 180083
2013-04-23 08:28:39 +00:00
Sylvestre Ledru cd4cd6ecc5 Remove the executable bit on cmake files
llvm-svn: 179976
2013-04-21 09:04:59 +00:00
Alexey Samsonov e10c151be5 Don't explicitly provide -pie in MSan bootstrap of LLVM, as it's now implied by the driver
llvm-svn: 179367
2013-04-12 07:18:55 +00:00
Reid Kleckner c1c01d5313 [cmake] Avoid rel+asserts warnings when passing -UNDEBUG
MSVC 2012 gives warning D9025, "overriding /D NDEBUG with -UNDEBUG".
Removing the original definition of NDEBUG silences this.

llvm-svn: 178967
2013-04-07 01:45:01 +00:00
Alexey Samsonov 75789a2133 Add CMake option LLVM_USE_SANITIZER={Address,Memory,MemoryWithOrigins} to simplify bootstrap of LLVM/Clang under ASan/MSan
llvm-svn: 177992
2013-03-26 07:49:46 +00:00
Douglas Gregor 96fa0fcff1 Introduce a tiny CMake project to gather Subversion revision information and place it into a header.
llvm-svn: 177938
2013-03-25 23:14:19 +00:00
Duncan Sands 71de6dcb38 Don't use add_llvm_definitions for adding warning flags. It makes it too hard
to have them appear in the right order.  Instead append all warnings explicitly
to the language flags.  This was already the case for many warnings.  Fixes the
issue of -Wno-maybe-uninitialized not being effective because -Wall was being
placed after it rather than before.

llvm-svn: 177866
2013-03-25 13:25:34 +00:00
Joerg Sonnenberger 8a1177f2aa Refine fenv.h handling: check if the desired macros exist, before using
it. NetBSD/ARM and TILE-Gx are examples for platforms that have an
unusable fenv.h and this avoids the need for a blacklist.

llvm-svn: 177865
2013-03-25 13:13:33 +00:00
Alexey Samsonov ffb4ca8bb4 Enable -Wnon-virtual-dtor build warning
llvm-svn: 177385
2013-03-19 10:10:03 +00:00
Eric Christopher 31f4354c75 Turn anonymous type in anonymous union warning back on after cleaning up
issues.

llvm-svn: 177136
2013-03-15 00:43:00 +00:00
Alexey Samsonov 6706578ff1 Simplify CMake rules in HandleLLVMOptions module.
Summary: No functionality change.

Reviewers: Bigcheese

Reviewed By: Bigcheese

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D535

llvm-svn: 176973
2013-03-13 20:50:23 +00:00
Jordan Rose 643aa0e0dc CMake: Always include the CheckCXXCompilerFlag in HandleLLVMOptions.cmake.
Previously we relied on it being included by config-ix.cmake.

llvm-svn: 176396
2013-03-02 01:00:40 +00:00
Tim Northover bfe8468502 Use correct host/target CMake variables to define lit variables.
CMake and autotools disagree on what "host" means in a cross-compilation
context. Autotools (and lit) take it to be the machine the binaries being
compiled now will run on. CMake takes it to be the machine actually compiling
the binaries now.

This change makes lit.site-cfg more consistent between autotools and CMake,
allowing lit tests (particularly in ExecutionEngine) to run correctly when
cross-compiled with CMake

llvm-svn: 175179
2013-02-14 16:49:32 +00:00
Jordan Rose cea01ee939 CMake: Use check_symbol_exists instead of check_cxx_symbol_exists.
check_cxx_symbol_exists requires CMake 2.8.6, so even though I
recommended it to Owen it's probably better to stay away for now.
This check is not technically correct because we're checking <math.h>
but then using <cmath> in the actual code, but if we run into problems we
can do the same sort of dance as isinf() and isnan() where we check /both/
headers and then write a wrapper header around them.

llvm-svn: 174773
2013-02-08 23:17:31 +00:00
Owen Anderson 389f7dc7a2 Fix CMake detection of various cmath functions, and XFAIL the test on platforms that are known to be missing them.
llvm-svn: 174564
2013-02-07 00:54:05 +00:00
Owen Anderson 132ae8b955 Conditionalize constant folding of math intrinsics on the availability of an implementation on the host. This is a little bit unfortunate, but until someone decides to implement a full libm for APFloat, we don't have a better way to get this functionality.
llvm-svn: 174561
2013-02-07 00:21:34 +00:00
Edwin Vane a9c5bb3ff3 Turn off uninitialized-use warnings for gcc in cmake build
Added support to the cmake build to turn off uninitialized use warnings
for gcc. This cleans the build up somewhat.

Used logic simpler than found in autoconf by making use of the fact that
although gcc won't complain about unsupported -Wno-* flags it *will*
complain about unsupported -W flags.

Reviewers: gribozavr, doug.gregor, chandlerc
llvm-svn: 174299
2013-02-04 02:32:44 +00:00
Richard Smith 6c26e74781 Add -Wno-nested-anon-types to -pedantic builds of LLVM. This Clang warning
catches uses of an extremely minor and widely-available C++ extension (which
every C++ compiler I could find supports, but EDG and Clang reject in strict
mode).

The diagnosed code pattern looks like this:

struct X {
  union {
    struct {
      int a;
      int b;
    } S;
  };
};

llvm-svn: 174103
2013-01-31 22:19:12 +00:00
Edwin Vane c64108430f Turn off missing field initializer warnings for gcc
gcc produces false positives for empty braces so turning the warning off.
Instead, turning the warning on for clang so proper warnings aren't missed.
    
Reviewers: dblaikie, chandlerc

llvm-svn: 174073
2013-01-31 18:05:54 +00:00
Evgeniy Stepanov 130fdcd225 Annotate BumpPtrAllocator for MemorySanitizer.
This change adds MemorySanitizer annotations to BumpPtrAllocator to
improve report quality.

llvm-svn: 174051
2013-01-31 09:58:59 +00:00
NAKAMURA Takumi c42bdfcc05 [CMake][Lit][unittests] Cleanup in AddLLVM.cmake.
llvm-svn: 173617
2013-01-27 12:46:53 +00:00
NAKAMURA Takumi 61a8f974a7 [CMake][Lit][unittests] Deprecate CMAKE_BUILD_TYPE in each build directory for unittests.
For example,
cur) unittests/ADT/Release/ADTTests
new) unittests/ADT/ADTTests

RUNTIME_BUILD_MODE can be substituted to CMAKE_CFG_INTDIR.

With Make and Ninja, the tree is not built with multiple configurations.
Then, including the build type in target directory doesn't make sense.
See also "How can I build multiple modes without switching?"
http://www.cmake.org/Wiki/CMake_FAQ
CMAKE_CFG_INTDIR is set to "."

With multiple-configuration-aware build system, like Visual Studio, each unittest is built on appropriate directory, for example,
unittests/ADT/Release/ADTTests.exe
CMAKE_CFG_INTDIR is set to build system's variable, like "$(Configuration)" or "$(OutDir)".

Thus, "--param build_config" is also deprecated.

llvm-svn: 173616
2013-01-27 12:20:50 +00:00
Reid Kleckner cd947f9764 Disable MSVC's warning about noreturn destructors
This warning fires on:
  Operator::~Operator() {
    llvm_unreachable("should never destroy an Operator");
  }

That seems like a false positive.  I don't see any good way to silence
the warning here, so I'm disabling it.

llvm-svn: 173455
2013-01-25 15:36:13 +00:00
Chandler Carruth ef7f968e09 Add time getters to the process interface for requesting the elapsed
wall time, user time, and system time since a process started.

For walltime, we currently use TimeValue's interface and a global
initializer to compute a close approximation of total process runtime.

For user time, this adds support for an somewhat more precise timing
mechanism -- clock_gettime with the CLOCK_PROCESS_CPUTIME_ID clock
selected.

For system time, we have to do a full getrusage call to extract the
system time from the OS. This is expensive but unavoidable.

In passing, clean up the implementation of the old APIs and fix some
latent bugs in the Windows code. This might have manifested on Windows
ARM systems or other systems with strange 64-bit integer behavior.

The old API for this both user time and system time simultaneously from
a single getrusage call. While this results in fewer system calls, it
also results in a lower precision user time and if only user time is
desired, it introduces a higher overhead. It may be worthwhile to switch
some of the pass timers to not track system time and directly track user
and wall time. The old API also tracked walltime in a confusing way --
it just set it to the current walltime rather than providing any measure
of wall time since the process started the way buth user and system time
are tracked. The new API is more consistent here.

The plan is to eventually implement these methods for a *child* process
by using the wait3(2) system call to populate an rusage struct
representing the whole subprocess execution. That way, after waiting on
a child process its stats will become accurate and cheap to query.

llvm-svn: 171551
2013-01-04 23:19:55 +00:00
Michael J. Spencer 895809159a [CMake] MSVC is incorrectly emitting C4239 in some cases. Disable it.
llvm-svn: 171430
2013-01-03 00:00:40 +00:00
NAKAMURA Takumi 04a664e92e [CMake] AddLLVM.cmake: Tweak the corner case that "check-all" doesn't have any tests.
"check-all" can be executed with 0 status, "check-all does nothing, no tools built."

LLVM_EXTERNAL_CLANG_BUILD=OFF LLVM_BUILD_TOOLS=OFF can reproduce this.
Oscar Fuentes reported this. Thank you.

llvm-svn: 171046
2012-12-24 22:43:59 +00:00
Dmitri Gribenko 06b84eb414 Fix a typo introduced in r168577: FlAGS -> FLAGS (note the lowercase ell)
Now we really pass -Wcovered-switch-default if the compiler supports it.

llvm-svn: 171040
2012-12-24 17:52:48 +00:00
Alexey Samsonov e6ddb98565 CMake: factor out a function that returns the expected directory for unit test
llvm-svn: 170539
2012-12-19 12:30:33 +00:00
NAKAMURA Takumi 92eb254c3c [CMake] Move libxml2 stuff from clang to llvm/cmake.
llvm-svn: 170225
2012-12-14 18:30:20 +00:00
Jim Grosbach f7cbcf2648 CMake: Don't run 'git svn' if there is no .git/svn directory.
If the local checkout does not have 'git svn' references set up, don't try
to use 'git svn' for version information.

llvm-svn: 169749
2012-12-10 19:03:37 +00:00
Joe Abbey 15d9834df9 Removing SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
Adding CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG
       C_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG

This is to handle the wackiness on a Mac host where cmake detects:

CMAKE_CXX_COMPILER == "/usr/bin/c++"
CMAKE_C_COMPILER == "/usr/bin/gcc"

llvm-svn: 168577
2012-11-26 02:02:08 +00:00
Jordan Rose c7b09dd1d1 CMake: Include private headers / tablegen files in generated Xcode projects.
llvm-svn: 166503
2012-10-23 21:36:55 +00:00
NAKAMURA Takumi 54d2274914 [CMake] add_lit_testsuite: EXCLUDE_FROM_ALL excludes the test ${target} out of check-all.
llvm-svn: 165618
2012-10-10 13:32:55 +00:00
NAKAMURA Takumi 700cd4053a [CMake] Enhance add_llvm_external_project.
- Substitute hyphen to underscore, s/-/_/g, as the variable name.
  - Additional parameter can be specified as the name of directory.

e.g.) add_llvm_external_project(clang-tools-extra extra)

  - LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=/path/to/llvm-srcroot/tools/clang/tools/extra, by default.
  - Build directory is in ${CMAKE_CURRENT_BINARY_DIR}/extra

llvm-svn: 165311
2012-10-05 14:10:17 +00:00
Evgeniy Stepanov 68f23444b4 CMake toolchain file for Android NDK.
llvm-svn: 163612
2012-09-11 11:54:27 +00:00
Evgeniy Stepanov c439a42649 Fix Android build of gtest and lib/Support.
llvm-svn: 163131
2012-09-04 09:14:45 +00:00
Benjamin Kramer d02949b9f5 PR13689: Check for backtrace(3) in the cmake build.
llvm-svn: 163074
2012-09-01 20:50:18 +00:00
Eric Christopher 8ccd2863e9 Make sure to build libpthread to check for HAVE_PTHREAD_MUTEX_LOCK.
Patch by Brad Smith!

llvm-svn: 163033
2012-08-31 22:39:14 +00:00
Sebastian Pop faeca292a2 enable cross compilation with cmake
This patch allows us to use cmake to specify a cross compiler: target different
than host. In particular, it moves LLVM_DEFAULT_TARGET_TRIPLE and TARGET_TRIPLE
variables from cmake/config-ix.cmake to the toplevel CMakeLists.txt to make them
available at configure time.

Here is the command line that I have used to test my patches to create a Hexagon
cross compiler hosted on x86:

$ cmake -G Ninja -D LLVM_TARGETS_TO_BUILD:STRING=Hexagon -D TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D LLVM_DEFAULT_TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D LLVM_TARGET_ARCH:STRING=hexagon-unknown-linux-gnu ..
$ ninja check

llvm-svn: 162219
2012-08-20 19:56:52 +00:00
Sebastian Pop 8f4aec434e enable Hexagon target from cmake
The patch adds a missing case for the Hexagon target in cmake/config-ix.cmake.

llvm-svn: 162218
2012-08-20 19:56:49 +00:00
Sebastian Pop 82622dc3e9 revert my previous patch
llvm-svn: 161505
2012-08-08 18:04:45 +00:00
Sebastian Pop 7e9da1d4e8 enable Hexagon target from cmake
This patch allows us to use cmake to specify a cross compiler for Hexagon.

In particular, the patch adds a missing case for the target Hexagon in
cmake/config-ix.cmake, and it moves LLVM_DEFAULT_TARGET_TRIPLE and TARGET_TRIPLE
variables from cmake/config-ix.cmake to the toplevel CMakeLists.txt to make them
available at configure time. Here is the command line that I have used to test
my patches:

$ cmake -G Ninja -D BUILD_SHARED_LIBS:BOOL=ON -D LLVM_TARGETS_TO_BUILD:STRING=Hexagon -D TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D LLVM_DEFAULT_TARGET_TRIPLE:STRING=hexagon-unknown-linux-gnu -D LLVM_TARGET_ARCH:STRING=hexagon-unknown-linux-gnu -D LLVM_ENABLE_PIC:BOOL=OFF ..
$ ninja check

llvm-svn: 161504
2012-08-08 17:45:43 +00:00
NAKAMURA Takumi aa63610b09 [CMake] add_lit_target: Remove comments about add_dependencies. It is not a bug in cmake that add_custom_target(DEPENDS) would not accept targets but file-level dependencies.
llvm-svn: 161295
2012-08-04 02:14:44 +00:00
NAKAMURA Takumi 43652ae0de autoconf: Re-introduce LLVM_HOSTTRIPLE since r143500, as rework of PR11060.
cmake: Add LLVM_HOSTTRIPLE. For now, it is same as TARGET_TRIPLE.
llvm-svn: 160609
2012-07-22 03:04:52 +00:00
Gabor Greif c6c28ff8e6 detabify
llvm-svn: 160128
2012-07-12 13:18:13 +00:00
NAKAMURA Takumi 80eb0c502d LLVMConfig.cmake.in: Quote around @LLVM_INSTALL_PREFIX@, or it would not accept whitespace paths.
Thanks to Kai.

llvm-svn: 159887
2012-07-07 03:12:28 +00:00
Chandler Carruth aec961811b Revert r159588, and apply a more principled fix. Place the fix for this
in the abstraction for lit test suites so that the various other layers
of abstraction pick up the same behavioral fix, and so that we still get
a complete list of dependencies for the 'check-all' target.

This should fix the follow-on issues of the same nature with various
other build targets, including Clang targets. Sorry for the churn, and
again thanks to Matt for testing and breaking this more thoroughly.

llvm-svn: 159593
2012-07-02 21:31:03 +00:00
Chandler Carruth cfa4652d3a Switch from using a lit.cfg-generator variable that happens to be found
due to strange scoping rules to the actual canonical variable name
within the LLVM CMake build.

No functionality changed.

llvm-svn: 159575
2012-07-02 20:14:54 +00:00
Chandler Carruth 69ce6652b8 Hoist LLVM's lit testsuite infrastructure into module so that it can be
re-used. Also, build in direct support for accumulating a set of lit
parameters, arguments, and testsuites to run as part of a 'check-all'
rule. This sinks 'check-all' from a Clang-specific construct to
a generic construct of the project.

llvm-svn: 159482
2012-06-30 10:14:14 +00:00
Chandler Carruth 87dfb1d3fe Add a missing common variable to the lit.site.cfg generation. This was
only used in the Clang tree, but it seems reasonable to support.

llvm-svn: 159399
2012-06-29 00:40:15 +00:00
Chandler Carruth 3511dd30c8 Move the setup for variables that are expanded in the lit.site.cfg into
a dedicated helper function. This will enable re-using the same logic
for Clang's lit setup, etc.

llvm-svn: 159333
2012-06-28 06:36:24 +00:00