1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
Commit Graph

587 Commits

Author SHA1 Message Date
NAKAMURA Takumi
60bccb6382 [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
7442e7c058 [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
053e0ba6a2 TableGen.cmake: Functionalize and reformat.
llvm-svn: 201972
2014-02-23 12:54:15 +00:00
NAKAMURA Takumi
ac921a3563 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
51968a2f24 Prune debug message in AddLLVM.cmake.
llvm-svn: 201932
2014-02-22 07:31:10 +00:00
NAKAMURA Takumi
6a54b7cd10 [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
9290e6a3f3 [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
6b79ec0d99 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
d59cef28cd 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
122c55ae1d [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
3dbe688704 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
aa102ff6b9 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
d860d1bec5 LLVMExports.cmake: Add System libs $(LIBS) to LLVMSupport, corresponding to r201077.
llvm-svn: 201489
2014-02-16 12:14:13 +00:00
NAKAMURA Takumi
2c11ee6a45 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
bec7f62e98 [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
f29c091bdb [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
0586905e99 [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
812321a90a [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
1cff87e287 [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
90092f6522 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
f13bbe792f 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
ad172d26af [CMake] LLVMSupport should be responsible to provide system_libs.
llvm-svn: 201077
2014-02-10 10:52:19 +00:00
NAKAMURA Takumi
f83fca5f7a [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
5c9eb49c11 [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
7345270868 [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
d7d93a1068 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
72e48a472b Whitespace.
llvm-svn: 201054
2014-02-09 16:38:31 +00:00
NAKAMURA Takumi
1aa7442231 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
e9cd033887 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
0cff33c584 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
4994e358f4 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
fb1a5cc259 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
NAKAMURA Takumi
222fa8edb4 Teach LLVMConfig to avoid modifying CMAKE_MODULE_PATH
Do not modify this value on the application's behalf and just ensure API
modules are always available next to the LLVMConfig module.  This is
already the case in the install tree so use file(COPY) to make it so in
the build tree.  Include the LLVM-Config API module from next to the
LLVMConfig location.

Contributed by Brad King.

llvm-svn: 201047
2014-02-09 16:35:40 +00:00
NAKAMURA Takumi
239899d5e0 De-duplicate references to share/llvm/cmake path
Use a LLVM_INSTALL_PACKAGE_DIR variable to hold the path and reference
it where necessary.

Contributed by Brad King.

llvm-svn: 201046
2014-02-09 16:35:29 +00:00
Todd Fiala
f2dea859ee Fix configure to find arc4random via header files.
ISSUE:

On Ubuntu 12.04 LTS, arc4random is provided by libbsd.so, which is a
transitive dependency of libedit. If a system had libedit on it that
was implemented in terms of libbsd.so, then the arc4random test,
previously implemented as a linker test, would succeed with -ledit.
However, on Ubuntu this would also require a #include <bsd/stdlib.h>.
This caused a build breakage on configure-based Ubuntu 12.04 with
libedit installed.

FIX:

This fix changes configure to test for arc4random by searching for it
in the standard header files. On Ubuntu 12.04, this test now properly
fails to find arc4random as it is not defined in the default header
locations. It also tweaks the #define names to match the output of the
header check command, which is slightly different than the linker
function check #defines.

I tested the following scenarios:

(1) Ubuntu 12.04 without the libedit package [did not find arc4random,
as expected]

(2) Ubuntu 12.04 with libedit package [properly did not find
arc4random, as expected]

(3) Ubuntu 12.04 with most recent libedit, custom built, and not
dependent on libbsd.so [properly did not find arc4random, as
expected].

(4) FreeBSD 10.0B1 [properly found arc4random, as expected]

llvm-svn: 200819
2014-02-05 05:04:36 +00:00
Jordan Rose
91d76aa13a [CMake] Deliberately get all LLVM library dependencies for standalone builds.
CMake won't expand the dependency graph for us if the dependencies are in
another project, which leads to link errors in the standalone build.
This is a refinement of r200765.

llvm-svn: 200812
2014-02-05 00:02:42 +00:00
Jordan Rose
80d188147b [CMake] Move -stdlib=libc++ handling into its own file.
r200744 moved this into cmake/config-ix.cmake, so that it would happen very
early in the build process. However, standalone builds of Clang and other
external projects never include this file (which is correct).

Now, -stdlib=libc++ and the LLVM_COMPILER_IS_GCC_COMPATIBLE option are
both set in a new include file, HandleLLVMStdlib, which is included by
both config-ix.cmake and HandleLLVMOptions.cmake. This preserves existing
behavior for projects relying on HandleLLVMOptions and still does the
right thing for builds of LLVM itself.

llvm-svn: 200811
2014-02-05 00:02:37 +00:00
NAKAMURA Takumi
b50ae4b3d0 [CMake] Get rid of llvm_config() to expand dependencies.
CMake's target_link_libraries() will manage dependencies.

Configuration time may be reduced by a few seconds.

llvm-svn: 200765
2014-02-04 14:42:14 +00:00
NAKAMURA Takumi
a08db5a5e8 [CMake] LLVM-Config.cmake: Split explicit_map_components_to_libraries and introduce llvm_map_components_to_libnames and llvm_expand_dependencies.
llvm-svn: 200764
2014-02-04 14:42:04 +00:00
NAKAMURA Takumi
13fe883ef7 [CMake] add_llvm_loadable_module: Fixup r200762, I mis-eliminated wrong line. :(
llvm-svn: 200763
2014-02-04 13:40:31 +00:00
NAKAMURA Takumi
6c5c626389 Revert r122395, "Fixes file extension for loadable modules on OS X."
In trunk, every users assume add_llvm_loadable_module as "loadable module" and no one sets neither SHARED, ... nor also MODULE!
Unfortunately, all loadable modules were linked as not "MODULE" but "SHARED".

If this change caused any regressions, I wish guys to fix it properly. ;)

llvm-svn: 200762
2014-02-04 13:33:13 +00:00
Alexey Samsonov
4e6be36bfe [CMake] Revert r200695 and fix the problem with missing -fno-function-sections in a different way.
llvm-svn: 200745
2014-02-04 08:15:46 +00:00
Alexey Samsonov
d827bdcf86 [CMake] Add -stdlib=libc++ to host Clang build flags before performing any header search
If LLVM_ENABLE_LIBCXX is specified, we should append -stdlib=libc++ to build
flags as early as possible, in particular, before we check for header presence
(as -stdlib=libc++ modifies header lookup rules). Otherwise we can find a header
at configure time (w/o -stdlib=libc++) but fail to find it at build time
(with -stdlib=libc++). See PR18569 for more details.

llvm-svn: 200744
2014-02-04 07:55:18 +00:00
NAKAMURA Takumi
175b34111a Revert r200150, "[CMake] tablegen(): Use -I <dir> according to the list by include_directories()."
It missed include/llvm/Target. Could I avoid GLOB_RECURSE anyways? :(
FYI, I intended to prune ${LLVM_MAIN_INCLUDE_DIR} in TableGen.cmake in r200150.

llvm-svn: 200730
2014-02-04 01:17:12 +00:00
Evgeniy Stepanov
168096d3f9 Don't use -ffunction-sections if -fno-function-sections is not supported in the compiler.
This will disable -ffunction-sections in older versions of Clang where it
breaks build of sanitizer runtime library.

llvm-svn: 200695
2014-02-03 13:57:09 +00:00
NAKAMURA Takumi
040a600f83 [CMake] Untabify.
llvm-svn: 200644
2014-02-02 16:46:35 +00:00
Peter Collingbourne
80068b8c2c Introduce line editor library.
This library will be used by clang-query. I can imagine LLDB becoming another
client of this library, so I think LLVM is a sensible place for it to live.
It wraps libedit, and adds tab completion support.

The code is loosely based on the line editor bits in LLDB, with a few
improvements:

 - Polymorphism for retrieving the list of tab completions, based on
   the concept pattern from the new pass manager.

 - Tab completion doesn't corrupt terminal output if the input covers
   multiple lines. Unfortunately this can only be done in a truly horrible
   way, as far as I can tell. But since the alternative is to implement our
   own line editor (which I don't think LLVM should be in the business of
   doing, at least for now) I think it may be acceptable.

 - Includes a fallback for the case where the user doesn't have libedit
   installed.

Note that this uses C stdio, mainly because libedit also uses C stdio.

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

llvm-svn: 200595
2014-01-31 23:46:14 +00:00
NAKAMURA Takumi
0758e83e9b AddLLVM.cmake: Untabify.
llvm-svn: 200557
2014-01-31 17:32:42 +00:00
NAKAMURA Takumi
05d4a30664 HandleLLVMOptions.cmake: Typo, s/proerty/property/
llvm-svn: 200556
2014-01-31 17:32:36 +00:00
NAKAMURA Takumi
17cbd6841a [CMake] llvm_update_compile_flags: Honor LLVM_COMPILE_FLAGS.
I accidentally mis-dropped LLVM_COMPILE_FLAGS in r200301. Sorry for that.

llvm-svn: 200499
2014-01-30 22:55:25 +00:00