Commit Graph

144 Commits

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

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

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

FIXME: lld is tweaked minimally. Adding INTERFACE in each library would be better thing.
llvm-svn: 202241
2014-02-26 06:53:16 +00:00
NAKAMURA Takumi 9cd9ad6b9d [CMake] Introduce cmake_policy(CMP0022) for target_link_libraries(INTERFACE|PRIVATE).
For now, use both keywords, INTERFACE and PRIVATE via the variable,
  - ${cmake_2_8_12_INTERFACE}
  - ${cmake_2_8_12_PRIVATE}

They could be cleaned up when we introduce 2.8.12.

llvm-svn: 202239
2014-02-26 06:45:11 +00:00
NAKAMURA Takumi d464ec7d52 [CMake] clang_tblgen: Use add_public_tablegen_target.
llvm-svn: 201973
2014-02-23 13:08:07 +00:00
NAKAMURA Takumi a7fb2982b9 [CMake] Deprecate clang_tablegen(DEPENDS).
llvm-svn: 201971
2014-02-23 12:53:45 +00:00
NAKAMURA Takumi 7da9487dd4 [CMake] Get rid of explicit dependencies to include/clang/*.inc and introduce CLANG_TABLEGEN_TARGETS.
This does;
  - clang_tablegen() adds each tblgen'd target to global property CLANG_TABLEGEN_TARGETS as list.
  - List of targets is added to LLVM_COMMON_DEPENDS.
  - all clang libraries and targets depend on generated headers.

You might wonder this would be regression, but in fact, this is little loss.
  - Almost all of clang libraries depend on tblgen'd files and clang-tblgen.
  - clang-tblgen may cause short stall-out but doesn't cause unconditional rebuild.
  - Each library's dependencies to tblgen'd files might vary along headers' structure.
    It made hard to track and update *really optimal* dependencies.

Each dependency to intrinsics_gen and ClangSACheckers is left as DEPENDS.

llvm-svn: 201842
2014-02-21 07:59:59 +00:00
NAKAMURA Takumi 8e57597830 [CMake] add_clang_library(MODULE): Create a phony target when llvm_add_library(MODULE) gave up.
llvm-svn: 201319
2014-02-13 11:24:45 +00:00
NAKAMURA Takumi 3686e38c3d Fix Clang install rules to not set permissions on include/
The CMake install(DIRECTORY) command documents that it sets permissions
on directories it is asked to install.  Since the <prefix>/include
directory may not be exclusive to the LLVM/Clang installation, we should
not ask CMake to manage permissions of that directory for us.  Instead,
give only our own include/clang and include/clang-c subdirectories to
the install(DIRECTORY) command.

Fixes PR4500. Patch by Brad King.

llvm-svn: 201076
2014-02-10 10:51:09 +00:00
NAKAMURA Takumi eb961a3075 [CMake] add_clang_library(): Use llvm_add_library.
CMAKE_MODULE_LINKER_FLAGS can be removed since llvm_add_library(MODULE) adds same flags to MODULE.

llvm-svn: 201073
2014-02-10 09:05:28 +00:00
NAKAMURA Takumi da94d8a72e [CMake] add_clang_library(): Fix LLVM_PLUGIN_EXT in MODULE. It was broken since my r199902.
llvm-svn: 200760
2014-02-04 12:26:48 +00:00
NAKAMURA Takumi 75ab7f9b88 [CMake] add_clang_library(): Honor STATIC.
llvm-svn: 200759
2014-02-04 12:26:40 +00:00
NAKAMURA Takumi 85d65ff49b [CMake] Move cmake_minimum_required(2.8.8) at the top.
Suggested by Stephen Kelly.

llvm-svn: 200645
2014-02-02 16:59:36 +00:00
NAKAMURA Takumi 6b13975d40 clang/CMakeLists.txt: Untabify.
llvm-svn: 200643
2014-02-02 16:46:07 +00:00
NAKAMURA Takumi 89f7eaebe5 [CMake] Apply llvm_update_compile_flags() to add_clang_library().
llvm-svn: 200302
2014-01-28 09:47:12 +00:00
NAKAMURA Takumi 1a309679b8 [CMake] Always set CMAKE_INCLUDE_CURRENT_DIR.
llvm-svn: 200144
2014-01-26 12:34:48 +00:00
NAKAMURA Takumi 4080a2097b [CMake][Standalone] Introduce check-all.
llvm-svn: 200143
2014-01-26 12:34:38 +00:00
NAKAMURA Takumi 6a326249f8 [CMake] Reindent.
llvm-svn: 200133
2014-01-26 06:18:06 +00:00
NAKAMURA Takumi ac3ff26885 [CMake] Parameterize MODULE and SHARED in add_clang_library().
llvm-svn: 199902
2014-01-23 15:33:44 +00:00
NAKAMURA Takumi 5383113296 [CMake] Migrate LLVMParseArguments to CMakeParseArguments.
llvm-svn: 199901
2014-01-23 15:33:35 +00:00
NAKAMURA Takumi c28a9a2c33 [CMake] Deprecate CLANG_RUNTIME_OUTPUT_INTDIR and CLANG_LIBRARY_OUTPUT_INTDIR.
LLVM_*_OUTPUT_INTDIR should be available everywhere. It was my mistake when I introduced INTDIR stuff.

llvm-svn: 199597
2014-01-19 13:00:01 +00:00
NAKAMURA Takumi ee13ed8dbb [CMake][Standalone] Redefine LLVM_RUNTIME_OUTPUT_INTDIR and LLVM_LIBRARY_OUTPUT_INTDIR to point appropriate target directories.
llvm-svn: 199596
2014-01-19 12:55:14 +00:00
Chandler Carruth 0ad27923d5 LLVM's CMake is now using a feature that wasn't preasant in CMake 2.8.7,
so bump the minimum version in the standalone Clang CMake project as
well.

As I mentioned on the LLVM commit version of this, if this causes any
trouble for folks, just let me know. I'm trying to avoid re-implementing
functionality in CMake, but I will if there are problems using the newer
versions.

llvm-svn: 199152
2014-01-13 22:23:58 +00:00
Chandler Carruth 38a61d87a5 Teach the standalone Clang CMake bits about the flag to force using an
old toolchain to build. The toolchain version is now checked in
HandleLLVMOptions.

llvm-svn: 199150
2014-01-13 22:22:24 +00:00
NAKAMURA Takumi f0a1ab8f2a [CMake] Move BUG_REPORT_URL from clang to llvm.
It was too late to set BUG_REPORT_URL after configure_file(config.h).
BUG_REPORT_URL in config.h.cmake would be updated at 2nd run of cmake.
It caused many recompilations.

FYI, configure handles BUG_REPORT_URL in llvm side.

llvm-svn: 199076
2014-01-13 05:25:13 +00:00
Alp Toker 70ff5d7378 Build fix following r198747
Convert CMake CLANG_BUILD_EXAMPLES to a boolean value for consumption by
Python, otherwise the raw config string gets passed through which may not be
0/1.

The if/else matches the technique used to solve the problem in LLVM's own
CMakeLists.txt.

llvm-svn: 198750
2014-01-08 11:55:49 +00:00
Alp Toker 120dd1afaf Add tests for clang plugins
Somehow the entire plugin infrastructure went wholly untested until now.

The only plugins available for use in testing are the examples, so plugin tests
will only be run if CLANG_BUILD_EXAMPLES is enabled in the build.

(The examples should really be enabled by default, not just to aid testing but
also to prevent bitrot in some key user-facing code. I'll propose that
shortly.)

Requires supporting changes in LLVM r198746.

llvm-svn: 198747
2014-01-08 11:38:47 +00:00
Jordan Rose 4e754085ce [CMake] Add missing set_output_directory after Takumi's change in r198205.
In a standalone build, Clang binaries should end up in Clang's build folder,
not LLVM's.

Xcode still has a few issues finding auxiliary tools and libraries in the
build folders. I'll fix those next.

llvm-svn: 198328
2014-01-02 18:28:32 +00:00
NAKAMURA Takumi baa9f533fe [CMake][VS][XCode] Restruct the output directory layout more comfortable, ${BINARY_DIR}/${BUILD_MODE}/(bin|lib)
We have been seeing nasty directory layout with CMake multiconfig, such as,
  bin/Release/clang.exe
  lib/clang/3.x/...
  lib/Release/clang/3.x/.. (duplicated)

Move the layout similar to autoconf's;
  Release/bin/clang.exe
  Release/lib/clang/3.x/...

Checked on Visual Studio 10. Could you guys please confirm my change on XCode(and other multiconfig builders)?

Note: Don't set variables CMAKE_*_OUTPUT_DIRECTORY any more, or a certain builder, for eaxample, msbuild.exe, would be confused.
llvm-svn: 198205
2013-12-30 06:48:30 +00:00
Nico Weber 194c009352 Port r198088 (set NO_DEAD_STRIP for clang) from make to cmake.
Also stop setting passing -dead_strip explicitly for libclang and instead
rely on this now happening by default. (And make it happen by default for
add_clang_library, which doesn't use the library cmake functions from llvm.)

llvm-svn: 198200
2013-12-30 03:43:30 +00:00
Nico Weber 216436c77a [cmake] Set in LLVM_EXPORTED_SYMBOL_FILE PrintFunctionNames/CMakeLists.txt.
The corresponding Makefile sets it too. Also tweak add_clang_library to support
LLVM_EXPORTED_SYMBOL_FILE for modules.

llvm-svn: 198185
2013-12-29 23:14:26 +00:00
Nico Weber 5f676dc53a Use LLVM_EXPORTED_SYMBOL_FILE in libclang's cmake build.
Now the exports file should have an effect on non-darwin too.

llvm-svn: 198176
2013-12-29 19:31:48 +00:00
Jordan Rose af9f87522f [CMake] Tweak r197697 to handle CMake finding the wrong llvm-config/tblgen.
- If llvm-config fails, output an error to the user rather than allowing
  errors to cascade.
- Always get llvm-tblgen from llvm-config's bindir.

Turns out my PATH points to a really old version of LLVM; both of these
fell out of trying to make this experience nicer.

llvm-svn: 197714
2013-12-19 18:39:05 +00:00
NAKAMURA Takumi e6d79ec0eb [CMake][Standalone] Rewrite standalone build based on llvm-config. CLANG_PATH_TO_LLVM_*(s) are deprecated.
Checked on VS10(multiconfig) and some singleconfig builders.

* Assumptions

  - You should specify llvm-config as LLVM_CONFIG.
    CMake could find one in $PATH by default.

  - ENABLE_ASSERTIONS obeys LLVM's.

* Use cases

  a) With LLVM build tree

    Assume llvm-config is in your build tree.
    Everything should work as ever.

  b) With *installed* LLVM

    Assume distributions. The source tree can be optional.

    b1) The source tree is provided on the location `llvm-config --src-root`

      - Test utils, FileCheck &c., are imported and built in the new tree.
      - Gtest is built in the tree if gtest library is not found.
      - Lit is used in $(SRCROOT)/utils/lit/lit.py.

    b2) The source tree is not provided

      - clang and utilities can be built.
      - All tests, unittests and check-clang are invalidated and not built.

llvm-svn: 197697
2013-12-19 16:44:32 +00:00
NAKAMURA Takumi ed79c96f89 [CMake] check-clang: Include ClangUnitTests if it can be built. Check existence of gtest.h then.
llvm-svn: 197688
2013-12-19 16:05:44 +00:00
NAKAMURA Takumi b1ec06b0a2 [CMake][Standalone] Import LLVM_LIT_TOOLS_DIR.
llvm-svn: 197461
2013-12-17 04:14:26 +00:00
NAKAMURA Takumi e3d8f1a17e [CMake][Standalone] Fix llvm-tblgen's directory to use LLVM_TOOLS_BINARY_DIR instead of LLVM_BINARY_DIR.
LLVM_BINARY_DIR points OBJROOT.

FIXME: llvm-config should show *real* bindir with --bindir.
llvm-svn: 197460
2013-12-17 04:14:22 +00:00
NAKAMURA Takumi 17645a4772 [CMake][Standalone] Fixup r197395 for standalone build.
Standalone scripts shall be rewritten.

llvm-svn: 197459
2013-12-17 04:14:17 +00:00
Dmitri Gribenko f7d23ff1a6 In a standalone Clang build, default to building tests, like LLVM does
LLVM_INCLUDE_TESTS is set in the top-level LLVM CMakeLists, which is not being
executed when Clang is built in a separate directory.

llvm-svn: 197423
2013-12-16 20:54:13 +00:00
NAKAMURA Takumi a8c958de47 [CMake] Introduce CLANG_RUNTIME_OUTPUT_INTDIR and CLANG_LIBRARY_OUTPUT_INTDIR.
llvm-svn: 197395
2013-12-16 16:03:21 +00:00
Argyrios Kyrtzidis 08b0418828 [libclang] Some changes on the linker options for libclang on a CMake build.
- Use the 'libclang.exports' file.
- Pass -Wl,-current_version
- Set install name to "@rpath"

llvm-svn: 194134
2013-11-06 08:37:50 +00:00
Rafael Espindola fc74c81451 Revert commits r190613, r190560 and r190557.
The added a cmake invocation to null builds, making them a lot slower.

llvm-svn: 191784
2013-10-01 17:31:40 +00:00
Jordan Rose f31f5f8488 [CMake] Put controversial always-recheck-revision-number behind an option.
CMake does not have the ability to perform actions before calculating
dependencies, so it can't know whether it needs to rebuild clangBasic
to update for a new revision number. CLANG_ALWAYS_CHECK_VC_REV (off by
default) will cause clangBasic to always be dirty by deleting the
generated SVNVersion.inc after use; otherwise, SVNVersion.inc will
always be updated, but only included in the final binary when clangBasic
is rebuilt.

It'd be great to find a better way to do this, but hopefully this is
still an improvement over the complete lack of version information before.

llvm-svn: 190613
2013-09-12 16:17:41 +00:00
Michael Gottesman 8f897af39c [doxygen] Added code for generating doxygen documentation for clang for cmake.
llvm-svn: 189508
2013-08-28 20:29:40 +00:00
Michael Gottesman 9474b45dc4 Use set to create CLANG_ORDER_FILE instead of option which implies a bool value.
Patch by Edoardo P. <ed0.88.prez@gmail.com>.

llvm-svn: 189311
2013-08-27 04:40:12 +00:00
Hans Wennborg 25971caf92 CMake: support the LLVM_INSTALL_TOOLCHAIN_ONLY flag
Differential Revision: http://llvm-reviews.chandlerc.com/D1498

llvm-svn: 189156
2013-08-24 00:22:23 +00:00
Hans Wennborg 8c981adcec Rename CMake variable; this fell out of r189127 somehow.
llvm-svn: 189129
2013-08-23 18:20:47 +00:00
Hans Wennborg f135e3534c CMake: Don't look for llvm-tblgen when building outside LLVM tree
Previously, the CMake build would look for llvm-tblgen to determine
if a directory is an LLVM build or install directory. Since we don't
want to include llvm-tblgen in the install, look for llvm-config instead,
and use that to find llvm-tblgen.

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

llvm-svn: 189127
2013-08-23 18:05:24 +00:00
Jordan Rose a1e4b12223 Fix dependencies now that the ARC migrator depends on the static analyzer.
Thanks for pointing this out, Stephen. I think this is right now -- I
attempted to try all four valid combinations with both the autoconf and
CMake builds.

See also LLVM changes to the configure script.

llvm-svn: 189027
2013-08-22 15:50:02 +00:00
Michael Gottesman 3f3404fd3a [autotools->cmake] Added support for building clang with an order file.
llvm-svn: 188763
2013-08-20 07:41:18 +00:00
Michael Gottesman 23a3567bf1 [autotools->cmake] Move add_subdirectory(test) inside CLANG_INCLUDE_TESTS to match the behavior of the LLVM where LLVM_INCLUDE_TESTS controls whether tests is included.
llvm-svn: 188760
2013-08-20 07:09:54 +00:00
Michael Gottesman b260f04afc [autotools->cmake] Added variable CLANG_VENDOR_UTI.
llvm-svn: 188479
2013-08-15 19:22:36 +00:00