Commit Graph

605 Commits

Author SHA1 Message Date
Reid Kleckner 9f5eb637cb Added Sphinx documentation generation to CMake build system.
The option LLVM_ENABLE_SPHINX option enables the "docs-llvm-html",
"docs-llvm-man" targets but does not build them by default. The
following CMake options have been added that control what targets are
made available

SPHINX_OUTPUT_HTML
SPHINX_OUTPUT_MAN

If LLVM_BUILD_DOCS is enabled then the enabled docs-llvm-* targets will
be built by default and if ``make install`` is run then docs-llvm-html
and docs-llvm-man will be installed (tested on Linux only).

The add_sphinx_target function is in its own file so it can be included
by other projects that use Sphinx for their documentation.

Patch by Daniel Liew <daniel.liew@imperial.ac.uk>!

llvm-svn: 206655
2014-04-18 21:45:25 +00:00
Eric Christopher 814496a453 Teach LLVMConfigVersion.cmake to behave as find_package() expects.
Patch by Brad King

llvm-svn: 206426
2014-04-16 23:15:31 +00:00
Eric Christopher 87e545f86c Add support for a patch version to the cmake system.
Patch by Brad King

llvm-svn: 206425
2014-04-16 23:15:28 +00:00
NAKAMURA Takumi 543105f7b7 AddLLVM: Mute the prefix "lib" in SHARED on win32.
- LLVMSupport.dll
  - libLLVMSupport.dll.a

llvm-svn: 205969
2014-04-10 15:47:04 +00:00
Viktor Kutuzov 6bd3229616 Add support for building LLVM on FreeBSD 9.2
llvm-svn: 205847
2014-04-09 11:43:34 +00:00
Tim Northover 00ed9964c6 ARM64: initial backend import
This adds a second implementation of the AArch64 architecture to LLVM,
accessible in parallel via the "arm64" triple. The plan over the
coming weeks & months is to merge the two into a single backend,
during which time thorough code review should naturally occur.

Everything will be easier with the target in-tree though, hence this
commit.

llvm-svn: 205090
2014-03-29 10:18:08 +00:00
Hans Wennborg a3c3b8104d Win installer: provide a pretty icon
llvm-svn: 204960
2014-03-27 20:48:37 +00:00
Yaron Keren e485511e8e Remove cmake module support for Visual C++ 2010 (MSVC10)
but keep the MSVC11 (Visual C++ 2012) support.

llvm-svn: 204706
2014-03-25 09:34:20 +00:00
Yaron Keren 24fdbe5676 Disable Visual C++ warning 4722 about aborting a destructor,
it has no value for us.

llvm-svn: 204704
2014-03-25 08:42:49 +00:00
NAKAMURA Takumi f81612381e [CMake][cygming] Disable --out-implib from executables.
It doesn't make sense even with --export-all-symbols.

llvm-svn: 204017
2014-03-16 13:51:24 +00:00
Alexey Samsonov cd083fe151 [CMake] Put -Werror to CMAKE_CXX_FLAGS instead of using add_llvm_definitions()
add_definitions shouldn't really be used for compiler flags, and the variable
LLVM_DEFINITIONS is not appropriately used at the moment, e.g. it's not exported
to LLVMConfig.cmake

llvm-svn: 203792
2014-03-13 13:08:47 +00:00
Ted Kremenek 68af845661 [CMake] Enable a bunch of Xcode build settings that correspond to warnings that are for the most part enabled by default either by Clang or -Wall.
I personally build with these settings enabled all the time, and it
is clearer to see the actual warning flags (e.g., -Wuninitialized)
get passed by Xcode rather than seeing -Wno-uninitialized followed
by -Wall (the latter canceling out the former) and figuring out
what is going on.

Xcode will ignore build settings it doesn't understand, so this will
work on possibly older versions of Xcode that don't support all
of these settings.

llvm-svn: 203760
2014-03-13 06:37:28 +00:00
Rafael Espindola 8b35074e09 Use -std=gnu++11 on cygwin and mingw.
Without this common features like off_t and strdup are missing.
This should bring back those bots.

Configure bits by Meador Inge.

llvm-svn: 203701
2014-03-12 20:01:15 +00:00
NAKAMURA Takumi 45374cc4ce [CMake] add_llvm_target(): No need to include TABLEGEN_OUTPUT in source list.
llvm-svn: 202862
2014-03-04 17:05:28 +00:00
Chandler Carruth 25eacf7e77 [C++11] Switch the CMake option from LLVM_ENABLE_CXX11 (default on) to
LLVM_ENABLE_CXX1Y (default *off*). =D C++98 is dead. Long live C++11.

I don't exactly recommend using C++1y just yet though...

llvm-svn: 202567
2014-03-01 03:16:07 +00:00
Rafael Espindola 11ac853774 With rpaths being set correctly, SHLIBPATH_VAR is not needed anymore.
llvm-svn: 202510
2014-02-28 16:16:51 +00:00
NAKAMURA Takumi b47a2c09aa [CMake] llvm_add_library(SHARED|STATIC): Fix broken OUTPUT_NAME for *_static.
llvm-svn: 202454
2014-02-28 00:28:13 +00:00
NAKAMURA Takumi ecea4522cd [CMake] Work around to use target_link_libraries(PUBLIC) in BUILD_SHARED_LIBS mode.
FIXME: It may be PRIVATE since SO knows its dependent libs.
llvm-svn: 202261
2014-02-26 11:58:11 +00:00
NAKAMURA Takumi a39b612918 [CMake] Move LLVMBUILD_LIB_DEPS stuff from add_llvm_library (and LLVm-Config) to llvm_add_library to centralize target_link_libraries.
llvm-svn: 202260
2014-02-26 11:58:01 +00:00
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 d93593fdf1 TableGen.cmake: Functionalize and reformat.
llvm-svn: 201972
2014-02-23 12:54:15 +00:00
NAKAMURA Takumi af2c1130ee Simplify linking to system libraries
The LLVMSupport library implementation consolidates all dependencies on
system libraries.  Move the logic gathering system libraries out of
'cmake/modules/LLVM-Config.cmake' and into 'lib/Support/CMakeLists.txt'.
Use the target_link_libraries() command there to tell CMake about the
link dependencies of the LLVMSupport implementation.  CMake will
automatically propagate this to all targets that link LLVMSupport
directly or indirectly.

We still need to build knowledge of system library dependencies into
'llvm-config'.  Store the list of libraries needed in a property on
LLVMSupport and teach 'tools/llvm-config/CMakeLists.txt' to retrieve it
from there.

Drop all calls to 'link_system_libs' and 'get_system_libs' from our
CMake code.  Replace their implementations with a warning that explains
the calls are no longer necessary.  Also drop from 'LLVMConfig.cmake'
the HAVE_* and related variables that were published there only to allow
'get_system_libs' to run outside our build process.

Contributed by Brad King.

llvm-svn: 201969
2014-02-23 06:27:04 +00:00
NAKAMURA Takumi 2af1a44892 Prune debug message in AddLLVM.cmake.
llvm-svn: 201932
2014-02-22 07:31:10 +00:00
NAKAMURA Takumi 679e772dfe [CMake] llvm_add_library: Add dependencies also to objlibs as workaround of CMake issue 14747.
http://www.cmake.org/Bug/view.php?id=14747

llvm-svn: 201855
2014-02-21 14:17:29 +00:00
NAKAMURA Takumi e3408ab565 [CMake] Introduce "llvm_add_library(SHARED STATIC)" to build both shared lib and static lib simulataneously.
llvm_add_library(foo SHARED STATIC
    DEPENDS <dependent targets...>
    LINK_LIBS <required libraries...>
    )

It generates both foo (foo.so) and foo_static(foo.a) and both of them depend on DEPENDS and LINK_LIBS.
Then, also obj.foo is generated. obj.foo depends on DEPENDS, but doesn't depend on LINK_LIBS.

llvm-svn: 201854
2014-02-21 14:17:17 +00:00
NAKAMURA Takumi 12fedb0efd Teach LLVM-Config to use logical target names (2/2)
The module still needs to collect the list of all available libraries
in order to satisfy the 'all' component.  Provide this in the package
configuration file, 'LLVMConfig.cmake', as a LLVM_AVAILABLE_LIBS
variable.  (A variable is scoped better than a global property.)
Since this won't be set for our own build, fall back to looking up the
LLVM_LIBS property to get the value when it is not set.

Contributed by Brad King.

llvm-svn: 201853
2014-02-21 14:17:07 +00:00
NAKAMURA Takumi 1956c49a95 Teach LLVM-Config to use logical target names (1/2)
LLVM library names are now available as logical CMake targets both
to our own build and to application CMake code.  Replace use of
'list(FIND)' with a simple 'if(TARGET)' to determine whether a
library is available.

Contributed by Brad King.

llvm-svn: 201852
2014-02-21 14:16:52 +00:00
NAKAMURA Takumi 8dd548d236 [CMake] Move intrinsics_gen to lib/Target out of add_public_tablegen_target.
add_public_tablegen_target is used somewhere.

llvm-svn: 201787
2014-02-20 13:42:30 +00:00
Evgeniy Stepanov 6d13b872e1 Unconditionally include msan_interface.h when building with MSan.
Any version of Clang that does not provide this header is way too old to
bootstrap with MSan.

llvm-svn: 201776
2014-02-20 11:37:03 +00:00
Evgeniy Stepanov ec931ecf12 Build PIE binaries when cross-compiling to Android.
This change also removes CMAKE_LINK_FLAGS setting that seems to be ignored by cmake.

llvm-svn: 201654
2014-02-19 09:51:22 +00:00
NAKAMURA Takumi 7a00ff3830 LLVMExports.cmake: Add System libs $(LIBS) to LLVMSupport, corresponding to r201077.
llvm-svn: 201489
2014-02-16 12:14:13 +00:00
NAKAMURA Takumi 7ca96d109f LLVMExports.cmake: Exclude gtest since they are not installed.
FIXME: gtest might be included if external project could refer to the build tree.
llvm-svn: 201488
2014-02-16 12:14:03 +00:00
NAKAMURA Takumi 487f387b19 [CMake] Let llvm_add_library(MODULE) check capability of loadable module.
On unsupported platforms, llvm_add_library(MODULE) doesn't create any targets.
Caller may be responsible to check and add extra target properties.

llvm-svn: 201320
2014-02-13 11:25:17 +00:00
NAKAMURA Takumi e72e2e9088 [CMake] Move the target property PREFIX from add_llvm_loadable_module() to llvm_add_library().
llvm-svn: 201318
2014-02-13 11:19:21 +00:00
NAKAMURA Takumi 58f6e74874 [CMake] llvm_add_library(MODULE) may use CMAKE_MODULE_LINKER_FLAGS instead of target property LINK_FLAGS.
I mis-dropped Darwin's link flags (in clang side) since r201073.

llvm-svn: 201317
2014-02-13 11:19:11 +00:00
NAKAMURA Takumi 92d65802db [CMake] LLVM_PLUGIN_EXT: Use CMAKE_SHARED_LIBRARY_SUFFIX rather than CMAKE_SHARED_MODULE_SUFFIX in llvm tree.
FIXME: llvm/test may be aware of LLVM_PLUGIN_EXT, like as clang/test does.
FIXME: CMAKE_*_SUFFIX may be set in HandleLLVMOptions if those variables could be writable, rather than to set one as target properties.
llvm-svn: 201316
2014-02-13 11:19:00 +00:00
NAKAMURA Takumi dea00df279 [CMake] llvm_add_library: Add handling of the parameter ADDITIONAL_HEADERS to pass through to process_source.
I was insightless then about unknown optional parameters.
(Consider that LINK_LIBS foo bar ADDITIONAL_HEADERS qux quux)

Suggested by Michael Kruse. Thanks!

llvm-svn: 201283
2014-02-13 01:00:52 +00:00
NAKAMURA Takumi 04817e49bc Teach tablegen() macro to check needed variables
This macro depends on several variables to be set in the calling
context.  Check them and report an error if they are not set.
Without this, custom commands may be silently specified that
will fail at build time.

Patch by Brad King.

llvm-svn: 201229
2014-02-12 11:50:11 +00:00
Reid Kleckner 47e84fb675 cmake: Do not export targets when installing toolchain only
Patch by Brad King!

llvm-svn: 201111
2014-02-10 20:44:57 +00:00
NAKAMURA Takumi 2f96171cb0 [CMake] LLVMSupport should be responsible to provide system_libs.
llvm-svn: 201077
2014-02-10 10:52:19 +00:00
NAKAMURA Takumi e7038dfeaa [CMake] Introduce llvm_add_library().
- MODULE;SHARED;STATIC
      STATIC by default w/o BUILD_SHARED_LIBS.
      SHARED by default w/  BUILD_SHARED_LIBS.
  - OUTPUT_NAME name
      Corresponds to OUTPUT_NAME in target properties.
  - DEPENDS targets...
      Same semantics as add_dependencies().
  - LINK_COMPONENTS components...
      Same as the variable LLVM_LINK_COMPONENTS.
  - LINK_LIBS lib_targets...
      Same semantics as target_link_libraries().
  - ADDITIONAL_HEADERS (implemented in LLVMProcessSources)
      May specify header files for IDE generators.

I suggest llvm_add_library() may be used for inter-project add_library stuff
and also suggest add_***_library() may be used project-specific.

Please be patient that llvm_add_library might be ambiguous against add_llvm_library.

llvm-svn: 201072
2014-02-10 09:05:11 +00:00
NAKAMURA Takumi 06e1d81a29 [CMake] LLVMProcessSources.cmake: Prune add_file_dependencies to ${TABLEGEN_OUTPUT}.
I am sure it'd not be required any more.
In trunk, all of tablegen's users depend on ${TABLEGEN_OUTPUT} as not file dependency but inter-target dependency.

llvm-svn: 201063
2014-02-10 03:24:28 +00:00
NAKAMURA Takumi 623055b0ec [CMake] Re-apply r200765, "Get rid of llvm_config() to expand dependencies."
CMake's target_link_libraries() will manage dependencies with Brad's LLVMConfig improvements.

Configuration time may be reduced by a few seconds.

llvm-svn: 201062
2014-02-10 03:24:19 +00:00
Bob Wilson e4b3737bbd Remove shell comment in the middle of a single-line command.
You can't put a comment in the middle of a command like this. This is
invalid shell syntax and breaks the build.

llvm-svn: 201057
2014-02-09 22:36:31 +00:00
NAKAMURA Takumi dba47bfe7b Whitespace.
llvm-svn: 201054
2014-02-09 16:38:31 +00:00
NAKAMURA Takumi 01e3c64f11 Provide CMake package modules in install tree
Teach the Makefile build system to generate and install CMake modules
LLVMConfig.cmake and LLVMConfigVersion.cmake so that applications that
build with CMake can use 'find_package(LLVM)' even when LLVM is not
built with CMake.  These modules tell such applications about available
LLVM libraries and their dependencies.

Run llvm-config to generate the list of libraries and use the results of
llvm-build to generate the library dependencies.  Use sed to perform
substitutions in the LLVMConfig.cmake.in and LLVMConfigVersion.cmake.in
sources that our CMake build system uses.

Teach the Makefile build system to generate the LLVMExports.cmake file
with content similar to that produced by the CMake install(EXPORT)
command.  Extend llvm-build with an option to generate the library
dependencies fragment for this file.

Contributed by Brad King.

llvm-svn: 201053
2014-02-09 16:37:02 +00:00
NAKAMURA Takumi 363e85a143 Load exported lib and exe targets from LLVMConfig
Teach each package configuration file to load the LLVMExports file for
its corresponding tree.  This will allow application CMake code to use
logical library and executable target names from LLVM as if they were in
our own build process (e.g. LLVMSupport).  CMake will have enough
information to propagate LLVM library link dependencies automatically
while configuring applications.

Contributed by Brad King.

llvm-svn: 201051
2014-02-09 16:36:28 +00:00
NAKAMURA Takumi 8faf6609c2 Export lib and exe build target names from build tree
Record every logical target that we install with install(TARGETS) in a
global LLVM_EXPORTS property.  Then use the export(TARGETS) command to
provide a "LLVMExports.cmake" file that exports logical targets for
import into applications directly from our build tree.

The "LLVMExports.cmake" file is not meant for direct inclusion by
application code but should be included by "LLVMConfig.cmake" in a
future change.

Contributed by Brad King.

llvm-svn: 201050
2014-02-09 16:36:16 +00:00
NAKAMURA Takumi ef97607126 Export lib and exe build target names from install tree
Use the install(TARGETS) command EXPORT option for every library and
executable that we install with LLVM.  Then use the install(EXPORT)
command to provide a "LLVMExports.cmake" file that exports logical
targets for import into applications from our install tree.

The "LLVMExports.cmake" file is not meant for direct inclusion by
application code but should be included by "LLVMConfig.cmake" in a
future change.

Contributed by Brad King.

llvm-svn: 201049
2014-02-09 16:36:03 +00:00
NAKAMURA Takumi 43d6384c38 Provide LLVMConfig in both build and install tree
Create separate package configuration files "LLVMConfig.cmake" for the
LLVM build and install trees so that each can have information specific
to its tree.  Configure each with the corresponding include, lib, and
cmake directories.  Include the "LLVM-Config" API modules directly from
the configured cmake modules directory.

In the install tree, compute the installation prefix relative to the
file location.  In the build tree, provide information specific to the
build tree for use by tools like Clang that can build externally against
the LLVM build tree.  Prefix such values in "LLVM_BUILD_" and comment
them as such.

Contributed by Brad King.

llvm-svn: 201048
2014-02-09 16:35:51 +00:00