[PATCH] D44773: [CMake] Use custom command and target to install libc++ headers

2018-04-08 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCXX329544: [CMake] Use custom command and target to install 
libc++ headers (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D44773?vs=141580=141583#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44773

Files:
  NOTES.TXT
  cmake/Modules/HandleLibCXXABI.cmake
  include/CMakeLists.txt
  lib/CMakeLists.txt

Index: include/CMakeLists.txt
===
--- include/CMakeLists.txt
+++ include/CMakeLists.txt
@@ -1,5 +1,183 @@
-if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
-  set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
+set(files
+  __bit_reference
+  __bsd_locale_defaults.h
+  __bsd_locale_fallbacks.h
+  __debug
+  __functional_03
+  __functional_base
+  __functional_base_03
+  __hash_table
+  __libcpp_version
+  __locale
+  __mutex_base
+  __nullptr
+  __split_buffer
+  __sso_allocator
+  __std_stream
+  __string
+  __threading_support
+  __tree
+  __tuple
+  __undef_macros
+  algorithm
+  any
+  array
+  atomic
+  bitset
+  cassert
+  ccomplex
+  cctype
+  cerrno
+  cfenv
+  cfloat
+  chrono
+  cinttypes
+  ciso646
+  climits
+  clocale
+  cmath
+  codecvt
+  compare
+  complex
+  complex.h
+  condition_variable
+  csetjmp
+  csignal
+  cstdarg
+  cstdbool
+  cstddef
+  cstdint
+  cstdio
+  cstdlib
+  cstring
+  ctgmath
+  ctime
+  ctype.h
+  cwchar
+  cwctype
+  deque
+  errno.h
+  exception
+  experimental/__config
+  experimental/__memory
+  experimental/algorithm
+  experimental/any
+  experimental/chrono
+  experimental/coroutine
+  experimental/deque
+  experimental/dynarray
+  experimental/filesystem
+  experimental/forward_list
+  experimental/functional
+  experimental/iterator
+  experimental/list
+  experimental/map
+  experimental/memory_resource
+  experimental/numeric
+  experimental/optional
+  experimental/propagate_const
+  experimental/ratio
+  experimental/regex
+  experimental/set
+  experimental/string
+  experimental/string_view
+  experimental/system_error
+  experimental/tuple
+  experimental/type_traits
+  experimental/unordered_map
+  experimental/unordered_set
+  experimental/utility
+  experimental/vector
+  ext/__hash
+  ext/hash_map
+  ext/hash_set
+  float.h
+  forward_list
+  fstream
+  functional
+  future
+  initializer_list
+  inttypes.h
+  iomanip
+  ios
+  iosfwd
+  iostream
+  istream
+  iterator
+  limits
+  limits.h
+  list
+  locale
+  locale.h
+  map
+  math.h
+  memory
+  module.modulemap
+  mutex
+  new
+  numeric
+  optional
+  ostream
+  queue
+  random
+  ratio
+  regex
+  scoped_allocator
+  set
+  setjmp.h
+  shared_mutex
+  sstream
+  stack
+  stdbool.h
+  stddef.h
+  stdexcept
+  stdint.h
+  stdio.h
+  stdlib.h
+  streambuf
+  string
+  string.h
+  string_view
+  strstream
+  system_error
+  tgmath.h
+  thread
+  tuple
+  type_traits
+  typeindex
+  typeinfo
+  unordered_map
+  unordered_set
+  utility
+  valarray
+  variant
+  vector
+  version
+  wchar.h
+  wctype.h
+  )
+
+if(LIBCXX_INSTALL_SUPPORT_HEADERS)
+  set(files
+${files}
+support/android/locale_bionic.h
+support/fuchsia/xlocale.h
+support/ibm/limits.h
+support/ibm/locale_mgmt_aix.h
+support/ibm/support.h
+support/ibm/xlocale.h
+support/musl/xlocale.h
+support/newlib/xlocale.h
+support/solaris/floatingpoint.h
+support/solaris/wchar.h
+support/solaris/xlocale.h
+support/win32/limits_msvc_win32.h
+support/win32/locale_win32.h
+support/xlocale/__nop_locale_mgmt.h
+support/xlocale/__posix_l_fallback.h
+support/xlocale/__strtonum_fallback.h
+support/xlocale/xlocale.h
+)
 endif()
 
 if (LIBCXX_NEEDS_SITE_CONFIG)
@@ -14,44 +192,56 @@
 ${LIBCXX_BINARY_DIR}/__config_site
   )
   # Add a target that executes the generation commands.
-  add_custom_target(generate_config_header ALL
+  add_custom_target(cxx-generated-config ALL
 DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
-  set(generated_config_deps generate_config_header)
+  set(generated_config_deps cxx-generated-config)
+else()
+  set(files
+${files}
+__config
+)
 endif()
 
-set(LIBCXX_HEADER_PATTERN
-  PATTERN "*"
-  PATTERN "CMakeLists.txt" EXCLUDE
-  PATTERN ".svn" EXCLUDE
-  PATTERN "__config_site.in" EXCLUDE
-  ${LIBCXX_SUPPORT_HEADER_PATTERN}
-  )
-
 if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
-  file(COPY .
-DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1"
-FILES_MATCHING
-${LIBCXX_HEADER_PATTERN}
-)
+  set(output_dir ${LLVM_BINARY_DIR}/include/c++/v1)
+
+  set(out_files)
+  foreach(f ${files})
+set(src ${CMAKE_CURRENT_SOURCE_DIR}/${f})
+set(dst ${output_dir}/${f})
+add_custom_command(OUTPUT ${dst}
+  DEPENDS ${src}
+  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+  COMMENT "Copying libc++'s ${f}...")
+list(APPEND out_files ${dst})
+  endforeach()
 
   if 

[PATCH] D44773: [CMake] Use custom command and target to install libc++ headers

2018-04-08 Thread Petr Hosek via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329544: [CMake] Use custom command and target to install 
libc++ headers (authored by phosek, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D44773?vs=141580=141582#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D44773

Files:
  libcxx/trunk/NOTES.TXT
  libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/trunk/include/CMakeLists.txt
  libcxx/trunk/lib/CMakeLists.txt

Index: libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
===
--- libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
+++ libcxx/trunk/cmake/Modules/HandleLibCXXABI.cmake
@@ -47,28 +47,38 @@
 set(found TRUE)
 get_filename_component(dstdir ${fpath} PATH)
 get_filename_component(ifile ${fpath} NAME)
-file(COPY "${incpath}/${fpath}"
-  DESTINATION "${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}"
-  )
-file(COPY "${incpath}/${fpath}"
-  DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1/${dstdir}"
-  )
+set(src ${incpath}/${fpath})
+
+set(dst ${LIBCXX_BINARY_INCLUDE_DIR}/${dstdir}/${fpath})
+add_custom_command(OUTPUT ${dst}
+DEPENDS ${src}
+COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+COMMENT "Copying C++ ABI header ${fpath}...")
+list(APPEND abilib_headers "${dst}")
+
+set(dst "${CMAKE_BINARY_DIR}/include/c++/v1/${dstdir}/${fpath}")
+add_custom_command(OUTPUT ${dst}
+DEPENDS ${src}
+COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
+COMMENT "Copying C++ ABI header ${fpath}...")
+list(APPEND abilib_headers "${dst}")
+
 if (LIBCXX_INSTALL_HEADERS)
   install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
 DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1/${dstdir}
 COMPONENT cxx-headers
 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
 )
 endif()
-list(APPEND abilib_headers "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}")
   endif()
 endforeach()
 if (NOT found)
   message(WARNING "Failed to find ${fpath}")
 endif()
   endforeach()
 
   include_directories("${LIBCXX_BINARY_INCLUDE_DIR}")
+  add_custom_target(cxx-abi-headers ALL DEPENDS ${abilib_headers})
 endmacro()
 
 
Index: libcxx/trunk/lib/CMakeLists.txt
===
--- libcxx/trunk/lib/CMakeLists.txt
+++ libcxx/trunk/lib/CMakeLists.txt
@@ -283,7 +283,8 @@
 endif()
 
 # Add a meta-target for both libraries.
-add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS} ${generated_config_deps})
+add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS})
+add_dependencies(cxx cxx-headers)
 
 if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
   file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp)
Index: libcxx/trunk/NOTES.TXT
===
--- libcxx/trunk/NOTES.TXT
+++ libcxx/trunk/NOTES.TXT
@@ -26,3 +26,4 @@
 1. Add a test under `test/libcxx` that the header defines `_LIBCPP_VERSION`.
 2. Update `test/libcxx/double_include.sh.cpp` to include the new header.
 3. Create a submodule in `include/module.modulemap` for the new header.
+4. Update the include/CMakeLists.txt file to include the new header.
Index: libcxx/trunk/include/CMakeLists.txt
===
--- libcxx/trunk/include/CMakeLists.txt
+++ libcxx/trunk/include/CMakeLists.txt
@@ -1,5 +1,183 @@
-if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
-  set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
+set(files
+  __bit_reference
+  __bsd_locale_defaults.h
+  __bsd_locale_fallbacks.h
+  __debug
+  __functional_03
+  __functional_base
+  __functional_base_03
+  __hash_table
+  __libcpp_version
+  __locale
+  __mutex_base
+  __nullptr
+  __split_buffer
+  __sso_allocator
+  __std_stream
+  __string
+  __threading_support
+  __tree
+  __tuple
+  __undef_macros
+  algorithm
+  any
+  array
+  atomic
+  bitset
+  cassert
+  ccomplex
+  cctype
+  cerrno
+  cfenv
+  cfloat
+  chrono
+  cinttypes
+  ciso646
+  climits
+  clocale
+  cmath
+  codecvt
+  compare
+  complex
+  complex.h
+  condition_variable
+  csetjmp
+  csignal
+  cstdarg
+  cstdbool
+  cstddef
+  cstdint
+  cstdio
+  cstdlib
+  cstring
+  ctgmath
+  ctime
+  ctype.h
+  cwchar
+  cwctype
+  deque
+  errno.h
+  exception
+  experimental/__config
+  experimental/__memory
+  experimental/algorithm
+  experimental/any
+  experimental/chrono
+  experimental/coroutine
+  experimental/deque
+  experimental/dynarray
+  experimental/filesystem
+  experimental/forward_list
+  experimental/functional
+  experimental/iterator
+  experimental/list
+  experimental/map
+  experimental/memory_resource
+  experimental/numeric
+  

[PATCH] D44773: [CMake] Use custom command and target to install libc++ headers

2018-04-08 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 141580.

Repository:
  rCXX libc++

https://reviews.llvm.org/D44773

Files:
  libcxx/NOTES.TXT
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt
  libcxx/lib/CMakeLists.txt

Index: libcxx/lib/CMakeLists.txt
===
--- libcxx/lib/CMakeLists.txt
+++ libcxx/lib/CMakeLists.txt
@@ -283,7 +283,8 @@
 endif()
 
 # Add a meta-target for both libraries.
-add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS} ${generated_config_deps})
+add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS})
+add_dependencies(cxx cxx-headers)
 
 if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
   file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp)
Index: libcxx/include/CMakeLists.txt
===
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -1,5 +1,183 @@
-if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
-  set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
+set(files
+  __bit_reference
+  __bsd_locale_defaults.h
+  __bsd_locale_fallbacks.h
+  __debug
+  __functional_03
+  __functional_base
+  __functional_base_03
+  __hash_table
+  __libcpp_version
+  __locale
+  __mutex_base
+  __nullptr
+  __split_buffer
+  __sso_allocator
+  __std_stream
+  __string
+  __threading_support
+  __tree
+  __tuple
+  __undef_macros
+  algorithm
+  any
+  array
+  atomic
+  bitset
+  cassert
+  ccomplex
+  cctype
+  cerrno
+  cfenv
+  cfloat
+  chrono
+  cinttypes
+  ciso646
+  climits
+  clocale
+  cmath
+  codecvt
+  compare
+  complex
+  complex.h
+  condition_variable
+  csetjmp
+  csignal
+  cstdarg
+  cstdbool
+  cstddef
+  cstdint
+  cstdio
+  cstdlib
+  cstring
+  ctgmath
+  ctime
+  ctype.h
+  cwchar
+  cwctype
+  deque
+  errno.h
+  exception
+  experimental/__config
+  experimental/__memory
+  experimental/algorithm
+  experimental/any
+  experimental/chrono
+  experimental/coroutine
+  experimental/deque
+  experimental/dynarray
+  experimental/filesystem
+  experimental/forward_list
+  experimental/functional
+  experimental/iterator
+  experimental/list
+  experimental/map
+  experimental/memory_resource
+  experimental/numeric
+  experimental/optional
+  experimental/propagate_const
+  experimental/ratio
+  experimental/regex
+  experimental/set
+  experimental/string
+  experimental/string_view
+  experimental/system_error
+  experimental/tuple
+  experimental/type_traits
+  experimental/unordered_map
+  experimental/unordered_set
+  experimental/utility
+  experimental/vector
+  ext/__hash
+  ext/hash_map
+  ext/hash_set
+  float.h
+  forward_list
+  fstream
+  functional
+  future
+  initializer_list
+  inttypes.h
+  iomanip
+  ios
+  iosfwd
+  iostream
+  istream
+  iterator
+  limits
+  limits.h
+  list
+  locale
+  locale.h
+  map
+  math.h
+  memory
+  module.modulemap
+  mutex
+  new
+  numeric
+  optional
+  ostream
+  queue
+  random
+  ratio
+  regex
+  scoped_allocator
+  set
+  setjmp.h
+  shared_mutex
+  sstream
+  stack
+  stdbool.h
+  stddef.h
+  stdexcept
+  stdint.h
+  stdio.h
+  stdlib.h
+  streambuf
+  string
+  string.h
+  string_view
+  strstream
+  system_error
+  tgmath.h
+  thread
+  tuple
+  type_traits
+  typeindex
+  typeinfo
+  unordered_map
+  unordered_set
+  utility
+  valarray
+  variant
+  vector
+  version
+  wchar.h
+  wctype.h
+  )
+
+if(LIBCXX_INSTALL_SUPPORT_HEADERS)
+  set(files
+${files}
+support/android/locale_bionic.h
+support/fuchsia/xlocale.h
+support/ibm/limits.h
+support/ibm/locale_mgmt_aix.h
+support/ibm/support.h
+support/ibm/xlocale.h
+support/musl/xlocale.h
+support/newlib/xlocale.h
+support/solaris/floatingpoint.h
+support/solaris/wchar.h
+support/solaris/xlocale.h
+support/win32/limits_msvc_win32.h
+support/win32/locale_win32.h
+support/xlocale/__nop_locale_mgmt.h
+support/xlocale/__posix_l_fallback.h
+support/xlocale/__strtonum_fallback.h
+support/xlocale/xlocale.h
+)
 endif()
 
 if (LIBCXX_NEEDS_SITE_CONFIG)
@@ -14,44 +192,56 @@
 ${LIBCXX_BINARY_DIR}/__config_site
   )
   # Add a target that executes the generation commands.
-  add_custom_target(generate_config_header ALL
+  add_custom_target(cxx-generated-config ALL
 DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
-  set(generated_config_deps generate_config_header)
+  set(generated_config_deps cxx-generated-config)
+else()
+  set(files
+${files}
+__config
+)
 endif()
 
-set(LIBCXX_HEADER_PATTERN
-  PATTERN "*"
-  PATTERN "CMakeLists.txt" EXCLUDE
-  PATTERN ".svn" EXCLUDE
-  PATTERN "__config_site.in" EXCLUDE
-  ${LIBCXX_SUPPORT_HEADER_PATTERN}
-  )
-
 if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
-  file(COPY .
-DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1"
-FILES_MATCHING
-${LIBCXX_HEADER_PATTERN}
-)
+  set(output_dir ${LLVM_BINARY_DIR}/include/c++/v1)
+
+  set(out_files)
+  foreach(f ${files})
+set(src 

[PATCH] D44773: [CMake] Use custom command and target to install libc++ headers

2018-04-08 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

There are a couple of new headers, `` and `` that should be 
added to the list before committing.


Repository:
  rCXX libc++

https://reviews.llvm.org/D44773



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


[PATCH] D44773: [CMake] Use custom command and target to install libc++ headers

2018-04-06 Thread Petr Hosek via Phabricator via cfe-commits
phosek updated this revision to Diff 141442.
phosek marked an inline comment as done.

Repository:
  rCXX libc++

https://reviews.llvm.org/D44773

Files:
  libcxx/NOTES.TXT
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt
  libcxx/lib/CMakeLists.txt

Index: libcxx/lib/CMakeLists.txt
===
--- libcxx/lib/CMakeLists.txt
+++ libcxx/lib/CMakeLists.txt
@@ -283,7 +283,8 @@
 endif()
 
 # Add a meta-target for both libraries.
-add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS} ${generated_config_deps})
+add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS})
+add_dependencies(cxx cxx-headers)
 
 if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
   file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp)
Index: libcxx/include/CMakeLists.txt
===
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -1,5 +1,181 @@
-if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
-  set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
+set(files
+  __bit_reference
+  __bsd_locale_defaults.h
+  __bsd_locale_fallbacks.h
+  __debug
+  __functional_03
+  __functional_base
+  __functional_base_03
+  __hash_table
+  __libcpp_version
+  __locale
+  __mutex_base
+  __nullptr
+  __split_buffer
+  __sso_allocator
+  __std_stream
+  __string
+  __threading_support
+  __tree
+  __tuple
+  __undef_macros
+  algorithm
+  any
+  array
+  atomic
+  bitset
+  cassert
+  ccomplex
+  cctype
+  cerrno
+  cfenv
+  cfloat
+  chrono
+  cinttypes
+  ciso646
+  climits
+  clocale
+  cmath
+  codecvt
+  complex
+  complex.h
+  condition_variable
+  csetjmp
+  csignal
+  cstdarg
+  cstdbool
+  cstddef
+  cstdint
+  cstdio
+  cstdlib
+  cstring
+  ctgmath
+  ctime
+  ctype.h
+  cwchar
+  cwctype
+  deque
+  errno.h
+  exception
+  experimental/__config
+  experimental/__memory
+  experimental/algorithm
+  experimental/any
+  experimental/chrono
+  experimental/coroutine
+  experimental/deque
+  experimental/dynarray
+  experimental/filesystem
+  experimental/forward_list
+  experimental/functional
+  experimental/iterator
+  experimental/list
+  experimental/map
+  experimental/memory_resource
+  experimental/numeric
+  experimental/optional
+  experimental/propagate_const
+  experimental/ratio
+  experimental/regex
+  experimental/set
+  experimental/string
+  experimental/string_view
+  experimental/system_error
+  experimental/tuple
+  experimental/type_traits
+  experimental/unordered_map
+  experimental/unordered_set
+  experimental/utility
+  experimental/vector
+  ext/__hash
+  ext/hash_map
+  ext/hash_set
+  float.h
+  forward_list
+  fstream
+  functional
+  future
+  initializer_list
+  inttypes.h
+  iomanip
+  ios
+  iosfwd
+  iostream
+  istream
+  iterator
+  limits
+  limits.h
+  list
+  locale
+  locale.h
+  map
+  math.h
+  memory
+  module.modulemap
+  mutex
+  new
+  numeric
+  optional
+  ostream
+  queue
+  random
+  ratio
+  regex
+  scoped_allocator
+  set
+  setjmp.h
+  shared_mutex
+  sstream
+  stack
+  stdbool.h
+  stddef.h
+  stdexcept
+  stdint.h
+  stdio.h
+  stdlib.h
+  streambuf
+  string
+  string.h
+  string_view
+  strstream
+  system_error
+  tgmath.h
+  thread
+  tuple
+  type_traits
+  typeindex
+  typeinfo
+  unordered_map
+  unordered_set
+  utility
+  valarray
+  variant
+  vector
+  wchar.h
+  wctype.h
+  )
+
+if(LIBCXX_INSTALL_SUPPORT_HEADERS)
+  set(files
+${files}
+support/android/locale_bionic.h
+support/fuchsia/xlocale.h
+support/ibm/limits.h
+support/ibm/locale_mgmt_aix.h
+support/ibm/support.h
+support/ibm/xlocale.h
+support/musl/xlocale.h
+support/newlib/xlocale.h
+support/solaris/floatingpoint.h
+support/solaris/wchar.h
+support/solaris/xlocale.h
+support/win32/limits_msvc_win32.h
+support/win32/locale_win32.h
+support/xlocale/__nop_locale_mgmt.h
+support/xlocale/__posix_l_fallback.h
+support/xlocale/__strtonum_fallback.h
+support/xlocale/xlocale.h
+)
 endif()
 
 if (LIBCXX_NEEDS_SITE_CONFIG)
@@ -14,44 +190,56 @@
 ${LIBCXX_BINARY_DIR}/__config_site
   )
   # Add a target that executes the generation commands.
-  add_custom_target(generate_config_header ALL
+  add_custom_target(cxx-generated-config ALL
 DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
-  set(generated_config_deps generate_config_header)
+  set(generated_config_deps cxx-generated-config)
+else()
+  set(files
+${files}
+__config
+)
 endif()
 
-set(LIBCXX_HEADER_PATTERN
-  PATTERN "*"
-  PATTERN "CMakeLists.txt" EXCLUDE
-  PATTERN ".svn" EXCLUDE
-  PATTERN "__config_site.in" EXCLUDE
-  ${LIBCXX_SUPPORT_HEADER_PATTERN}
-  )
-
 if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
-  file(COPY .
-DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1"
-FILES_MATCHING
-${LIBCXX_HEADER_PATTERN}
-)
+  set(output_dir ${LLVM_BINARY_DIR}/include/c++/v1)
+
+  set(out_files)
+  foreach(f 

[PATCH] D44773: [CMake] Use custom command and target to install libc++ headers

2018-04-03 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

This LGTM modulo requested changes.

There's a section in `NOTES.TXT` about the steps required for adding a header. 
Please update that to mention listing it in CMake.




Comment at: libcxx/include/CMakeLists.txt:151
+
+if(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
+  set(files

We still want to install the experimental headers even if the experimental 
library build isn't enabled. Header only components still function. 


Repository:
  rCXX libc++

https://reviews.llvm.org/D44773



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


[PATCH] D44773: [CMake] Use custom command and target to install libc++ headers

2018-04-02 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment.

ping


Repository:
  rCXX libc++

https://reviews.llvm.org/D44773



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


[PATCH] D44773: [CMake] Use custom command and target to install libc++ headers

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

This changes has already revealed some missing libc++ dependencies in 
sanitizers which were masked by the use of `file(COPY FILE...)`.


Repository:
  rCXX libc++

https://reviews.llvm.org/D44773



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


[PATCH] D44773: [CMake] Use custom command and target to install libc++ headers

2018-03-22 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added reviewers: EricWF, beanz.
Herald added subscribers: cfe-commits, christof, fedor.sergeev, mgorny, srhines.

Using file(COPY FILE...) has several downsides. Since the file command
is only executed at configuration time, any changes to headers made
after the initial CMake execution are ignored. This can lead to subtle
errors since the just built Clang will be using stale libc++ headers.
Furthermore, since the headers are copied prior to executing the build
system, this may hide missing dependencies on libc++ from other LLVM
components.

This changes replaces the use of file(COPY FILE...) command with a
custom command and target which addresses all aforementioned issues and
matches the implementation already used by other LLVM components that
also install headers like Clang builtin headers.


Repository:
  rCXX libc++

https://reviews.llvm.org/D44773

Files:
  libcxx/cmake/Modules/HandleLibCXXABI.cmake
  libcxx/include/CMakeLists.txt
  libcxx/lib/CMakeLists.txt

Index: libcxx/lib/CMakeLists.txt
===
--- libcxx/lib/CMakeLists.txt
+++ libcxx/lib/CMakeLists.txt
@@ -283,7 +283,8 @@
 endif()
 
 # Add a meta-target for both libraries.
-add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS} ${generated_config_deps})
+add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS})
+add_dependencies(cxx cxx-headers)
 
 if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
   file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp)
Index: libcxx/include/CMakeLists.txt
===
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -1,5 +1,187 @@
-if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
-  set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
+set(files
+  cfenv
+  array
+  sstream
+  csetjmp
+  cwchar
+  algorithm
+  string_view
+  cstdint
+  utility
+  __split_buffer
+  ext/hash_map
+  ext/hash_set
+  ext/__hash
+  functional
+  initializer_list
+  ciso646
+  cstdio
+  cstdarg
+  math.h
+  string
+  type_traits
+  __functional_base_03
+  iostream
+  unordered_map
+  queue
+  variant
+  cstring
+  ratio
+  cinttypes
+  system_error
+  __tree
+  stdio.h
+  __locale
+  __tuple
+  wchar.h
+  __functional_03
+  __bsd_locale_defaults.h
+  condition_variable
+  stdlib.h
+  cassert
+  limits
+  limits.h
+  module.modulemap
+  list
+  cfloat
+  vector
+  chrono
+  __bit_reference
+  new
+  typeinfo
+  any
+  cerrno
+  thread
+  cmath
+  cctype
+  memory
+  scoped_allocator
+  ios
+  map
+  valarray
+  cstdbool
+  ccomplex
+  __hash_table
+  csignal
+  clocale
+  forward_list
+  __mutex_base
+  climits
+  future
+  tuple
+  __threading_support
+  __bsd_locale_fallbacks.h
+  strstream
+  locale.h
+  set
+  ctime
+  stdexcept
+  streambuf
+  string.h
+  optional
+  float.h
+  wctype.h
+  complex.h
+  setjmp.h
+  __nullptr
+  inttypes.h
+  iterator
+  codecvt
+  stack
+  stdint.h
+  ctype.h
+  random
+  cstdlib
+  istream
+  numeric
+  regex
+  __string
+  errno.h
+  cstddef
+  __functional_base
+  cwctype
+  __undef_macros
+  fstream
+  tgmath.h
+  deque
+  unordered_set
+  complex
+  typeindex
+  mutex
+  stddef.h
+  iomanip
+  iosfwd
+  ostream
+  __std_stream
+  __debug
+  locale
+  ctgmath
+  bitset
+  __libcpp_version
+  stdbool.h
+  __sso_allocator
+  shared_mutex
+  atomic
+  exception
+  )
+
+if(LIBCXX_INSTALL_SUPPORT_HEADERS)
+  set(files
+${files}
+support/solaris/wchar.h
+support/solaris/floatingpoint.h
+support/solaris/xlocale.h
+support/fuchsia/xlocale.h
+support/xlocale/__posix_l_fallback.h
+support/xlocale/__strtonum_fallback.h
+support/xlocale/__nop_locale_mgmt.h
+support/xlocale/xlocale.h
+support/ibm/locale_mgmt_aix.h
+support/ibm/limits.h
+support/ibm/support.h
+support/ibm/xlocale.h
+support/android/locale_bionic.h
+support/musl/xlocale.h
+support/win32/locale_win32.h
+support/win32/limits_msvc_win32.h
+support/newlib/xlocale.h
+)
+endif()
+
+if(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
+  set(files
+${files}
+experimental/__config
+experimental/dynarray
+experimental/algorithm
+experimental/string_view
+experimental/utility
+experimental/functional
+experimental/string
+experimental/type_traits
+experimental/propagate_const
+experimental/unordered_map
+experimental/ratio
+experimental/system_error
+experimental/filesystem
+experimental/__memory
+experimental/list
+experimental/vector
+experimental/chrono
+experimental/any
+experimental/memory_resource
+experimental/map
+experimental/forward_list
+experimental/tuple
+experimental/set
+experimental/coroutine
+experimental/optional
+experimental/iterator
+experimental/numeric
+experimental/regex
+experimental/deque
+experimental/unordered_set
+)
 endif()
 
 if (LIBCXX_NEEDS_SITE_CONFIG)
@@ -17,39 +199,48 @@