[PATCH] D43797: [CMake] Copy the generated __config header into build directory

2018-03-09 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL327194: [CMake] Copy the generated __config header into 
build directory (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D43797?vs=136015=137880#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D43797

Files:
  libcxx/trunk/include/CMakeLists.txt
  libcxx/trunk/lib/CMakeLists.txt


Index: libcxx/trunk/include/CMakeLists.txt
===
--- libcxx/trunk/include/CMakeLists.txt
+++ libcxx/trunk/include/CMakeLists.txt
@@ -2,6 +2,23 @@
   set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
 endif()
 
+if (LIBCXX_NEEDS_SITE_CONFIG)
+  # Generate 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 ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py
+  ${LIBCXX_BINARY_DIR}/__config_site
+  ${LIBCXX_SOURCE_DIR}/include/__config
+  -o ${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)
+  set(generated_config_deps generate_config_header)
+endif()
+
 set(LIBCXX_HEADER_PATTERN
   PATTERN "*"
   PATTERN "CMakeLists.txt" EXCLUDE
@@ -16,6 +33,15 @@
 FILES_MATCHING
 ${LIBCXX_HEADER_PATTERN}
 )
+
+  if (LIBCXX_NEEDS_SITE_CONFIG)
+# Copy the generated header as __config into build directory.
+add_custom_command(
+TARGET generate_config_header POST_BUILD
+COMMAND ${CMAKE_COMMAND} -E copy
+${LIBCXX_BINARY_DIR}/__generated_config
+${LLVM_BINARY_DIR}/include/c++/v1/__config)
+  endif()
 endif()
 
 if (LIBCXX_INSTALL_HEADERS)
@@ -28,20 +54,6 @@
   )
 
   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.
-add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
-  COMMAND ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py
-${LIBCXX_BINARY_DIR}/__config_site
-${LIBCXX_SOURCE_DIR}/include/__config
--o ${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)
-set(generated_config_deps generate_config_header)
 # Install the generated header as __config.
 install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
   DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
Index: libcxx/trunk/lib/CMakeLists.txt
===
--- libcxx/trunk/lib/CMakeLists.txt
+++ libcxx/trunk/lib/CMakeLists.txt
@@ -283,7 +283,7 @@
 endif()
 
 # Add a meta-target for both libraries.
-add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS})
+add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS} ${generated_config_deps})
 
 if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
   file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp)


Index: libcxx/trunk/include/CMakeLists.txt
===
--- libcxx/trunk/include/CMakeLists.txt
+++ libcxx/trunk/include/CMakeLists.txt
@@ -2,6 +2,23 @@
   set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
 endif()
 
+if (LIBCXX_NEEDS_SITE_CONFIG)
+  # Generate 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 ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py
+  ${LIBCXX_BINARY_DIR}/__config_site
+  ${LIBCXX_SOURCE_DIR}/include/__config
+  -o ${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)
+  set(generated_config_deps generate_config_header)
+endif()
+
 set(LIBCXX_HEADER_PATTERN
   PATTERN "*"
   PATTERN "CMakeLists.txt" EXCLUDE
@@ -16,6 +33,15 @@
 FILES_MATCHING
 ${LIBCXX_HEADER_PATTERN}
 )
+
+  if (LIBCXX_NEEDS_SITE_CONFIG)
+# Copy the generated header as __config into build directory.
+add_custom_command(
+TARGET generate_config_header POST_BUILD
+COMMAND ${CMAKE_COMMAND} -E copy
+

[PATCH] D43797: [CMake] Copy the generated __config header into build directory

2018-03-09 Thread Petr Hosek via Phabricator via cfe-commits
phosek added inline comments.



Comment at: libcxx/include/CMakeLists.txt:19
+DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
+  set(generated_config_deps generate_config_header)
+endif()

compnerd wrote:
> Where is `generated_config_deps` used?
Line 69


Repository:
  rCXX libc++

https://reviews.llvm.org/D43797



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


[PATCH] D43797: [CMake] Copy the generated __config header into build directory

2018-03-09 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd accepted this revision.
compnerd added inline comments.
This revision is now accepted and ready to land.



Comment at: libcxx/include/CMakeLists.txt:19
+DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
+  set(generated_config_deps generate_config_header)
+endif()

Where is `generated_config_deps` used?


Repository:
  rCXX libc++

https://reviews.llvm.org/D43797



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


[PATCH] D43797: [CMake] Copy the generated __config header into build directory

2018-03-06 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

Ping again?


Repository:
  rCXX libc++

https://reviews.llvm.org/D43797



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


[PATCH] D43797: [CMake] Copy the generated __config header into build directory

2018-03-01 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

Ping? Can we land this as a temporary solution until the config generator logic 
is rewritten? This is currently breaking the libFuzzer build for us.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43797



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


[PATCH] D43797: [CMake] Copy the generated __config header into build directory

2018-02-26 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: EricWF, mclow.lists, beanz.
Herald added subscribers: cfe-commits, christof, mgorny.

When the generated __config file is being used, it is currently only
copied during installation process. However, that means that the file
that gets copied into LLVM build directory is the vanilla __config file,
and any parts of the build that depend on the just built toolchain like
sanitizers will get that instead of the generated version. To avoid this
issue, we need to copy the generated header into the LLVM build
directory as well.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43797

Files:
  libcxx/include/CMakeLists.txt


Index: libcxx/include/CMakeLists.txt
===
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -2,6 +2,23 @@
   set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
 endif()
 
+if (LIBCXX_NEEDS_SITE_CONFIG)
+  # Generate 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 ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py
+  ${LIBCXX_BINARY_DIR}/__config_site
+  ${LIBCXX_SOURCE_DIR}/include/__config
+  -o ${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)
+  set(generated_config_deps generate_config_header)
+endif()
+
 set(LIBCXX_HEADER_PATTERN
   PATTERN "*"
   PATTERN "CMakeLists.txt" EXCLUDE
@@ -16,6 +33,15 @@
 FILES_MATCHING
 ${LIBCXX_HEADER_PATTERN}
 )
+
+  if (LIBCXX_NEEDS_SITE_CONFIG)
+# Copy the generated header as __config into build directory.
+add_custom_command(
+TARGET generate_config_header POST_BUILD
+COMMAND ${CMAKE_COMMAND} -E copy
+${LIBCXX_BINARY_DIR}/__generated_config
+${LLVM_BINARY_DIR}/include/c++/v1/__config)
+  endif()
 endif()
 
 if (LIBCXX_INSTALL_HEADERS)
@@ -28,20 +54,6 @@
   )
 
   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.
-add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
-  COMMAND ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py
-${LIBCXX_BINARY_DIR}/__config_site
-${LIBCXX_SOURCE_DIR}/include/__config
--o ${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)
-set(generated_config_deps generate_config_header)
 # Install the generated header as __config.
 install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
   DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1


Index: libcxx/include/CMakeLists.txt
===
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -2,6 +2,23 @@
   set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
 endif()
 
+if (LIBCXX_NEEDS_SITE_CONFIG)
+  # Generate 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 ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py
+  ${LIBCXX_BINARY_DIR}/__config_site
+  ${LIBCXX_SOURCE_DIR}/include/__config
+  -o ${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)
+  set(generated_config_deps generate_config_header)
+endif()
+
 set(LIBCXX_HEADER_PATTERN
   PATTERN "*"
   PATTERN "CMakeLists.txt" EXCLUDE
@@ -16,6 +33,15 @@
 FILES_MATCHING
 ${LIBCXX_HEADER_PATTERN}
 )
+
+  if (LIBCXX_NEEDS_SITE_CONFIG)
+# Copy the generated header as __config into build directory.
+add_custom_command(
+TARGET generate_config_header POST_BUILD
+COMMAND ${CMAKE_COMMAND} -E copy
+${LIBCXX_BINARY_DIR}/__generated_config
+${LLVM_BINARY_DIR}/include/c++/v1/__config)
+  endif()
 endif()
 
 if (LIBCXX_INSTALL_HEADERS)
@@ -28,20 +54,6 @@
   )
 
   if (LIBCXX_NEEDS_SITE_CONFIG)
-# Generate and install a custom __config header. The new header is created
-# by  prepending