Installing <prefix>/share/clang/cmake/ClangConfig.cmake makes CMake's
builtin find_package() utility work with Clang. This also allows
downstream consumers of Clang to statically link against libraries like
clangAST and have that pull in dependencies like clangBasic and
LLVMSupport.
See the CMake docs on packages:
http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html
llvm-svn: 221411
The rewrite facility's footprint is small so it's not worth going to these
lengths to support disabling at configure time, particularly since key compiler
features now depend on it.
Meanwhile the Objective-C rewriters have been moved under the
ENABLE_CLANG_ARCMT umbrella for now as they're comparatively heavy and still
potentially worth excluding from lightweight builds.
Tests are now passing with any combination of feature flags. The flags
historically haven't been tested by LLVM's build servers so caveat emptor.
llvm-svn: 213171
Prospectively revert to get one of the many build configurations back working
(presumably the side-by-side+modular CMake config).
This reverts commit r212997.
llvm-svn: 213008
We probably just need to touch LLVM's configure this time to work around the
totally inadequate Makefile build server integration.
This reverts commit r210314.
llvm-svn: 210320
This will unbreak clang vendor builds as a follow-up to r210238, now that we
can't poke into LLVM's private config.h (nor should the string be exposed by
llvm-config.h).
This hopefully removes for good the last include of LLVM's config.h.
llvm-svn: 210313
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
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
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
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
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
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
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
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
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
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
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
- 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
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
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
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
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
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
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
-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
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
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
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
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
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
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
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
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
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
information including the fully preprocessed source file(s) and command line
arguments. The developer is asked to attach this diagnostic information to a
bug report.
rdar://9575623
llvm-svn: 136702
(and linking to an already-build LLVM) works with Xcode. The resulting
Xcode project for Clang is quite a bit smaller and builds/loads faster.
llvm-svn: 135216
This is a hack because we really should only search in the 'include/clang/StaticAnalyzer' directory
if we are in 'lib/StaticAnalyzer'. My CMake knowledge is limited, so I appeal to anyone with
more expertise.
llvm-svn: 125252
The user sets the variable CLANG_PATH_TO_LLVM_BUILD pointing to a LLVM
build directory or to a directory where LLVM was installed. When using
a non-installed LLVM build, it is necessary to set
CLANG_PATH_TO_LLVM_SOURCE as well.
llvm-svn: 124817
- llvm's libs must be linked after clang's
- libLLVMSystem depends on psapi on win32 (get_system_libs has it)
- CIndex builds successfully on mingw now
llvm-svn: 83773
diagnostics. This builds on the patch that Sebastian committed and
then revert. Major differences are:
- We don't remove or use the current ".def" files. Instead, for now,
we just make sure that we're building the ".inc" files.
- Fixed CMake makefiles to run TableGen and build the ".inc" files
when needed. Tested with both the Xcode and Makefile generators
provided by CMake, so it should be solid.
- Fixed normal makefiles to handle out-of-source builds that involve
the ".inc" files.
I'll send a separate patch to the list with Sebastian's changes that
eliminate the use of the .def files.
llvm-svn: 67058