OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Define the sysroot directory. | 5 # Define the sysroot directory. |
6 sysroot = "$root_out_dir/sysroot" | 6 sysroot = "$root_out_dir/sysroot" |
7 sysroot_lib_dir = "${sysroot}/usr/lib" | 7 sysroot_lib_dir = "${sysroot}/usr/lib" |
8 sysroot_include_dir = "${sysroot}/usr/include" | 8 sysroot_include_dir = "${sysroot}/usr/include" |
9 | 9 |
10 config("fusl_config") { | 10 config("fusl_config") { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 group("copy_sysroot") { | 147 group("copy_sysroot") { |
148 deps = [ | 148 deps = [ |
149 ":copy_include", | 149 ":copy_include", |
150 ":copy_include_bits", | 150 ":copy_include_bits", |
151 ":copy_libs", | 151 ":copy_libs", |
152 "crt:copy_crt_objects", | 152 "crt:copy_crt_objects", |
153 ] | 153 ] |
154 } | 154 } |
155 | 155 |
156 config("sysroot_config") { | 156 copy("copy_libcxx") { |
| 157 sources = [ |
| 158 "${target_out_dir}/../third_party/libcxx/libcxx.a", |
| 159 ] |
| 160 outputs = [ |
| 161 "${sysroot_lib_dir}/libc++.a", |
| 162 ] |
| 163 deps = [ |
| 164 "//third_party/libcxx:libcxx", |
| 165 ] |
| 166 } |
| 167 |
| 168 action("copy_libcxx_headers") { |
| 169 script = "tools/copy_libcxx_headers.py" |
| 170 |
| 171 deps = [ |
| 172 ":copy_sysroot", |
| 173 ] |
| 174 |
| 175 source_dir = "//third_party/libcxx/libcxx/include" |
| 176 |
| 177 # Annoyingly, this has to be ".../c++/v1" for clang to automatically |
| 178 # add it to the includes. |
| 179 target_dir = "${sysroot_include_dir}/c++/v1" |
| 180 |
| 181 args = [ |
| 182 rebase_path(source_dir), |
| 183 rebase_path(target_dir), |
| 184 ] |
| 185 |
| 186 outputs = [ |
| 187 "${target_dir}/__bit_reference", |
| 188 "${target_dir}/__config", |
| 189 "${target_dir}/__config_site.in", |
| 190 "${target_dir}/__debug", |
| 191 "${target_dir}/__functional_03", |
| 192 "${target_dir}/__functional_base", |
| 193 "${target_dir}/__functional_base_03", |
| 194 "${target_dir}/__hash_table", |
| 195 "${target_dir}/__locale", |
| 196 "${target_dir}/__mutex_base", |
| 197 "${target_dir}/__nullptr", |
| 198 "${target_dir}/__refstring", |
| 199 "${target_dir}/__split_buffer", |
| 200 "${target_dir}/__sso_allocator", |
| 201 "${target_dir}/__std_stream", |
| 202 "${target_dir}/__tree", |
| 203 "${target_dir}/__tuple", |
| 204 "${target_dir}/__undef___deallocate", |
| 205 "${target_dir}/__undef_min_max", |
| 206 "${target_dir}/algorithm", |
| 207 "${target_dir}/array", |
| 208 "${target_dir}/atomic", |
| 209 "${target_dir}/bitset", |
| 210 "${target_dir}/cassert", |
| 211 "${target_dir}/ccomplex", |
| 212 "${target_dir}/cctype", |
| 213 "${target_dir}/cerrno", |
| 214 "${target_dir}/cfenv", |
| 215 "${target_dir}/cfloat", |
| 216 "${target_dir}/chrono", |
| 217 "${target_dir}/cinttypes", |
| 218 "${target_dir}/ciso646", |
| 219 "${target_dir}/climits", |
| 220 "${target_dir}/clocale", |
| 221 "${target_dir}/cmath", |
| 222 "${target_dir}/codecvt", |
| 223 "${target_dir}/complex", |
| 224 "${target_dir}/complex.h", |
| 225 "${target_dir}/condition_variable", |
| 226 "${target_dir}/csetjmp", |
| 227 "${target_dir}/csignal", |
| 228 "${target_dir}/cstdarg", |
| 229 "${target_dir}/cstdbool", |
| 230 "${target_dir}/cstddef", |
| 231 "${target_dir}/cstdint", |
| 232 "${target_dir}/cstdio", |
| 233 "${target_dir}/cstdlib", |
| 234 "${target_dir}/cstring", |
| 235 "${target_dir}/ctgmath", |
| 236 "${target_dir}/ctime", |
| 237 "${target_dir}/ctype.h", |
| 238 "${target_dir}/cwchar", |
| 239 "${target_dir}/cwctype", |
| 240 "${target_dir}/deque", |
| 241 "${target_dir}/errno.h", |
| 242 "${target_dir}/exception", |
| 243 "${target_dir}/experimental/__config", |
| 244 "${target_dir}/experimental/algorithm", |
| 245 "${target_dir}/experimental/any", |
| 246 "${target_dir}/experimental/chrono", |
| 247 "${target_dir}/experimental/dynarray", |
| 248 "${target_dir}/experimental/functional", |
| 249 "${target_dir}/experimental/optional", |
| 250 "${target_dir}/experimental/ratio", |
| 251 "${target_dir}/experimental/string_view", |
| 252 "${target_dir}/experimental/system_error", |
| 253 "${target_dir}/experimental/tuple", |
| 254 "${target_dir}/experimental/type_traits", |
| 255 "${target_dir}/experimental/utility", |
| 256 "${target_dir}/ext/__hash", |
| 257 "${target_dir}/ext/hash_map", |
| 258 "${target_dir}/ext/hash_set", |
| 259 "${target_dir}/float.h", |
| 260 "${target_dir}/forward_list", |
| 261 "${target_dir}/fstream", |
| 262 "${target_dir}/functional", |
| 263 "${target_dir}/future", |
| 264 "${target_dir}/initializer_list", |
| 265 "${target_dir}/inttypes.h", |
| 266 "${target_dir}/iomanip", |
| 267 "${target_dir}/ios", |
| 268 "${target_dir}/iosfwd", |
| 269 "${target_dir}/iostream", |
| 270 "${target_dir}/istream", |
| 271 "${target_dir}/iterator", |
| 272 "${target_dir}/limits", |
| 273 "${target_dir}/list", |
| 274 "${target_dir}/locale", |
| 275 "${target_dir}/map", |
| 276 "${target_dir}/math.h", |
| 277 "${target_dir}/memory", |
| 278 "${target_dir}/module.modulemap", |
| 279 "${target_dir}/mutex", |
| 280 "${target_dir}/new", |
| 281 "${target_dir}/numeric", |
| 282 "${target_dir}/ostream", |
| 283 "${target_dir}/queue", |
| 284 "${target_dir}/random", |
| 285 "${target_dir}/ratio", |
| 286 "${target_dir}/regex", |
| 287 "${target_dir}/scoped_allocator", |
| 288 "${target_dir}/set", |
| 289 "${target_dir}/setjmp.h", |
| 290 "${target_dir}/shared_mutex", |
| 291 "${target_dir}/sstream", |
| 292 "${target_dir}/stack", |
| 293 "${target_dir}/stddef.h", |
| 294 "${target_dir}/stdexcept", |
| 295 "${target_dir}/stdio.h", |
| 296 "${target_dir}/stdlib.h", |
| 297 "${target_dir}/streambuf", |
| 298 "${target_dir}/string", |
| 299 "${target_dir}/strstream", |
| 300 "${target_dir}/support/android/locale_bionic.h", |
| 301 "${target_dir}/support/ibm/limits.h", |
| 302 "${target_dir}/support/ibm/support.h", |
| 303 "${target_dir}/support/ibm/xlocale.h", |
| 304 "${target_dir}/support/musl/xlocale.h", |
| 305 "${target_dir}/support/newlib/xlocale.h", |
| 306 "${target_dir}/support/solaris/floatingpoint.h", |
| 307 "${target_dir}/support/solaris/wchar.h", |
| 308 "${target_dir}/support/solaris/xlocale.h", |
| 309 "${target_dir}/support/win32/limits_win32.h", |
| 310 "${target_dir}/support/win32/locale_win32.h", |
| 311 "${target_dir}/support/win32/math_win32.h", |
| 312 "${target_dir}/support/win32/support.h", |
| 313 "${target_dir}/support/xlocale/xlocale.h", |
| 314 "${target_dir}/system_error", |
| 315 "${target_dir}/tgmath.h", |
| 316 "${target_dir}/thread", |
| 317 "${target_dir}/tuple", |
| 318 "${target_dir}/type_traits", |
| 319 "${target_dir}/typeindex", |
| 320 "${target_dir}/typeinfo", |
| 321 "${target_dir}/unordered_map", |
| 322 "${target_dir}/unordered_set", |
| 323 "${target_dir}/utility", |
| 324 "${target_dir}/valarray", |
| 325 "${target_dir}/vector", |
| 326 "${target_dir}/wchar.h", |
| 327 "${target_dir}/wctype.h", |
| 328 ] |
| 329 } |
| 330 |
| 331 config("fusl_sysroot_config") { |
157 rebased_sysroot = rebase_path(sysroot) | 332 rebased_sysroot = rebase_path(sysroot) |
158 | 333 |
159 cflags = [ | 334 cflags = [ |
160 "--sysroot=$rebased_sysroot", | 335 "--sysroot=$rebased_sysroot", |
161 "-fPIC", | 336 "-fPIC", |
162 "-static", | 337 "-static", |
163 ] | 338 ] |
164 | 339 |
| 340 cflags_c = [ "-std=c11" ] |
| 341 |
| 342 cflags_cc = [ |
| 343 "-std=c++11", |
| 344 |
| 345 # Make everyone using our libc++ headers use musl paths rather |
| 346 # than glibc ones. |
| 347 "-D_LIBCPP_HAS_MUSL_LIBC", |
| 348 |
| 349 # This is necessary for clang to get the header search paths right. |
| 350 "-stdlib=libc++", |
| 351 ] |
| 352 |
165 ldflags = [ | 353 ldflags = [ |
166 "--sysroot=$rebased_sysroot", | 354 "--sysroot=$rebased_sysroot", |
167 "-static", | 355 "-static", |
| 356 "-stdlib=libc++", |
| 357 ] |
| 358 } |
| 359 |
| 360 config("fusl_sysroot_config_c") { |
| 361 ldflags = [ |
| 362 # Using clang++ as the linker driver is necessary for libc++ |
| 363 # resolution to work. |
| 364 "-nodefaultlibs", |
| 365 "-lc", |
168 ] | 366 ] |
169 } | 367 } |
170 | 368 |
171 executable("empty_main") { | 369 executable("empty_main") { |
172 configs = [] | 370 configs = [] |
173 configs += [ ":sysroot_config" ] | 371 configs += [ |
| 372 ":fusl_sysroot_config", |
| 373 ":fusl_sysroot_config_c", |
| 374 ] |
174 | 375 |
175 sources = [ | 376 sources = [ |
176 "test/empty_main.c", | 377 "test/empty_main.c", |
177 ] | 378 ] |
178 | 379 |
179 deps = [ | 380 deps = [ |
180 ":copy_sysroot", | 381 ":copy_sysroot", |
181 ] | 382 ] |
182 } | 383 } |
183 | 384 |
| 385 executable("vector") { |
| 386 configs = [] |
| 387 configs += [ ":fusl_sysroot_config" ] |
| 388 |
| 389 sources = [ |
| 390 "test/vector.cc", |
| 391 ] |
| 392 |
| 393 deps = [ |
| 394 ":copy_libcxx", |
| 395 ":copy_libcxx_headers", |
| 396 ] |
| 397 } |
| 398 |
| 399 group("fusl_pre_toolchain") { |
| 400 deps = [ |
| 401 ":copy_sysroot", |
| 402 ":empty_main", |
| 403 ":libc", |
| 404 ":vector", |
| 405 "crt", |
| 406 "//third_party/libcxx:libcxx", |
| 407 ] |
| 408 } |
| 409 |
184 group("fusl") { | 410 group("fusl") { |
185 deps = [ | 411 deps = [ |
186 ":empty_main(//build/toolchain/fusl:fusl_$current_cpu)", | 412 ":fusl_pre_toolchain(//build/toolchain/fusl:fusl_$current_cpu)", |
187 ":libc(//build/toolchain/fusl:fusl_$current_cpu)", | |
188 "crt(//build/toolchain/fusl:fusl_$current_cpu)", | |
189 ] | 413 ] |
190 } | 414 } |
OLD | NEW |