Commit Graph

113 Commits

Author SHA1 Message Date
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
Michael Gottesman 46d67de84d [autotools->cmake] Added CMake support for the preprocessor variable CLANG_REPOSITORY_STRING.
This is a patch in a longer series of patches to add
capabilities/definitions that are present in the Autotools build chain
and not in the CMake build chain to the CMake build chain.

*NOTE* I am hacking on this in my free time. I will annotate each commit
with the [autotools->cmake] header.

llvm-svn: 188478
2013-08-15 19:22:33 +00:00
Hans Wennborg 6ddc6901ef clang-cl: add support for the /? and /help options
This establishes a new Flag in Options.td, which can be assigned to
options that should be made available in clang's cl.exe compatible
mode, and updates the Driver to make use of the flag.

(The whitespace change to CMakeLists forces the build to re-run CMake
 and pick up the include dependency on the new .td file. This makes the
 build work if someone moves backwards in commit history after this change.)

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

llvm-svn: 187280
2013-07-27 00:23:45 +00:00
Andy Gibbs 30feecd2a7 Retain linker flags specified on cmake command line.
llvm-svn: 183857
2013-06-12 20:02:59 +00:00
Roman Divacky 95ad7794a9 Turn CLANG_ENABLE_{ARCMT,REWRITER,STATIC_ANALYZER} into proper options so that
users can disable those. Just like in autoconf generated makefiles.

llvm-svn: 182881
2013-05-29 21:09:18 +00:00
Richard Smith da466db02a cmake: Only add -pedantic if LLVM didn't add it. Don't unconditionally add
-Wall -W, since it's already provided by LLVM's cmake config, and that
overrides fixes (such as -Wno-uninitialized) which LLVM's cmake setup may have
provided.

llvm-svn: 180018
2013-04-22 14:51:21 +00:00
Jordan Rose bd804e9d6a CMake: -Wno-nested-anon-types for Clang.
In LLVM, -pedantic is not set unless LLVM_ENABLE_PEDANTIC is set.
However, Clang's CMakeLists.txt unilaterally adds -pedantic to the run
line, so we need to disable -Wnested-anon-types explicitly.

llvm-svn: 176393
2013-03-02 00:49:47 +00:00
Alexey Samsonov 46c0bc233b Define CMake option CLANG_INCLUDE_TESTS *before* traversing into tests/ subdirectory. Otherwise, while configuring the build tree for the first time, Clang unit tests could avoid being added to 'check-clang' command, and thus avoid being built and executed.
llvm-svn: 176080
2013-02-26 09:43:27 +00:00
Jordan Rose 08bf4fd345 CMake: Include Clang unit tests in check-clang target in standalone builds.
Also, remove CLANG_BUILD_TESTS option. It won't have consistent behavior
between standalone and non-standalone builds, so I'm not going to bother
hooking it up for standalone builds. LLVM_BUILD_TESTS will continue to
control unit test inclusion in the "all" target in non-standalone builds.

Finally, fix the default value of CLANG_INCLUDE_TESTS, which was being set
to the boolean value of "LLVM_INCLUDE_TESTS", i.e. OFF, rather than actually
reading the variable ${LLVM_INCLUDE_TESTS}! If you picked up my earlier
commit, YOU WILL HAVE TO MANUALLY SET THIS OPTION BACK ON. My apologies!

Part two of r174691 (allow the unit tests to be built in standalone mode).

llvm-svn: 174698
2013-02-08 07:28:25 +00:00
Jordan Rose dfbe77cdf5 CMake: Optionally allow running the Clang unit tests in standalone builds.
The reason this is not enabled by default is because there is no way for
Clang to guarantee that the LLVM unit testing infrastruture has been built.
However, if it /has/ been built, there's no reason why the standalone Clang
build can't use it!

This should have no effect on existing builds -- in a combined build the
value of the CLANG_INCLUDE_TESTS option defaults to the LLVM equivalent,
and in a standalone build it defaults to off.

llvm-svn: 174691
2013-02-08 01:42:37 +00:00
Douglas Gregor 4d65bbd509 CMake: Make sure to detect LibXml2 when Clang is built standalone
llvm-svn: 170444
2012-12-18 19:39:40 +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
NAKAMURA Takumi 62167ca254 Update CMake build corresponding to r170135.
Thanks to Saleem Abdulrasool, aka compnerd!

llvm-svn: 170136
2012-12-13 16:24:59 +00:00
Jordan Rose afaee3c3da CMake: Fix public header search for generating Xcode/MSVC projects.
Previously, we only had support for one level of library under lib/,
with the existence of the two-level lib/StaticAnalyzer/* hardcoded in
the top-level CMakeLists.txt. This became a problem with split of
libRewrite into several libraries -- with the same sub-names as the
libraries in lib/StaticAnalyzer/.

Now, we match up anything under lib/ to the corresponding directory
in include/clang/.

llvm-svn: 166505
2012-10-23 21:54:03 +00:00
Douglas Gregor 06228f273a Fix capitalization of LibXml2 for CMake on case-sensitive file systems
llvm-svn: 161445
2012-08-07 20:42:31 +00:00
Dmitri Gribenko 740c0fbe0e libclang API for comment-to-xml conversion.
The implementation also includes a Relax NG schema and tests for the schema
itself.  The schema is used in c-index-test to verify that XML documents we
produce are valid.  In order to do the validation, we add an optional libxml2
dependency for c-index-test.

Credits for CMake part go to Doug Gregor.  Credits for Autoconf part go to Eric
Christopher.  Thanks!

llvm-svn: 161431
2012-08-07 17:54:38 +00:00
NAKAMURA Takumi d3f78a1458 clang/CMakeLists.txt: Move "examples" after building lib and tools.
llvm-svn: 160848
2012-07-27 06:17:48 +00:00
NAKAMURA Takumi d7ba69de90 [CMake] Get rid of unconditional dependency to ClangDiagnosticCommon. Only clangBasic and clangASTMatchers need it.
llvm-svn: 159931
2012-07-09 14:12:20 +00:00
Chandler Carruth e8f69b733a Clone a bit of LIT flag defaults from the LLVM CMake file into the
standalone section of the Clang CMake files.

This will likely make the lit runs in Clang much more suitable to IDEs
such as Xcode and MSVC when operating in a standalone mode.

llvm-svn: 159582
2012-07-02 20:52:55 +00:00
Chandler Carruth 28969b4139 Remove a goofy CMake hack and use the standard CMake facilities to
express library-level dependencies within Clang.

This is no more verbose really, and plays nicer with the rest of the
CMake facilities. It should also have no change in functionality.

llvm-svn: 158888
2012-06-21 01:30:21 +00:00
Francois Pichet b27ea02784 Zap the /Za compiler switch from MSVC projects, the option is considered harmful even by Microsoft people and clang won't build using the MSVC 2012 RC if not removed.
Only 1 minor code change was necessary: can't use cdecl as variable name anymore.

llvm-svn: 158063
2012-06-06 12:00:10 +00:00
Sebastian Pop 980920a321 use DEFAULT_SYSROOT
llvm-svn: 154792
2012-04-16 04:16:43 +00:00
NAKAMURA Takumi a3534f5c9a CMake: install libclang.dll to $CMAKE_INSTALL_PREFIX/bin.
Patch by Joe Groff.

llvm-svn: 151448
2012-02-25 16:46:50 +00:00
Dylan Noblesmith 4d9cbffbe2 include clang's config.h unconditionally (v2)
And remove HAVE_CLANG_CONFIG_H, now that the header is generated
in the autoconf build, too.

Reverts r149571/restores r149504, now that config.h is generated
correctly by LLVM's configure in all build configurations.

llvm-svn: 150487
2012-02-14 15:54:49 +00:00
Dylan Noblesmith 4f4e745725 back out r149504
Too many weird build failures.

llvm-svn: 149571
2012-02-02 00:40:14 +00:00
Dylan Noblesmith 5b7ba95294 cmake: don't install config.h (v2)
This header is private and shouldn't be used by clients.

(This reverts r149540, reinstating r149496. False alarm.)

llvm-svn: 149550
2012-02-01 22:22:37 +00:00
Dylan Noblesmith dc3980a945 cmake: revert r149496
It *looks* like this caused PR11903, somehow.

llvm-svn: 149540
2012-02-01 21:17:55 +00:00
Dylan Noblesmith 86780e906b include clang's config.h unconditionally
And remove HAVE_CLANG_CONFIG_H, now that the header is generated
in the autoconf build, too. (clang r149497 / llvm r149498)

Also include the config.h header after all other headers, per
the LLVM coding standards.

It also turns out WindowsToolChain.cpp wasn't using the config
header at all, so that include's just deleted now.

llvm-svn: 149504
2012-02-01 14:25:28 +00:00
Dylan Noblesmith c20ccdd786 cmake: don't install config.h
This header is private and shouldn't be used by clients.

llvm-svn: 149496
2012-02-01 13:50:22 +00:00
Peter Collingbourne 53860cfeb0 Adjust CLANG_BUILD_EXAMPLES to mean whether the examples are built
by default, rather than whether they may be built at all.

llvm-svn: 149037
2012-01-26 03:33:40 +00:00
Peter Collingbourne bee583fd6e Add the Clang tblgen backends to Clang, and flip the switch to cause
the build systems to use clang-tblgen.

llvm-svn: 141291
2011-10-06 13:03:08 +00:00
Peter Collingbourne d937a99465 Clang-side build system infrastructure for multiple tblgens.
llvm-svn: 141267
2011-10-06 01:52:10 +00:00