Commit Graph

39 Commits

Author SHA1 Message Date
Eric Fiselier
85df7a8775 Add CMake option LIBCXX_CONFIGURE_IDE to allow for other IDE's.
CLion needs similar configuration changes as MSVC_IDE and XCODE.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@255851 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16 23:41:05 +00:00
Chris Bieneman
a846b11cd8 [CMake] If you're not installing the libcxx library, exclude it from the "all" target so it doesn't get built when you run "ninja install"
This is just a build dependency optimization. Running check-libcxx will still build libcxx and function as expected, it just removes libcxx from the all build and install targets.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@254628 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 18:52:54 +00:00
Eric Fiselier
e6d05b65b2 Use proper output directory when naminging the libc++ output
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@251100 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-23 07:04:24 +00:00
Eric Fiselier
601d2c1165 Dont required CMake 3 to install a linker script
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@251065 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 21:24:01 +00:00
Eric Fiselier
1d3716a633 Re-enable linker scripts after fixing bad CMake
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@250472 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-15 23:04:54 +00:00
Eric Fiselier
a317a1b7cf Use correct CMake variable for the libname
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@250329 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 21:20:28 +00:00
Eric Fiselier
8cbf020fdc [libcxx] Make it drastically simpler to link libc++.
Summary:
Currently on most platforms you have to manually link the c++ abi library used with libc++ whenever you use libc++. So your typical libc++ command like invocation might look like:

```
clang++ -stdlib=libc++ foo.cpp -lc++abi
```

Having to manually link `libc++abi.so` makes it harder for libc++ to be used generically. This patch fixes that by generating a linker script for `libc++.so` that correctly links the ABI library. On linux the linker script for libc++abi would look like:

```
# libc++.so
INPUT(libc++.so.1 -lc++abi)
```

With the linker script you can now use libc++ using only `-stdlib=libc++`. This is the technique that is used on FreeBSD in ordered to link cxxrt and I think it's the best approach to make our users lives simpler.

The CMake option used to enable this is `LIBCXX_ENABLE_ABI_LINKER_SCRIPT`. In future I would like to enable this by default on all platforms except for Darwin.

Reviewers: mclow.lists, danalbert, rsmith, jroelofs, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D12508

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@250319 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-14 19:54:03 +00:00
Evgeniy Stepanov
4f01aa8fb8 ABI versioning macros for libc++.
C++ macros and CMake options that specify the default ABI version of
the library, and can be overridden to pick up new ABI-changing
features.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@250254 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 23:48:28 +00:00
Eric Fiselier
25daee702e [libcxx] Reexport std::bad_array_length symbols from libc++abi on OS X.
Summary:
On OS X libc++ needs to reexport libc++abi's symbols in order for them to be provided. We explicitly list the symbols to reexport it libcxx/lib/libc++abi2.exp. This patch adds the symbols required by std::bad_array_length which have been missing for some time.

However there is a problem. std::bad_array_length was add to libc++abi in September of 2013 by commit r190479, about a year after everything else. Therefore I think older OS X version  have libc++abi versions without std::bad_array_length. On those systems
libc++ won't build with this change because we will try and export undefined symbols.

The workaround I would write to support older systems depends on the amount of people who would need it.   If only a small number of developers are affected it might be sufficient to provide a CMake switch like `LIBCPP_LIBCPPABI_HAS_BAD_ARRAY_LENGTH` which is
ON by default and can be disabled by those who need it. Otherwise I think we should try to automatically detect if the symbols are present in `/usr/lib/libc++abi.dylib` and configure accordingly. I would prefer the first solution because writing CMake sucks.




Reviewers: mclow.lists, aprantl

Subscribers: aprantl, cfe-commits

Differential Revision: http://reviews.llvm.org/D13445

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249339 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 19:28:48 +00:00
Eric Fiselier
961269db1b [libcxx] Remove installation rules on Darwin when it would overwrite the system installation.
Summary:
On Mac OS X overwriting `/usr/lib/libc++.dylib` can cause your computer to fail to boot. This patch tries to make it harder to do that accidentally. 

If `CMAKE_SYSTEM_NAME` is `Darwin` and `CMAKE_INSTALL_PREFIX` is `/usr` don't generate installation rules unless the user explicitly provides `LIBCXX_OVERRIDE_DARWIN_INSTALL=ON`. Note that `CMAKE_INSTALL_PREFIX` is always absolute so we don't need to worry about things like `/usr/../usr`.

Reviewers: mclow.lists, beanz, jroelofs

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D12209

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246070 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-26 20:18:21 +00:00
Eric Fiselier
de56f74611 [libcxx] Add "install-libcxx" target.
Summary: Currently you can't install libc++ from within the LLVM tree without installing all of LLVM. This patch adds an install rule for libc++.

Reviewers: mclow.lists, danalbert, jroelofs, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D11697

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245470 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-19 17:41:53 +00:00
Eric Fiselier
eb6e2eac6c Reapply working parts of CMake cleanup.
This patch adds the working parts of r243503. The difference with this patch
is that it doesn't include the HandleLLVMOptions.cmake file.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243698 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-30 22:30:34 +00:00
Eric Fiselier
5514d36c43 Revert recent CMake changes again due to failing compiler-rt builds
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243593 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 23:46:55 +00:00
Eric Fiselier
d74dee9255 Recommit r243503 "[libcxx] Cleanup CMake configuration and integrate with LLVM"
This change was reverted in r243550 because it broke clang-format builds
(see PR24306).

This patch recommits a fixed version of the original.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243574 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 21:07:28 +00:00
Hans Wennborg
aa9b5e37f7 Revert r243503 "[libcxx] Cleanup CMake configuration and integrate with LLVM"
This caused clang-format to stop linking on Mac; see PR24306.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243550 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 18:32:21 +00:00
Eric Fiselier
91eeba8d26 [libcxx] Cleanup CMake configuration and integrate with LLVM
Summary:
This patch contains the following changes:

1. Require that libc++ can find a LLVM source directory. This is done the same way as `libc++abi` currently does.
2. Cleanup ugly configuration code in CMakeLists.txt by using `add_flags`, `add_flags_if`, and `add_flags_if_supported` macros.

The goals for this patch are:

1. Help libc++ be more consistent with how LLVM handles CMake options (see PR23670 PR23671).
2. Make it easier to use sanitizers using the `LLVM_USE_SANITIZER` option.
3. Make libc++'s CMakeLists.txt file easier to understand and change.
4. Move towards allowing libc++ to create Sphinx documentation (see http://efcs.ca/libcxx-docs). 
5. Move towards allowing  libc++ to use other LLVM utilities such as `not` and `FileCheck`.

  

Reviewers: mclow.lists, jroelofs, danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D11308

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243503 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-29 00:03:51 +00:00
Eric Fiselier
938c96ef53 [libcxx] Add support for sanitizers on OS X.
Summary: This patch adds special configuration logic to find the compiler_rt libraries required by sanitizers on OS X. The supported sanitizers are Address and Undefined.

Reviewers: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D11381

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@242858 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-22 00:33:36 +00:00
Eric Fiselier
bf9653d85f [libcxx] Add code coverage configuration to CMake and LIT.
Summary:
This patch adds configuration to CMake and LIT for running the libc++ test-suite to generate code coverage.

To use code coverage use following instructions.

* Find the clang resource dir using `$CXX -print-search-dirs`. Let <library-dir> be the first library search directory.
* `cmake <regular-options> -DLIBCXX_GENERATE_COVERAGE=ON -DLIBCXX_COVERAGE_LIBRARY=<library-dir>/lib/<platform>/libclang_rt.profile.a <source>`
* `make cxx`
* `make check-libcxx`
* `make generate-libcxx-coverage`


The reason I want this patch upstreamed is so I can setup a bot that generates code coverage and posts in online for every revision. 



Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: danalbert

Differential Revision: http://reviews.llvm.org/D8716

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233669 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-31 04:15:45 +00:00
Eric Fiselier
4f274d0633 Only enable special apple link flags for libc++abi (or none)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@233368 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-27 09:00:45 +00:00
Eric Fiselier
c0b166e944 [libcxx] Add support for linking libc++ against a static ABI library.
Summary:
This patch add the CMake option `LIBCXX_ENABLE_STATIC_ABI_LIBRARY` which, when enabled, will link libc++ against the static version of the ABI library.


Reviewers: mclow.lists, jroelofs, danalbert

Reviewed By: danalbert

Subscribers: compnerd, cfe-commits

Differential Revision: http://reviews.llvm.org/D8017

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@231076 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03 15:59:51 +00:00
Eric Fiselier
45969ecfcd [libcxx] Move to using libc++abi2.exp as the default symbol list for libc++
Summary:
libc++abi2.exp should be used whenever `cxxabi.h` defines `_LIBCPPABI_VERSION`. This macro was added to libc++abi in 2012 in r149632. For this reason we should use libc++abi2.exp as default unless otherwise specified.

Also when building against an in-tree libc++abi we definitely want to use libc++abi2.exp.

I would love to know what OSX was the last to use libc++abi.exp but I can only test on 10.9.


Reviewers: danalbert, mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: meadori, cfe-commits

Differential Revision: http://reviews.llvm.org/D7773

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@230119 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-21 02:26:24 +00:00
Chandler Carruth
7a033ca056 [cmake/multilib] Teach libc++'s CMake build to support multilib libdir
suffixes like 'lib64' or 'lib32'.

This support is currently very rhudimentary. We define a variable
LIBCXX_LIBDIR_SUFFIX. In a standalone build of libc++ this can be
directly set as a cached variable to control the multilib suffix used.
When building libc++ within a larger LLVM build, it is hard wired to
whatever LLVM libdir suffix has been selected. If this doesn't work for
someone, just let me know. I'm happy to change it.

This is essentially new functionality for libc++ so I don't expect it to
have any impact for folks until they start setting these variables.
However, I know libc++ is built in a diverse set of environments so just
let me know if this causes you any problems.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224926 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-29 12:15:47 +00:00
Eric Fiselier
6cb69ffa0a Fixes to get libc++ building on sun solaris. Patch from C Bergstrom.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222794 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-25 21:57:41 +00:00
Eric Fiselier
8e2855ce0b [libcxx] Refactor CMakeLists.txt handling of compile and link flags to suppress warnings.
Summary:
Currently we have 5 variables that are used to specify options for building libcxx
1. `LIBCXX_CXX_FEATURE_FLAGS`
2. `LIBCXX_CXX_WARNING_FLAGS`
3. `LIBCXX_CXX_REQUIRED_FLAGS`
4. `compile_flags` (in libcxx/lib)
5. `link_flags` (in libcxx/lib)

The first three all get put into `CMAKE_CXX_FLAGS`. 
This changes the way flags are handled by only using 3 different options:

1. `LIBCXX_CXX_FLAGS` - general compile and link flags.
2. `LIBCXX_COMPILE_FLAGS` - compile only flags.
3. `LIBCXX_LINK_FLAGS` - link only flags.

This patch also removes the warning about `-nostdinc++` being unused during linking.



Reviewers: mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6277

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222080 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-15 06:26:30 +00:00
Eric Fiselier
cb7e32c290 [libcxx] Redo adding support for building and testing with an ABI library not along linker paths
Summary:
This is the second attempt at allowing for the use of libraries that the linker cannot find. The first attempt used `CMAKE_LIBRARY_PATH` and `find_library` to select which ABI library should be used. There were a number of problems with this approach:

- `find_library` didn't work with cmake targets (ie in-tree libcxxabi build)
- It wasn't always possible to determine where `find_library` actually found your library.
- `target_link_libraries` inserted the path of the ABI library into libc++'s RPATH when `find_library` was used.
- Linking libc++ and it's ABI library is a special case. It's a lot easier to keep it simple. 

After discussion with @cbergstrum a new approach was decided upon.
This patch achieve the same ends by simply using `LIBCXX_CXX_ABI_LIBRARY_PATH` to specify where to find the library (if the linker won't find it). When this variable is defined it is simply added as a library search path when linking libc++. It is a lot easier to duplicate this behavior in LIT. It also prevents libc++ from being linked with an RPATH.






Reviewers: mclow.lists, cbergstrom, chandlerc, danalbert

Reviewed By: chandlerc, danalbert

Subscribers: chandlerc, cfe-commits

Differential Revision: http://reviews.llvm.org/D5860

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220157 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-19 00:42:41 +00:00
Hans Wennborg
f3b5f0e134 [libc++] Fix the CMake build on Mac when setting MACOSX_DEPLOYMENT_TARGET=10.6
The build file was trying to use LIBCXX_VERSION, which isn't set
anywhere, and also forgot to split the 'compile_flags' list.

Differential Revision: http://reviews.llvm.org/D4860

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@215463 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12 17:32:07 +00:00
Dan Albert
a1d32fcd0e Obey LLVM_LIBDIR_SUFFIX.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@214726 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-04 16:13:32 +00:00
David Fang
44ead61237 eliminate install of duplicate headers (take 2)
Patch by Ryuta Suzuki

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@211629 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-24 20:32:11 +00:00
Howard Hinnant
c4962b3f44 Justin Bogner: This makes the headers available in the build directory, making it
easier to use freshly-built clang with freshly-built libc++.

Basically, this makes it possible to run clang with libc++ without
having to install it, even if you don't have any version of libc++
installed in /usr/

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@194825 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-15 17:18:57 +00:00
Michael Gottesman
c64c980140 [cmake] Provide an option to not install the support headers so that the cmake build can match the make build if requested.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189739 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-02 07:28:05 +00:00
Michael Gottesman
8a1fc89cf9 [cmake] Make libcxx standalone compile on Mac OS X.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189738 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-02 07:28:03 +00:00
Michael J. Spencer
db8a030bd3 [CMake] Fix c++ abi library configuration on Linux.
You can now configure from the command line using:
-DLIBCXX_CXX_ABI=libsupc++
-DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="path;path

Also documents how to build on Linux.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171316 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 19:34:21 +00:00
Michael J. Spencer
a358fbe504 [CMake] Add support for selecting which c++ abi library to use.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@169036 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 21:02:29 +00:00
Howard Hinnant
87c61a61fe Allow libc++ to be built with CMake from within the LLVM tree. The libc++ part is just some renaming as the variable was already in use, conflicting with something else in the LLVM tree. Contributed by Ruben Van Boxem.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153036 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-19 15:40:23 +00:00
Howard Hinnant
92a07003b2 Partial Windows port by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140328 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-22 19:10:18 +00:00
Howard Hinnant
20542c0b94 http://llvm.org/bugs/show_bug.cgi?id=9399 fixed by Ryuta Suzuki
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131961 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 12:54:00 +00:00
Howard Hinnant
8dcad976e0 http://llvm.org/bugs/show_bug.cgi?id=9349 I introduced a bug with the last fix and Ryuta Suzuki has corrected it. And hopefully I committed Ryuta Suzuki's directions correctly this time.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126917 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-03 01:59:23 +00:00
Howard Hinnant
542b0f0cf5 http://llvm.org/bugs/show_bug.cgi?id=9349 I have not personally tested this patch. Please let me know if it causes problems.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126846 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 17:29:46 +00:00
Michael J. Spencer
626916fc25 Add CMake build and fix major Linux blockers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121510 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 19:47:54 +00:00