Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: build/config/compiler/BUILD.gn

Issue 691783003: [WIP NOT FOR COMMIT] Switch Android to libc++ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 import("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 if (cpu_arch == "arm") { 6 if (cpu_arch == "arm") {
7 import("//build/config/arm.gni") 7 import("//build/config/arm.gni")
8 } 8 }
9 if (is_posix) { 9 if (is_posix) {
10 import("//build/config/gcc/gcc_version.gni") 10 import("//build/config/gcc/gcc_version.gni")
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 defines += [ 445 defines += [
446 "__STD_C", 446 "__STD_C",
447 "__STDC_CONSTANT_MACROS", 447 "__STDC_CONSTANT_MACROS",
448 "__STDC_FORMAT_MACROS", 448 "__STDC_FORMAT_MACROS",
449 "_CRT_RAND_S", 449 "_CRT_RAND_S",
450 "_CRT_SECURE_NO_DEPRECATE", 450 "_CRT_SECURE_NO_DEPRECATE",
451 "_SCL_SECURE_NO_DEPRECATE", 451 "_SCL_SECURE_NO_DEPRECATE",
452 ] 452 ]
453 } 453 }
454 454
455 # Stlport setup. Android uses a different (smaller) version of the STL. 455 # Android setup.
456 if (is_android) { 456 if (is_android) {
457 if (is_clang) { 457 if (is_clang) {
458 # Work around incompatibilities between bionic and clang headers. 458 # Work around incompatibilities between bionic and clang headers.
459 defines += [ 459 defines += [
460 "__compiler_offsetof=__builtin_offsetof", 460 "__compiler_offsetof=__builtin_offsetof",
461 "nan=__builtin_nan", 461 "nan=__builtin_nan",
462 ] 462 ]
463 } 463 }
464 464
465 defines += [ 465 defines += [ "__GNU_SOURCE=1" ] # Necessary for clone().
466 "USE_STLPORT=1",
467 "_STLP_USE_PTR_SPECIALIZATIONS=1",
468 "__GNU_SOURCE=1", # Necessary for clone().
469 ]
470 466
471 ldflags += [ 467 ldflags += [
472 "-Wl,--warn-shared-textrel", 468 "-Wl,--warn-shared-textrel",
473 "-nostdlib", 469 "-nostdlib",
474 ] 470 ]
475 471
476 # NOTE: The stlport header include paths below are specified in cflags 472 # Libc++ setup.
477 # rather than include_dirs because they need to come after include_dirs. 473 android_libcpp_root = "$android_ndk_root/sources/cxx-stl/llvm-libc++"
478 # Think of them like system headers, but don't use '-isystem' because the
479 # arm-linux-androideabi-4.4.3 toolchain (circa Gingerbread) will exhibit
480 # strange errors. The include ordering here is important; change with
481 # caution.
482 android_stlport_root = "$android_ndk_root/sources/cxx-stl/stlport"
483 474
484 cflags += [ 475 cflags += [
485 "-isystem" + rebase_path("$android_stlport_root/stlport", 476 "-isystem" + rebase_path("$android_libcpp_root/libcxx/include",
486 root_build_dir) 477 root_build_dir),
478 "-isystem" + rebase_path("$android_ndk_root/sources/cxx-stl/llvm-libc++abi /libcxxabi/include",
479 root_build_dir),
480 "-isystem" + rebase_path("$android_ndk_root/sources/android/support/includ e",
481 root_build_dir),
487 ] 482 ]
488 if (arm_use_thumb) { 483 if (arm_use_thumb) {
489 lib_dirs += [ "$android_stlport_root/libs/$android_app_abi/thumb" ] 484 lib_dirs += [ "$android_libcpp_root/libs/$android_app_abi/thumb" ]
490 } else { 485 } else {
491 lib_dirs += [ "$android_stlport_root/libs/$android_app_abi" ] 486 lib_dirs += [ "$android_libcpp_root/libs/$android_app_abi" ]
492 } 487 }
493 488
494 if (component_mode == "shared_library") { 489 lib_dirs += [ "$android_libcpp_root/libs/$android_app_abi" ]
495 libs += [ "stlport_shared" ]
496 } else {
497 libs += [ "stlport_static" ]
498 }
499
500 if (cpu_arch == "mipsel") {
501 libs += [
502 # ld linker is used for mips Android, and ld does not accept library
503 # absolute path prefixed by "-l"; Since libgcc does not exist in mips
504 # sysroot the proper library will be linked.
505 # TODO(gordanac): Remove once gold linker is used for mips Android.
506 "gcc",
507 ]
508 } else {
509 libs += [
510 # Manually link the libgcc.a that the cross compiler uses. This is
511 # absolute because the linker will look inside the sysroot if it's not.
512 rebase_path(android_libgcc_file),
513 ]
514 }
515
516 libs += [ 490 libs += [
491 "$android_libcpp_library",
492 "atomic",
493 # Manually link the libgcc.a that the cross compiler uses. This is
494 # absolute because the linker will look inside the sysroot if it's not.
495 rebase_path(android_libgcc_file),
496 "m",
517 "c", 497 "c",
518 "dl", 498 "dl",
519 "m",
520 ] 499 ]
521 500
522 } 501 }
523 } 502 }
524 503
525 # chromium_code --------------------------------------------------------------- 504 # chromium_code ---------------------------------------------------------------
526 # 505 #
527 # Toggles between higher and lower warnings for code that is (or isn't) 506 # Toggles between higher and lower warnings for code that is (or isn't)
528 # part of Chromium. 507 # part of Chromium.
529 508
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 cflags += [ "-gsplit-dwarf" ] 950 cflags += [ "-gsplit-dwarf" ]
972 } 951 }
973 } 952 }
974 } 953 }
975 954
976 config("no_symbols") { 955 config("no_symbols") {
977 if (!is_win) { 956 if (!is_win) {
978 cflags = [ "-g0" ] 957 cflags = [ "-g0" ]
979 } 958 }
980 } 959 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698