gn2bp: Add -UANDROID for host supported targets
* Base now builds under multi-architectures.
Test: m cronet_aml_base_base
Change-Id: Ia672c79c51763d43258510c5e63eb609e465bfba
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 454cfec..4687c4a 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -202,6 +202,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -257,6 +258,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -918,6 +920,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -1139,6 +1142,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -1438,6 +1442,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -1470,6 +1475,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -1783,6 +1789,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -1815,6 +1822,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -1841,6 +1849,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -1873,6 +1882,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -1909,6 +1919,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -1917,6 +1928,13 @@
"buildtools/third_party/libc++abi/trunk/include",
],
cpp_std: "c++20",
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //base/third_party/xdg_mime:xdg_mime
@@ -1955,6 +1973,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -1963,6 +1982,13 @@
"buildtools/third_party/libc++abi/trunk/include",
],
cpp_std: "c++20",
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //base/third_party/xdg_user_dirs:xdg_user_dirs
@@ -1996,6 +2022,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -2004,6 +2031,13 @@
"buildtools/third_party/libc++abi/trunk/include",
],
cpp_std: "c++20",
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //base:tracing_buildflags
@@ -2494,6 +2528,18 @@
"-fexceptions",
],
rtti: true,
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //components/cronet/android:cronet_jni_headers
@@ -3215,6 +3261,18 @@
"jni_headers",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //crypto:buildflags
@@ -3301,6 +3359,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -3350,6 +3409,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
local_include_dirs: [
"build/linux/debian_bullseye_amd64-sysroot/usr/include/nspr",
@@ -4682,11 +4742,17 @@
srcs: [
"net/disk_cache/blockfile/mapped_file_posix.cc",
],
+ cflags: [
+ "-UANDROID",
+ ],
},
android_x86_64: {
srcs: [
"net/disk_cache/blockfile/mapped_file_bypass_mmap_posix.cc",
],
+ cflags: [
+ "-UANDROID",
+ ],
},
},
}
@@ -4977,6 +5043,18 @@
"third_party/boringssl/src/include/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //net/third_party/quiche:net_quic_proto
@@ -5522,6 +5600,18 @@
"third_party/zlib/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //net/traffic_annotation:traffic_annotation
@@ -5617,6 +5707,18 @@
"third_party/boringssl/src/include/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/abseil-cpp:absl
@@ -7466,6 +7568,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -7499,6 +7602,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -7621,6 +7725,18 @@
"third_party/brotli/include/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/brotli:dec
@@ -7664,6 +7780,18 @@
"third_party/brotli/include/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/brotli:headers
@@ -7946,6 +8074,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -7981,6 +8110,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -8221,6 +8351,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8256,6 +8387,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -8301,6 +8433,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8339,6 +8472,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
local_include_dirs: [
"third_party/libevent/linux/",
@@ -8509,6 +8643,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8541,6 +8676,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -8666,6 +8802,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8676,6 +8813,13 @@
"third_party/zlib/",
],
cpp_std: "c++20",
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/protobuf:protobuf_lite
@@ -8748,6 +8892,18 @@
"third_party/protobuf/src/",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/protobuf:protoc
@@ -8796,6 +8952,7 @@
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"default\")))",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8810,6 +8967,13 @@
"-fexceptions",
],
rtti: true,
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/protobuf:protoc_lib
@@ -8933,6 +9097,7 @@
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-UANDROID",
],
local_include_dirs: [
"./",
@@ -8942,6 +9107,13 @@
"third_party/protobuf/src/",
],
cpp_std: "c++20",
+ target: {
+ host: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //third_party/zlib:zlib
@@ -8994,6 +9166,7 @@
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
+ "-UANDROID",
"-mpclmul",
"-mssse3",
],
@@ -9037,6 +9210,7 @@
"-D_FILE_OFFSET_BITS=64",
"-D_LARGEFILE64_SOURCE",
"-D_LARGEFILE_SOURCE",
+ "-UANDROID",
],
},
},
@@ -9235,6 +9409,18 @@
"jni_headers",
],
cpp_std: "c++20",
+ target: {
+ android_x86: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ android_x86_64: {
+ cflags: [
+ "-UANDROID",
+ ],
+ },
+ },
}
// GN: //url:url_jni_headers
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index fcb7bb3..cf8a4fd 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -132,7 +132,7 @@
('rtti', True), # go/undefined-symbol-typeinfo
],
'cronet_aml_base_base': [
- ('header_libs', set(["media_ndk_headers"])),
+ ('header_libs', {"media_ndk_headers"}),
],
}
@@ -963,8 +963,8 @@
# So adding -UANDROID to cancel default -DANDROID if it's not specified.
# This is needed for some targets(e.g. symbolize)
# TODO: Set -UANDROID considering common define
- # if "ANDROID" not in defines:
- # cflags.add("-UANDROID")
+ if "ANDROID" not in defines:
+ cflags.add("-UANDROID")
return cflags
def set_module_flags(module, cflags, defines):