Commit Graph

56 Commits

Author SHA1 Message Date
Chris Bieneman 5007741d68 Enabling LLVM & Clang to be cross-compiled using CMake from a single configuration command line
The basic idea is similar to the existing cross compilation support. A directory must be configured to build host versions of tablegen tools and llvm-config. This directory can be user provided (and configured), or it can be created during the build. During a build the native build directory will be configured and built to supply the tablegen tools used during the build. A user could also explicitly provide the tablegen executables to run on the CMake command line.

llvm-svn: 217105
2014-09-03 23:21:18 +00:00
Reid Kleckner 65fc0e2c00 Change llvm-config --ldflags to report ${CMAKE_CXX_LINK_FLAGS}
Should fix PR19526.

When Oscar added this code in the intial CMake build system port, he had
a TODO saying that ${CMAKE_SHARED_LINKER_FLAGS} was probably wrong.  I
agree.  I'm using ${CMAKE_CXX_LINK_FLAGS} to point LLVM at my custom
installation of gcc 4.recent, so that seems more correct.  With this
change, I can build creduce against an installed clang, and it picks up
the write flags from --ldflags.

llvm-svn: 207171
2014-04-25 01:44:20 +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 1b16e277dc llvm-config: With --build-mode, show ${CMAKE_CFG_INTDIR} on multiconfig builder.
llvm-svn: 196283
2013-12-03 14:35:17 +00:00
Hans Wennborg 5c6235968f cmake: Prevent semicolon separated lists in llvm-config (PR17020)
llvm-svn: 189491
2013-08-28 17:04:06 +00:00
Hans Wennborg fe06e811a3 CMake: build llvm-config on Windows.
It was previously not being built on Windows because the cmake file relied
on a sed script to generate a .in file that llvm-config needs.

By using cmake's configure_file function, we can get rid off the sed hack,
and also have this work on Windows.

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

llvm-svn: 189125
2013-08-23 17:59:13 +00:00
Daniel Dunbar 30a8976127 llvm-config: Fix --targets-built, I changed this to use the registry but wasn't
properly initializing the target infos. I decided it wasn't worth linking them
in for this, so just switched back to using the Makefile variable for now. We
can reconsider later if we ever get pluggable targets.

llvm-svn: 146711
2011-12-16 00:04:43 +00:00
Daniel Dunbar ab0ad4ed1e llvm-config: Replace with C++ version (was llvm-config-2).
- Another reapply of r144300, with hopefully one last fix.

llvm-svn: 145623
2011-12-01 20:18:09 +00:00
Duncan Sands b8e6cee9ca Revert commit 145449 (ddunbar) since it is breaking the dragonegg buildbots.
Original commit message:
llvm-config: Replace with C++ version (was llvm-config-2).
 - Reapply of r144300, with lots of fixes/migration easement in between.

llvm-svn: 145582
2011-12-01 10:50:19 +00:00
Daniel Dunbar 8d5cc33ad8 llvm-config: Replace with C++ version (was llvm-config-2).
- Reapply of r144300, with lots of fixes/migration easement in between.

llvm-svn: 145449
2011-11-29 22:56:31 +00:00
Daniel Dunbar 933b43f188 Revert r144300 "llvm-config: Replace with C++ version (was llvm-config-2).",
which didn't appear ready for prime time.

llvm-svn: 144309
2011-11-10 19:59:35 +00:00
Daniel Dunbar 166c804893 llvm-config: Replace with C++ version (was llvm-config-2).
llvm-svn: 144300
2011-11-10 18:49:59 +00:00
Chandler Carruth 76f9e57145 Add back the top-level target for 'llvm-config' and the dependency edge
to force it to build after all library targets so it has complete
dependency information. This should fix broken 'make install' with
CMake.

This is a partial revert of r143540, but it doesn't revert the most
important part of that change: removing the dependency edge from LLVM
tools to the llvm-config script.

llvm-svn: 143548
2011-11-02 17:22:57 +00:00
Daniel Dunbar ab527acc09 build/CMake: Remove llvm-config.target used to serialize tool builds on
llvm-config build, there is no longer a point to this after Chandler's work.

llvm-svn: 143540
2011-11-02 15:56:38 +00:00
Peter Collingbourne 16dab1bada Have llvm-config --cppflags print correct flags when in CMake build directory
Previously, if invoked from a CMake build directory, 'llvm-config
--cppflags' and friends would only print a -I flag for the build
directory's header search path, because it would assume that it was
already installed, not recognising its parent directory as being the
build directory.  Teach llvm-config about CMake build directories
so that it prints a -I for both the source and build directory's
search paths.

llvm-svn: 143171
2011-10-28 01:02:16 +00:00
Chandler Carruth 9d7feab3e0 Rewrite the CMake build to use explicit dependencies between libraries,
specified in the same file that the library itself is created. This is
more idiomatic for CMake builds, and also allows us to correctly specify
dependencies that are missed due to bugs in the GenLibDeps perl script,
or change from compiler to compiler. On Linux, this returns CMake to
a place where it can relably rebuild several targets of LLVM.

I have tried not to change the dependencies from the ones in the current
auto-generated file. The only places I've really diverged are in places
where I was seeing link failures, and added a dependency. The goal of
this patch is not to start changing the dependencies, merely to move
them into the correct location, and an explicit form that we can control
and change when necessary.

This also removes a serialization point in the build because we don't
have to scan all the libraries before we begin building various tools.
We no longer have a step of the build that regenerates a file inside the
source tree. A few other associated cleanups fall out of this.

This isn't really finished yet though. After talking to dgregor he urged
switching to a single CMake macro to construct libraries with both
sources and dependencies in the arguments. Migrating from the two macros
to that style will be a follow-up patch.

Also, llvm-config is still generated with GenLibDeps.pl, which means it
still has slightly buggy dependencies. The internal CMake
'llvm-config-like' macro uses the correct explicitly specified
dependencies however. A future patch will switch llvm-config generation
(when using CMake) to be based on these deps as well.

This may well break Windows. I'm getting a machine set up now to dig
into any failures there. If anyone can chime in with problems they see
or ideas of how to solve them for Windows, much appreciated.

llvm-svn: 136433
2011-07-29 00:14:25 +00:00
Oscar Fuentes d8a6dd6c99 Rename LLVMConfig.cmake to LLVM-Config.cmake. The *Config.cmake naming
scheme is used by the functionality related to find_package.

llvm-svn: 128889
2011-04-05 17:02:48 +00:00
Oscar Fuentes 25ec0d38e1 CMake: remove debug code from previous commit.
llvm-svn: 128740
2011-04-01 21:39:38 +00:00
Oscar Fuentes cde00a55c8 Fix assignment of -fPIC to CMAKE_C_FLAGS. Configure llvm-config.in.in
with the contents of CMAKE_C(XX)_FLAGS too, else `llvm-config
--c(xx)flags' doesn't tell the absolute truth.

This comes from PR9603 and is based on a patch by Ryuta Suzuki!

llvm-svn: 128727
2011-04-01 19:36:06 +00:00
Oscar Fuentes cae1b90915 Make llvm-config.in configuration more MSYS-friendly.
Some of those POSIX <-> Windows command line conversions ended on
failure.

llvm-svn: 127958
2011-03-19 22:52:33 +00:00
Oscar Fuentes 916fb1a62b CMake: store TARGET_TRIPLE on llvm-config.in.
llvm-svn: 127957
2011-03-19 22:52:25 +00:00
Oscar Fuentes ab0465020b CMake: remove unnecessary variable.
llvm-svn: 126224
2011-02-22 15:40:20 +00:00
Oscar Fuentes 5ed962656c Move library stuff out of the toplevel CMakeLists.txt file.
llvm-svn: 125968
2011-02-18 22:06:14 +00:00
Oscar Fuentes 632ad9bfe6 Don't show -pedantic, -W and -Wall on the output of
llvm-config --cflags --cxxflags --cppflags

We shouldn't impose those flags on people who use llvm-config for
building their own projects.

llvm-svn: 124399
2011-01-27 19:29:48 +00:00
Oscar Fuentes 6e0637994a Stop the build if cyclic library dependecies found.
llvm-svn: 115405
2010-10-02 03:04:49 +00:00
Michael J. Spencer 93c9b2ea93 Revert "CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally."
This reverts commit r113632

Conflicts:

	cmake/modules/AddLLVM.cmake

llvm-svn: 113819
2010-09-13 23:59:48 +00:00
Michael J. Spencer dc38d36ccb CMake: Get rid of LLVMLibDeps.cmake and export the libraries normally.
llvm-svn: 113632
2010-09-10 21:14:25 +00:00
Oscar Fuentes 5b823e0821 CMake: Improved COMMENT on a custom command
llvm-svn: 111111
2010-08-15 22:14:36 +00:00
Daniel Dunbar e67ebdc60a Kill off LLVMGCCARCH and LLVMGCC_VERSION make variables.
llvm-svn: 96909
2010-02-23 07:56:31 +00:00
Daniel Dunbar e7d4f92cfa Kill off LLVMGCC_MAJVERS make variable.
llvm-svn: 96907
2010-02-23 07:56:22 +00:00
Daniel Dunbar c0fd8a4360 Stop running get_target_triple more than we need to.
llvm-svn: 86418
2009-11-07 23:52:20 +00:00
Oscar Fuentes cfd4ec0226 CMake: remove .so file extension from library names when building
dependency info.

Patch by Peter Collingbourne!

llvm-svn: 83275
2009-10-04 06:24:57 +00:00
Daniel Dunbar a249c42e8c Fix llvm-config --src-root and --obj-root for CMake builds.
llvm-svn: 82529
2009-09-22 06:09:31 +00:00
Xerxes Ranby a0f1088134 Make cmake generated llvm-config output correct JIT backend for non X86 targets.
llvm-svn: 82049
2009-09-16 14:36:35 +00:00
Oscar Fuentes 1ea4b3a4b5 CMake: Automatic regeneration of the library dependencies file.
It doesn't stop or reconfigure the build, though, so the user will see
a broken build that magically succeeds at the next attempt. It is
technically possible to halt the build with a helpful message, and
even to automatically restart the build using the new dependencies as
it we did when llvm-config was used by cmake for learning
dependencies. This is left on the TODO list.

llvm-svn: 79004
2009-08-14 16:59:41 +00:00
Oscar Fuentes 5444cb13ab CMake: propagate to the parent scope LLVM_COMMON_DEPENDS. This is
necessary for the changes being effective on the successive targets

llvm-svn: 78989
2009-08-14 04:29:33 +00:00
Oscar Fuentes 9082c71057 CMake: build llvm-config before the other tools.
llvm-svn: 78975
2009-08-14 01:55:05 +00:00
Oscar Fuentes 06eef1c2fe CMake: Localized dependency on Perl.
llvm-svn: 78788
2009-08-12 04:16:19 +00:00
Oscar Fuentes c1341ea9de CMake: Re-enabled build of llvm-config. Removed recursive invocation
of cmake.

llvm-svn: 78768
2009-08-12 01:36:27 +00:00
Oscar Fuentes 6133813eb4 CMake: Implements and documents option LLVM_ENABLE_ASSERTS.
llvm-svn: 72774
2009-06-03 15:11:25 +00:00
Oscar Fuentes 10a71da05a CMake: Set LIBS on llvm-config so we can query the system libraries
used by CMake with --ldflags.

llvm-svn: 72470
2009-05-27 15:49:33 +00:00
Ted Kremenek b58a9058a2 Accommodate empty string for build type. This was previously causing an error
when generating an Xcode project using the CMake files (thanks to Doug Gregor
for identifying the issue).

llvm-svn: 68618
2009-04-08 17:28:16 +00:00
Oscar Fuentes bda403b4c8 CMake: defines and uses macro add_llvm_definitions for keeping track
of compiler parameters explicitly added by the build
specification. This macro replaces the cmake built-in
`add_definitions'.

Detects glibc and defines _GNU_SOURCE accordingly.

Resolves bug 3882.

llvm-svn: 68428
2009-04-04 22:41:07 +00:00
Oscar Fuentes cf03f4b041 CMake: tools/llvm-config/CMakeLists.txt: Use ! instead of comma as
separator in sed scripts. Resolves Bug 3881.

llvm-svn: 68385
2009-04-03 12:16:32 +00:00
Douglas Gregor 6d1ec14f0f CMake: Build system fixes for XCode. llvm-config still causes us some serious trouble, but it's less serious than it used to be
llvm-svn: 67056
2009-03-16 22:53:26 +00:00
Oscar Fuentes b97e96350f CMake: replace `rm' with portable invocations of cmake.
Based on a bug report by Yonggang Luo.

llvm-svn: 61875
2009-01-07 19:24:44 +00:00
Oscar Fuentes 7e17369255 CMake: Removed some cruft.
llvm-svn: 59376
2008-11-15 20:51:18 +00:00
Oscar Fuentes 757a012bf1 CMake: Recursively invokes cmake using the right directories.
LLVM_MAIN_SRC_DIR and LLVM_BINARY_DIR are not the cmake top level
directories when LLVM is embedded on the build of other project.

Fixes PR #3072.

llvm-svn: 59374
2008-11-15 20:35:25 +00:00
Oscar Fuentes 93bf988701 CMake: forces rebuild of llvm-config's library dependency info when a
library is added or changed.

llvm-svn: 59051
2008-11-11 17:10:58 +00:00
Oscar Fuentes a6da027c18 CMake: Corrected detection of `nm'.
llvm-svn: 58941
2008-11-09 20:26:31 +00:00