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

Unified Diff: build/config/android/BUILD.gn

Issue 1368263002: Separate out compiler and runtime configs on Windows and Android GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/config/android/config.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/android/BUILD.gn
diff --git a/build/config/android/BUILD.gn b/build/config/android/BUILD.gn
index 6f9258f8d8043aca0f68764131b94bfa38c48e1b..0514b43e73b308e967227404bad6e1cccb44822f 100644
--- a/build/config/android/BUILD.gn
+++ b/build/config/android/BUILD.gn
@@ -8,32 +8,6 @@ import("//build/config/sysroot.gni")
assert(is_android)
-config("sdk") {
- if (sysroot != "") {
- cflags = [ "--sysroot=" + sysroot ]
- ldflags = [ "--sysroot=" + sysroot ]
-
- # Need to get some linker flags out of the sysroot.
- sysroot_ld_path = rebase_path("//build/config/linux/sysroot_ld_path.py")
- ldflags += [ exec_script(sysroot_ld_path,
- [
- rebase_path("//build/linux/sysroot_ld_path.sh"),
- sysroot,
- ],
- "value") ]
- }
-}
-
-config("executable_config") {
- cflags = [ "-fPIE" ]
- ldflags = [ "-pie" ]
-}
-
-config("hide_native_jni_exports") {
- ldflags = [ "-Wl,--version-script=" +
- rebase_path("//build/android/android_no_jni_exports.lst") ]
-}
-
# This is included by reference in the //build/config/compiler config that
# is applied to all targets. It is here to separate out the logic that is
# Android-only.
@@ -142,3 +116,103 @@ config("compiler") {
]
}
}
+
+# This is included by reference in the //build/config/compiler:runtime_library
+# config that is applied to all targets. It is here to separate out the logic
+# that is Android-only. Please see that target for advice on what should go in
+# :runtime_library vs. :compiler.
+config("runtime_library") {
+ # NOTE: The libc++ header include paths below are specified in cflags
+ # rather than include_dirs because they need to come after include_dirs.
+ # Think of them like system headers, but don't use '-isystem' because the
+ # arm-linux-androideabi-4.4.3 toolchain (circa Gingerbread) will exhibit
+ # strange errors. The include ordering here is important; change with
+ # caution.
+ cflags = [
+ "-isystem" +
+ rebase_path("$android_libcpp_root/libcxx/include", root_build_dir),
+ "-isystem" + rebase_path(
+ "$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/include",
+ root_build_dir),
+ "-isystem" +
+ rebase_path("$android_ndk_root/sources/android/support/include",
+ root_build_dir),
+ ]
+
+ defines = [ "__GNU_SOURCE=1" ] # Necessary for clone().
+ ldflags = [ "-nostdlib" ]
+ lib_dirs = [ "$android_libcpp_root/libs/$android_app_abi" ]
+ libs = [
+ "c",
+ "dl",
+ "m",
+ ]
+
+ # The libc++ runtime library.
+ if (is_component_build) {
+ libs += [ "c++_shared" ]
+ } else {
+ libs += [ "c++_static" ]
+ }
+
+ if (is_clang) {
+ # Work around incompatibilities between bionic and clang headers.
+ defines += [
+ "__compiler_offsetof=__builtin_offsetof",
+ "nan=__builtin_nan",
+ ]
+ }
+
+ # TODO(jdduke) Re-enable on mips after resolving linking
+ # issues with libc++ (crbug.com/456380).
+ if (current_cpu != "mipsel" && current_cpu != "mips64el") {
+ ldflags += [ "-Wl,--warn-shared-textrel" ]
+ }
+
+ if (current_cpu == "mipsel") {
+ libs += [
+ # ld linker is used for mips Android, and ld does not accept library
+ # absolute path prefixed by "-l"; Since libgcc does not exist in mips
+ # sysroot the proper library will be linked.
+ # TODO(gordanac): Remove once gold linker is used for mips Android.
+ "gcc",
+ ]
+ } else {
+ libs += [
+ # Manually link the libgcc.a that the cross compiler uses. This is
+ # absolute because the linker will look inside the sysroot if it's not.
+ rebase_path(android_libgcc_file),
+ ]
+ }
+
+ # Clang with libc++ does not require an explicit atomic library reference.
+ if (!is_clang) {
+ libs += [ "atomic" ]
+ }
+}
+
+config("sdk") {
+ if (sysroot != "") {
+ cflags = [ "--sysroot=" + sysroot ]
+ ldflags = [ "--sysroot=" + sysroot ]
+
+ # Need to get some linker flags out of the sysroot.
+ sysroot_ld_path = rebase_path("//build/config/linux/sysroot_ld_path.py")
+ ldflags += [ exec_script(sysroot_ld_path,
+ [
+ rebase_path("//build/linux/sysroot_ld_path.sh"),
+ sysroot,
+ ],
+ "value") ]
+ }
+}
+
+config("executable_config") {
+ cflags = [ "-fPIE" ]
+ ldflags = [ "-pie" ]
+}
+
+config("hide_native_jni_exports") {
+ ldflags = [ "-Wl,--version-script=" +
+ rebase_path("//build/android/android_no_jni_exports.lst") ]
+}
« no previous file with comments | « no previous file | build/config/android/config.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698