Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-13 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a reviewer: EricWF.
EricWF added a comment.
This revision is now accepted and ready to land.

Maintainers from Apple and FreeBSD gave this the thumbs up.


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-09 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 37013.
EricWF added a comment.

Make the generated config dependent on the "__config_site" file. It probably 
didn't need this but it doesn't hurt to have.


http://reviews.llvm.org/D13407

Files:
  CMakeLists.txt
  cmake/Modules/HandleLibcxxFlags.cmake
  docs/DesignDocs/CapturingConfigInfo.rst
  docs/index.rst
  include/CMakeLists.txt
  include/__config_site.in

Index: include/__config_site.in
===
--- /dev/null
+++ 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
Index: include/CMakeLists.txt
===
--- include/CMakeLists.txt
+++ 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 @@
 ${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()
Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -124,6 +124,12 @@
 Design Documents
 
 
+.. toctree::
+   :maxdepth: 1
+
+   DesignDocs/CapturingConfigInfo
+
+
 * ` design `_
 * ` design `_
 * `Status of debug mode `_
Index: docs/DesignDocs/CapturingConfigInfo.rst
===
--- /dev/null
+++ docs/DesignDocs/CapturingConfigInfo.rst
@@ -0,0 +1,88 @@
+===
+Capturing configuration information during installation
+===
+
+.. contents::
+   :local:
+
+The Problem
+===
+
+Currently the libc++ supports building the library with a number of different
+configuration options.  Unfortunately all of that configuration information is
+lost when libc++ is installed. In order to support "persistent"
+configurations libc++ needs a mechanism to capture the configuration options
+in the INSTALLED headers.
+
+
+Design Goals
+
+
+* The solution should not INSTALL any additional headers. We don't want an extra
+  #include slowing everybody down.
+
+* The solution should not unduly affect libc++ developers. The problem is limited
+  to installed versions of libc++ and the solution should be as well.
+
+* The solution should not modify any existing headers EXCEPT during installation.
+  It makes developers lives harder if they have to regenerate the libc++ headers
+  every time they are modified.
+
+* The solution should not make any of the libc++ headers dependant on
+  files generated by the build system. The headers should be able to compile
+  out of the box without any modification.
+
+* The solution should not have ANY effect on users who don't need special
+  configuration options. The vast majority of users will never n

Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-09 Thread Eric Fiselier via cfe-commits
EricWF marked an inline comment as done.


Comment at: include/CMakeLists.txt:38
@@ +37,3 @@
+  COMMAND ${UNIX_CAT} ${LIBCXX_SOURCE_DIR}/include/__config >> 
${LIBCXX_BINARY_DIR}/__generated_config
+  DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
+)

eugenis wrote:
> I think you need to depend on __config_site.in as well. Or on 
> ${LIBCXX_BINARY_DIR}/__config_site 
I don't think we need it. `__config_site` is generated with `configure_file`, 
which runs at configuration time and re-runs whenever the input file is 
changed. So `__config_site` should always be up to date. 

However I'll see if we can actually make the change. It seems clearer and safer.


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-09 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

Thanks. I'll upload the rebase patch on Monday.



Comment at: include/CMakeLists.txt:38
@@ +37,3 @@
+  COMMAND ${UNIX_CAT} ${LIBCXX_SOURCE_DIR}/include/__config >> 
${LIBCXX_BINARY_DIR}/__generated_config
+  DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
+)

I think you need to depend on __config_site.in as well. Or on 
${LIBCXX_BINARY_DIR}/__config_site 


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-09 Thread Eric Fiselier via cfe-commits
EricWF marked an inline comment as done.
EricWF added a comment.

@eugenis I'll commit this tuesday morning If I don't hear anything over the 
weekend (Monday is a holiday for me).
If you rebase the ABI patch to work with this I'll make sure to review it ASAP.



Comment at: include/CMakeLists.txt:9
@@ -7,2 +8,3 @@
   PATTERN ".svn" EXCLUDE
+  PATTERN "__config_site.in" EXCLUDE
   ${LIBCXX_SUPPORT_HEADER_PATTERN}

vkalintiris wrote:
> Kind of silly but I believe that the files used for auto-generated config 
> headers in LLVM have the extesions `.cmake` and `.in`, for cmake and 
> autoconf, respectively.
libc++ uses `.cmake` for CMake scripts and `.in` for auto-generated files and I 
think this is fine. libc++ doesn't support autoconf I'm not worried about it 
causing confusion. 



http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-08 Thread Vasileios Kalintiris via cfe-commits
vkalintiris added a subscriber: vkalintiris.


Comment at: include/CMakeLists.txt:9
@@ -7,2 +8,3 @@
   PATTERN ".svn" EXCLUDE
+  PATTERN "__config_site.in" EXCLUDE
   ${LIBCXX_SUPPORT_HEADER_PATTERN}

Kind of silly but I believe that the files used for auto-generated config 
headers in LLVM have the extesions `.cmake` and `.in`, for cmake and autoconf, 
respectively.


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-06 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Cool. I've reached out to some platform maintainers to make sure they don't see 
any problems.  I'll commit this once I hear back.


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-06 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

In http://reviews.llvm.org/D13407#261228, @EricWF wrote:

> Use `type` instead of `cat` on windows as suggested by @rnk. @eugenis does 
> this address your concern?


Absolutely!
LGTM


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-06 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 36682.
EricWF added a comment.

Use `type` instead of `cat` on windows as suggested by @rnk. @eugenis does this 
address your concern?


http://reviews.llvm.org/D13407

Files:
  CMakeLists.txt
  cmake/Modules/HandleLibcxxFlags.cmake
  docs/DesignDocs/CapturingConfigInfo.rst
  docs/index.rst
  include/CMakeLists.txt
  include/__config_site.in

Index: include/__config_site.in
===
--- /dev/null
+++ 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
Index: include/CMakeLists.txt
===
--- include/CMakeLists.txt
+++ 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,28 @@
 ${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
+)
+# 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()
Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -124,6 +124,12 @@
 Design Documents
 
 
+.. toctree::
+   :maxdepth: 1
+
+   DesignDocs/CapturingConfigInfo
+
+
 * ` design `_
 * ` design `_
 * `Status of debug mode `_
Index: docs/DesignDocs/CapturingConfigInfo.rst
===
--- /dev/null
+++ docs/DesignDocs/CapturingConfigInfo.rst
@@ -0,0 +1,88 @@
+===
+Capturing configuration information during installation
+===
+
+.. contents::
+   :local:
+
+The Problem
+===
+
+Currently the libc++ supports building the library with a number of different
+configuration options.  Unfortunately all of that configuration information is
+lost when libc++ is installed. In order to support "persistent"
+configurations libc++ needs a mechanism to capture the configuration options
+in the INSTALLED headers.
+
+
+Design Goals
+
+
+* The solution should not INSTALL any additional headers. We don't want an extra
+  #include slowing everybody down.
+
+* The solution should not unduly affect libc++ developers. The problem is limited
+  to installed versions of libc++ and the solution should be as well.
+
+* The solution should not modify any existing headers EXCEPT during installation.
+  It makes developers lives harder if they have to regenerate the libc++ headers
+  every time they are modified.
+
+* The solution should not make any of the libc++ headers dependant on
+  files generated by the build system. The headers should be able to compile
+  out of the box without any modification.
+
+* The solution should not have ANY effect on users who don't need special
+  configuration options. The vast majority of users will never need this so it
+  shouldn't cost them.
+
+
+The Solution
+

Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-06 Thread Reid Kleckner via cfe-commits
rnk added a subscriber: rnk.


Comment at: include/CMakeLists.txt:31
@@ +30,3 @@
+# by  prepending __config_site to the current __config header.
+# TODO(EricWF) Is it portable to use "cat" and ">>"?
+add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config

EricWF wrote:
> eugenis wrote:
> > EricWF wrote:
> > > eugenis wrote:
> > > > I don't think >> would work on windows.
> > > > Do you really need __generated_config to be created at build time (as 
> > > > opposed to configure time)? You could use file(read) and file(append) 
> > > > then.
> > > > 
> > > I would strongly prefer the file got generated at build time so that it 
> > > contains any changes made in the source tree. Any other behavior is 
> > > developer hostile and non-obvious. In order to keep the installed headers 
> > > consistent we need to do this. Although I hope there is a better way to 
> > > achieve this.
> > Right, good point. Then you could go back to the approach in D11963 where 
> > you called cmake in a custom command with a small script that used file(*) 
> > commands.
> > 
> That approach had a problem because the cmake INSTALL command used to invoke 
> the script doesn't take a "COMPONENT" argument which would break the 
> "install-libcxx" rule. On windows we could do it with a call out to python or 
> a shell script. Would that work?
The >> operator should work on Windows. It's supported by cmd. However, cat 
generally isn't available. If you use 'type' in place of 'cat' it should work.


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-06 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.


Comment at: include/CMakeLists.txt:31
@@ +30,3 @@
+# by  prepending __config_site to the current __config header.
+# TODO(EricWF) Is it portable to use "cat" and ">>"?
+add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config

eugenis wrote:
> EricWF wrote:
> > eugenis wrote:
> > > I don't think >> would work on windows.
> > > Do you really need __generated_config to be created at build time (as 
> > > opposed to configure time)? You could use file(read) and file(append) 
> > > then.
> > > 
> > I would strongly prefer the file got generated at build time so that it 
> > contains any changes made in the source tree. Any other behavior is 
> > developer hostile and non-obvious. In order to keep the installed headers 
> > consistent we need to do this. Although I hope there is a better way to 
> > achieve this.
> Right, good point. Then you could go back to the approach in D11963 where you 
> called cmake in a custom command with a small script that used file(*) 
> commands.
> 
That approach had a problem because the cmake INSTALL command used to invoke 
the script doesn't take a "COMPONENT" argument which would break the 
"install-libcxx" rule. On windows we could do it with a call out to python or a 
shell script. Would that work?


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-06 Thread Evgeniy Stepanov via cfe-commits
eugenis added inline comments.


Comment at: include/CMakeLists.txt:31
@@ +30,3 @@
+# by  prepending __config_site to the current __config header.
+# TODO(EricWF) Is it portable to use "cat" and ">>"?
+add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config

EricWF wrote:
> eugenis wrote:
> > I don't think >> would work on windows.
> > Do you really need __generated_config to be created at build time (as 
> > opposed to configure time)? You could use file(read) and file(append) then.
> > 
> I would strongly prefer the file got generated at build time so that it 
> contains any changes made in the source tree. Any other behavior is developer 
> hostile and non-obvious. In order to keep the installed headers consistent we 
> need to do this. Although I hope there is a better way to achieve this.
Right, good point. Then you could go back to the approach in D11963 where you 
called cmake in a custom command with a small script that used file(*) commands.



http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-06 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.


Comment at: include/CMakeLists.txt:31
@@ +30,3 @@
+# by  prepending __config_site to the current __config header.
+# TODO(EricWF) Is it portable to use "cat" and ">>"?
+add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config

eugenis wrote:
> I don't think >> would work on windows.
> Do you really need __generated_config to be created at build time (as opposed 
> to configure time)? You could use file(read) and file(append) then.
> 
I would strongly prefer the file got generated at build time so that it 
contains any changes made in the source tree. Any other behavior is developer 
hostile and non-obvious. In order to keep the installed headers consistent we 
need to do this. Although I hope there is a better way to achieve this.


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-06 Thread Evgeniy Stepanov via cfe-commits
eugenis added a comment.

Looks great!



Comment at: include/CMakeLists.txt:31
@@ +30,3 @@
+# by  prepending __config_site to the current __config header.
+# TODO(EricWF) Is it portable to use "cat" and ">>"?
+add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config

I don't think >> would work on windows.
Do you really need __generated_config to be created at build time (as opposed 
to configure time)? You could use file(read) and file(append) then.



http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-05 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

Design doc looks good! I think it captures all the design constraints well, and 
the proposed solution satisfies those constraints as far as I am concerned.

Thumbs up from me... but I'll still defer the final 'LGTM' to @mclow.lists.


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-03 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 36457.
EricWF added a comment.

I removed all non-essential changes in order to make this easy and fast to 
review. This patch is blocking a number of people so I would like to have this 
reviewed soon.


http://reviews.llvm.org/D13407

Files:
  CMakeLists.txt
  cmake/Modules/HandleLibcxxFlags.cmake
  docs/DesignDocs/CapturingConfigInfo.rst
  docs/index.rst
  include/CMakeLists.txt
  include/__config_site.in

Index: include/__config_site.in
===
--- /dev/null
+++ 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
Index: include/CMakeLists.txt
===
--- include/CMakeLists.txt
+++ 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,25 @@
 ${LIBCXX_HEADER_PATTERN}
 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
   )
+
+  if (LIBCXX_NEEDS_SITE_CONFIG)
+# Generate and install a custom __config header. The new header is created
+# by  prepending __config_site to the current __config header.
+# TODO(EricWF) Is it portable to use "cat" and ">>"?
+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 cat ${LIBCXX_SOURCE_DIR}/include/__config >> ${LIBCXX_BINARY_DIR}/__generated_config
+  DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
+)
+# 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()
Index: docs/index.rst
===
--- docs/index.rst
+++ docs/index.rst
@@ -124,6 +124,12 @@
 Design Documents
 
 
+.. toctree::
+   :maxdepth: 1
+
+   DesignDocs/CapturingConfigInfo
+
+
 * ` design `_
 * ` design `_
 * `Status of debug mode `_
Index: docs/DesignDocs/CapturingConfigInfo.rst
===
--- /dev/null
+++ docs/DesignDocs/CapturingConfigInfo.rst
@@ -0,0 +1,89 @@
+===
+Capturing configuration information during installation
+===
+
+.. contents::
+   :local:
+
+The Problem
+===
+
+Currently the libc++ supports building the library with a number of different
+configuration options.  Unfortunately all of that configuration information is
+lost when libc++ is installed. In order to support "persistent"
+configurations libc++ needs a mechanism to capture the configuration options
+in the INSTALLED headers.
+
+
+Design Goals
+
+
+* The solution should not INSTALL any additional headers. We don't want an extra
+  #include slowing everybody down.
+
+* The solution should not unduly affect libc++ developers. The problem is limited
+  to installed versions of libc++ and the solution should be as well.
+
+* The solution should not modify any existing headers EXCEPT during installation.
+  It makes developers lives harder if they have to regenerate the libc++ headers
+  every time they are modified.
+
+* The solution should not make any of the libc++ headers dependant on
+  files generated by the build system. The headers should be able to compile
+  out of the box without any modification.
+
+* The solution should not have ANY effect on users who don't need special
+  configuration options. The vast majority of users will never need this so it
+  shouldn't cos

Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-02 Thread Eric Fiselier via cfe-commits
EricWF added subscribers: eugenis, asl, espositofulvio, ed.
EricWF added a comment.

Adding subscribes from the old patch to this one.


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D13407: [libcxx] Capture configuration information when installing the libc++ headers

2015-10-02 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Oh, but don't review the design doc too closely. I'm still working on it.


http://reviews.llvm.org/D13407



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits