Commit Graph

381 Commits

Author SHA1 Message Date
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
NAKAMURA Takumi 1171e816ba LLVMProcessSources.cmake: [MSVC] Don't add "PROPERTIES HEADER_FILE_ONLY" to *.def.
FIXME: Shall we put *.def(s) to the folder?
llvm-svn: 159102
2012-06-24 03:50:58 +00:00
Chandler Carruth 582e8a5d42 Avoid using the recently added APPEND_STRING feature. This should
restore support for CMake versions before 2.8.6 -- sorry for the
trouble!

llvm-svn: 158930
2012-06-21 18:44:24 +00:00
Chandler Carruth 94d0251824 Completely refactor the structuring of unittest CMake files to match the
Makefiles, the CMake files in every other part of the LLVM tree, and
sanity.

This should also restore the output tree structure of all the unit
tests, sorry for breaking that, and thanks for letting me know.

The fundamental change is to put a CMakeLists.txt file in the unittest
directory, with a single test binary produced from it. This has several
advantages:

- No more weird directory stripping in the unittest macro, allowing it
  to be used more readily in other projects.
- No more directory prefixes on all the source files.
- Allows correct and precise use of LLVM's per-directory dependency
  system.
- Allows use of the checking logic for source files that have not been
  added to the CMake build. This uncovered a file being skipped with
  CMake in LLVM and one in Clang's unit tests.
- Makes Specifying conditional compilation or other custom logic for JIT
  tests easier.

It did require adding the concept of an explicit 'optional' source file
to the CMake build so that the missing-file check can skip cases where
the file is *supposed* to be missing. =]

This is another chunk of refactoring the CMake build in order to make it
usable for other clients like CompilerRT / ASan / TSan.

Note that this is interdependent with a Clang CMake change.

llvm-svn: 158909
2012-06-21 09:51:26 +00:00
Chandler Carruth a5d42f83f9 Factor the logic for setting up a GoogleTest unit test executable into
a helper function in CMake. This will allow us to share all of this
logic with Clang, and eventually CompilerRT.

llvm-svn: 158896
2012-06-21 05:16:58 +00:00
Chandler Carruth e530d2ba4d Remove one of the LLVM-specific CMake hacks in favor of standard CMake
facilities.

This was only used in one place in LLVM, and was used pervasively (but
with different code!) in Clang. It has no advantages over the standard
CMake facilities and in some cases disadvantages.

llvm-svn: 158889
2012-06-21 01:35:09 +00:00
NAKAMURA Takumi e0d4a7c5be TableGen.cmake: Fix to work without LLVM_COMMON_DEPENDS.
llvm-svn: 158650
2012-06-17 15:41:56 +00:00
Tobias Grosser b32ad40188 cmake: Pass the -m32 flag to modules if LLVM_BUILD_32_BITS is enabled
This was previously only done for executables and shared libraries, but not
for modules. As modules are essentially shared libraries (that need to be
dlopened explicitly), threating them the same as shared libraries seems
reasonable. This fixes the LLVM_BUILD_32_BITS build of Polly.

Contributed by: Ondra Hosek  <ondra.hosek@gmail.com>

llvm-svn: 158195
2012-06-08 09:41:23 +00:00
Michael J. Spencer aeb59e1d0d [CMake] Promote extension warnings to errors.
llvm-svn: 158176
2012-06-07 23:33:56 +00:00
Michael J. Spencer 08180c325f [CMake] Order MSVC warnings numerically.
llvm-svn: 158171
2012-06-07 21:34:31 +00:00
Michael J. Spencer 6d45d834a7 [CMake] Adjust MSVC warnings.
Remove /Wall from LLVM_ENABLE_WARNINGS (it's useless) and promote 4239
to a level 1 warning.

llvm-svn: 158170
2012-06-07 21:34:15 +00:00
Tim Northover f6e29c4771 Fix how CMake appends -m32 to linker command-lines
llvm-svn: 157337
2012-05-23 18:42:02 +00:00
Rafael Espindola ac57583236 Adding -fcolor-diagnostics is causing problem to users that parse the build
output. Peter Collingbourne also reports that it is showing up in
$(llvm-config --cflags).

Revert this for now since I don't know enough cmake to fix it properly.

This reverts commit 18efed7adc79c1970f307bb5b015d199012ba872.

llvm-svn: 156392
2012-05-08 18:11:06 +00:00
Daniel Dunbar 407a85e7a6 [build] Add build check for ::arc4random().
llvm-svn: 156236
2012-05-05 16:36:16 +00:00
Rafael Espindola 1abcf64283 Pass -fcolor-diagnostics when it is supported. This makes a difference when
using cmake+ninja, since ninja buffers the compiler output.

llvm-svn: 156150
2012-05-04 03:23:36 +00:00
Ted Kremenek 1233895097 Add rudimentary CMake logic for detecting Graphviz.
llvm-svn: 156108
2012-05-03 21:51:05 +00:00
Michael J. Spencer e734f5417f [CMake] Restructure how Clang, Polly and other external projects get included.
While making lld build under the tools directory I decided to refactor how this
works.

There is now a macro, add_llvm_external_project, which takes the name of the
expected subdirectory. This sets up two CMake options.

 * LLVM_EXTERNAL_${NAME}_SOURCE_DIR
     This is the path to the source. It defaults to
     ${CMAKE_CURRENT_SOURCE_DIR}/${name}.
 * LLVM_EXTERNAL_${NAME}_BUILD
     Enable and disable building the tool as part of LLVM.

I chose LLVM_EXTERNAL_${NAME} as a prefix so they all show up together in the
GUI.

llvm-svn: 155654
2012-04-26 19:43:35 +00:00
NAKAMURA Takumi 75bfe69282 CMake: Enable LLVM_COMPILER_JOBS on all MS IDEs. We don't support older environments than VS9.
llvm-svn: 155285
2012-04-21 14:51:02 +00:00
NAKAMURA Takumi a83601d637 CMake: Prune redundant LLVM_COMPILER_JOBS from llvm/CMakeLists.txt. HandleLLVMOptions.cmake has it.
llvm-svn: 155284
2012-04-21 14:50:56 +00:00
Eric Christopher 56079c1e72 Add InitializeNativeTargetDisassembler function.
Patch by Ojab.

llvm-svn: 153476
2012-03-26 21:56:56 +00:00
Michael J. Spencer 35145f830a Minimal changes for LLVM to compile under VS11.
llvm-svn: 151849
2012-03-01 22:42:52 +00:00
Rafael Espindola 42e94d11a1 Enable -Wcovered-switch-default again, but add -Werror to the checks to make
sure we don't use it with compilers that don't support it.

llvm-svn: 151665
2012-02-28 23:32:06 +00:00
Chandler Carruth 0bd3913d96 Temporarily revert r151609, which enabled a new warning for LLVM and
Clang builds. The detection logic for compilers that support the warning
isn't working. Rafael is going to investigate it, but didn't want people
to have to wade through build spam until then.

llvm-svn: 151649
2012-02-28 19:26:56 +00:00
Rafael Espindola 334eaeae8e Enable -Wcovered-switch-default as it matches the switch style used in llvm.
llvm-svn: 151609
2012-02-28 02:01:55 +00:00
Dylan Noblesmith c6c7a5819d add LLVM_VERSION_MAJOR and _MINOR defines
This is useful for clients that want to maintain compatibility
across multiple releases of LLVM. Currently users like Klee and
Mesa all have to roll their own 'parse llvm-config --version
output and generate defines' solution.

Also reuse the new macros so that version information is less
redundant/likely to fall out of sync again in the future.

llvm-svn: 150405
2012-02-13 18:48:10 +00:00