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

568 Commits

Author SHA1 Message Date
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
NAKAMURA Takumi
10805da43c HandleLLVMOptions.cmake: Typo in comment.
llvm-svn: 200498
2014-01-30 22:55:20 +00:00
Evgeniy Stepanov
7f5888aaec Remove -arm-enable-ehabi from Android build rules. It's enabled by default.
llvm-svn: 200391
2014-01-29 12:36:18 +00:00
NAKAMURA Takumi
d6ac1d50c8 [CMake] llvm_update_compile_flags(name) doesn't require source files. TARGET PROPERTY SOURCES has them.
llvm-svn: 200311
2014-01-28 11:40:04 +00:00
NAKAMURA Takumi
9c5396cb3d [CMake] Prune CMAKE_CXX_FLAGS stuff in llvm_process_sources.
It is the final step to deprecate contextual CMAKE_CXX_FLAGS.

llvm-svn: 200303
2014-01-28 09:48:19 +00:00
NAKAMURA Takumi
806bce066e [CMake] Enhance llvm_update_compile_flags(name sources) to handle LLVM_REQUIRES_EH and LLVM_REQUIRES_RTTI.
LLVM_REQUIRES_EH implies LLVM_REQUIRES_RTTI. It is as same behavior as Makefile.rule's.
llvm/examples/ExceptionDemo is affected. (It was built with -fno-rtti.)

For MSVC, Remove flags like "/EHsc /GR" in HandleLLVMOptions, or CL.EXE complains with flags like "/GR /GR-".

llvm_update_compile_flags() updates source file property if the target contains *.c.
COMPILE_FLAGS in target properties affects both C++ and C!

LLVM_NO_RTTI is deprecated. It was introduced by me and was my mistake.

llvm-svn: 200301
2014-01-28 09:44:06 +00:00
NAKAMURA Takumi
73fb9bab5e [CMake] Apply -ffunction-data-sectinos not only to CMAKE_CXX_FLAGS, but also to CMAKE_C_FLAGS.
llvm-svn: 200300
2014-01-28 09:44:00 +00:00
NAKAMURA Takumi
96ebbdc8e5 [CMake] Move -ffunction-data-sections stuff to HandleLLVMOptions.
With this tweaks, also unittests are compiled with -ffunction-sections.

It's hard to control contextual CMAKE_CXX_FLAGS. We should get rid of twiddling it as possible.

llvm-svn: 200299
2014-01-28 09:43:55 +00:00
NAKAMURA Takumi
6e967d4af7 [CMake] Let llvm_process_sources check not only *.cpp but also *.c.
llvm-svn: 200298
2014-01-28 09:43:49 +00:00
NAKAMURA Takumi
b340d5771b [CMake] Put *_exports into "Misc" folder.
llvm-svn: 200228
2014-01-27 17:39:38 +00:00
NAKAMURA Takumi
e6d62c55d1 [CMake] tablegen(): Use -I <dir> according to the list by include_directories().
For now, local_tds and global_tds are integrated to dependent_tds.

llvm-svn: 200150
2014-01-26 12:41:38 +00:00
NAKAMURA Takumi
3d3cc2031e [CMake] Functionalize tblgen().
llvm-svn: 200149
2014-01-26 12:41:33 +00:00
NAKAMURA Takumi
937fce3653 [CMake] configure_lit_site_cfg: ${SHLIBDIR} should point the build tree.
llvm-svn: 200134
2014-01-26 06:18:56 +00:00
Chandler Carruth
bd14eff029 Don't clobber CMAKE_REQUIRED_FLAGS, it ends up being used in
C compilations as well and these flags don't make any sense there.

llvm-svn: 199756
2014-01-21 18:09:19 +00:00
Amara Emerson
f0783bc47e Fix VS2012 ID/version check.
llvm-svn: 199753
2014-01-21 16:41:07 +00:00
Evgeniy Stepanov
549c543d8e Fix libstdc++4.7 test on Android.
llvm-svn: 199714
2014-01-21 09:00:30 +00:00
NAKAMURA Takumi
606154f6fb [CMake] LLVMProcessSources.cmake: Add include(CMakeParseArguments).
I didn't realize that cmake_parse_arguments() would require explicit inclusion.

llvm-svn: 199674
2014-01-20 17:05:49 +00:00
NAKAMURA Takumi
04cae90676 [CMake] llvm_process_sources: Introduce a parameter, ADDITIONAL_HEADERS.
ADDITIONAL_HEADERS is intended to add header files for IDEs as hint.

For example:
  add_llvm_library(LLVMSupport
    Host.cpp
    ADDITIONAL_HEADERS
      Unix/Host.inc
      Windows/Host.inc
    )

llvm-svn: 199639
2014-01-20 10:20:23 +00:00
NAKAMURA Takumi
9bbe4b2609 [CMake] Introduce new scheme of LLVM_TOOLS_BINARY_DIR and LLVM_LIBRARY_DIR
In LLVM build tree, they points corresponding INTDIR.

  In Clang standalone tree, they points external dir (llvm-config's --bindir and --libdir).

llvm-svn: 199595
2014-01-19 12:52:10 +00:00
NAKAMURA Takumi
45c99b48b7 [CMake] Prune deprecate usage of CMAKE_RUNTIME_OUTPUT_DIRECTORY.
llvm-svn: 199592
2014-01-19 12:47:18 +00:00