summaryrefslogtreecommitdiff
path: root/include/CMakeLists.txt
blob: a45b80160ecbbdf54e3c12416ed2a946c6468f64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
set(files
  __bit_reference
  __bsd_locale_defaults.h
  __bsd_locale_fallbacks.h
  __errc
  __debug
  __functional_03
  __functional_base
  __functional_base_03
  __hash_table
  __libcpp_version
  __locale
  __mutex_base
  __node_handle
  __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/simd
  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
  filesystem
  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
  span
  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)
  # 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(cxx-generated-config ALL
    DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
  set(generated_config_deps cxx-generated-config)
else()
  set(files
    ${files}
    __config
    )
endif()

if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR)
  set(output_dir ${LIBCXX_HEADER_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 CXX header ${f}")
    list(APPEND out_files ${dst})
  endforeach()

  if (LIBCXX_NEEDS_SITE_CONFIG)
    # Copy the generated header as __config into build directory.
    set(src ${LIBCXX_BINARY_DIR}/__generated_config)
    set(dst ${output_dir}/__config)
    add_custom_command(OUTPUT ${dst}
        DEPENDS ${src} ${generated_config_deps}
        COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
        COMMENT "Copying CXX __config")
    list(APPEND out_files ${dst})
  endif()

  add_custom_target(cxx-headers ALL DEPENDS ${out_files} ${LIBCXX_CXX_ABI_HEADER_TARGET})
else()
  add_custom_target(cxx-headers)
endif()
set_target_properties(cxx-headers PROPERTIES FOLDER "Misc")

if (LIBCXX_INSTALL_HEADERS)
  foreach(file ${files})
    get_filename_component(dir ${file} DIRECTORY)
    install(FILES ${file}
      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir}
      COMPONENT cxx-headers
      PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
    )
  endforeach()

  if (LIBCXX_NEEDS_SITE_CONFIG)
    # Install the generated header as __config.
    install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
      DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1
      PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
      RENAME __config
      COMPONENT cxx-headers)
  endif()

  if (NOT CMAKE_CONFIGURATION_TYPES)
    add_custom_target(install-cxx-headers
                      DEPENDS cxx-headers ${generated_config_deps}
                      COMMAND "${CMAKE_COMMAND}"
                              -DCMAKE_INSTALL_COMPONENT=cxx-headers
                              -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
    # Stripping is a no-op for headers
    add_custom_target(install-cxx-headers-stripped DEPENDS install-cxx-headers)

    add_custom_target(install-libcxx-headers DEPENDS install-cxx-headers)
    add_custom_target(install-libcxx-headers-stripped DEPENDS install-cxx-headers-stripped)
  endif()
endif()