summaryrefslogtreecommitdiffstats
path: root/libcxx/include
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-10-13 22:12:02 +0000
committerEric Fiselier <eric@efcs.ca>2015-10-13 22:12:02 +0000
commitf9f796e79b95a70346a945a589e833b71123e983 (patch)
treec75b126e469f0ec573e5544a51193077b5e22997 /libcxx/include
parenteba62796cb9bb9e4856b4067a0d0117033cb3c1d (diff)
downloadbcm5719-llvm-f9f796e79b95a70346a945a589e833b71123e983.tar.gz
bcm5719-llvm-f9f796e79b95a70346a945a589e833b71123e983.zip
[libcxx] Capture configuration information when installing the libc++ headers
Summary: Hi all, This patch is a successor to D11963. However it has changed dramatically and I felt it would be best to start a new review thread. Please read the design documentation added in this patch for a description of how it works. Reviewers: mclow.lists, danalbert, jroelofs, EricWF Subscribers: vkalintiris, rnk, ed, espositofulvio, asl, eugenis, cfe-commits Differential Revision: http://reviews.llvm.org/D13407 llvm-svn: 250235
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/CMakeLists.txt27
-rw-r--r--libcxx/include/__config_site.in20
2 files changed, 47 insertions, 0 deletions
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 7a7c2295c21..e16dc8b4de6 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -1,10 +1,12 @@
if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
endif()
+
set(LIBCXX_HEADER_PATTERN
PATTERN "*"
PATTERN "CMakeLists.txt" EXCLUDE
PATTERN ".svn" EXCLUDE
+ PATTERN "__config_site.in" EXCLUDE
${LIBCXX_SUPPORT_HEADER_PATTERN}
)
@@ -22,4 +24,29 @@ if (LIBCXX_INSTALL_HEADERS)
${LIBCXX_HEADER_PATTERN}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
+
+ if (LIBCXX_NEEDS_SITE_CONFIG)
+ set(UNIX_CAT cat)
+ if (WIN32)
+ set(UNIX_CAT type)
+ endif()
+ # Generate and install a custom __config header. The new header is created
+ # by prepending __config_site to the current __config header.
+ add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBCXX_BINARY_DIR}/__config_site ${LIBCXX_BINARY_DIR}/__generated_config
+ COMMAND ${UNIX_CAT} ${LIBCXX_SOURCE_DIR}/include/__config >> ${LIBCXX_BINARY_DIR}/__generated_config
+ DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
+ ${LIBCXX_BINARY_DIR}/__config_site
+ )
+ # Add a target that executes the generation commands.
+ add_custom_target(generate_config_header ALL
+ DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
+ # Install the generated header as __config.
+ install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
+ DESTINATION include/c++/v1
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ RENAME __config
+ COMPONENT libcxx)
+ endif()
+
endif()
diff --git a/libcxx/include/__config_site.in b/libcxx/include/__config_site.in
new file mode 100644
index 00000000000..a248787f25b
--- /dev/null
+++ b/libcxx/include/__config_site.in
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CONFIG_SITE
+#define _LIBCPP_CONFIG_SITE
+
+#cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+#cmakedefine _LIBCPP_HAS_NO_STDIN
+#cmakedefine _LIBCPP_HAS_NO_STDOUT
+#cmakedefine _LIBCPP_HAS_NO_THREADS
+#cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK
+#cmakedefine _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
+
+#endif
OpenPOWER on IntegriCloud