Allow selection between libstdc++ and libc++ when targeting iOS

The recommended C++ library on iOS is libc++ but the compiler still default
to libstdc++ so add a new gyp variable "use_system_libcxx" to choose which
C++ library to use.

When building Chrome for iOS, so tool are still build on the host which
targets Mac OS X SDK 10.6 which does not supports libc++ so only enabled the
usage of libc++ when not building for the host.

The version of clang shipped on Google storage does not supports using the
system libc++ so instead use the version of clang shipped with Xcode when
using libc++.

BUG=366744

Review URL: https://codereview.chromium.org/425313002

git-svn-id: http://src.chromium.org/svn/trunk/src/build@287321 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
sdefresne@chromium.org 2014-08-04 11:28:06 +00:00
Родитель d5a7ed5eee
Коммит 15637a1f19
1 изменённых файлов: 22 добавлений и 1 удалений

Просмотреть файл

@ -410,6 +410,10 @@
# builds.
'use_custom_libcxx%': 0,
# Use system libc++ instead of the default C++ library, usually libstdc++.
# This is intended for iOS builds only.
'use_system_libcxx%': 0,
# Use a modified version of Clang to intercept allocated types and sizes
# for allocated objects. clang_type_profiler=1 implies clang=1.
# See http://dev.chromium.org/developers/deep-memory-profiler/cpp-object-type-identifier
@ -1094,6 +1098,7 @@
'ubsan_vptr_blacklist%': '<(ubsan_vptr_blacklist)',
'use_instrumented_libraries%': '<(use_instrumented_libraries)',
'use_custom_libcxx%': '<(use_custom_libcxx)',
'use_system_libcxx%': '<(use_system_libcxx)',
'clang_type_profiler%': '<(clang_type_profiler)',
'order_profiling%': '<(order_profiling)',
'order_text_section%': '<(order_text_section)',
@ -1456,6 +1461,12 @@
'use_chromevox_next%': 0,
'conditions': [
# The version of clang shipped upstream does not find C++ headers when
# using -stdlib=libc++ so we instead need to use the version of clang
# coming with Xcode.
['OS=="ios" and use_system_libcxx==1', {
'clang_xcode%': 1,
}],
# Enable the Syzygy optimization step for the official builds.
['OS=="win" and buildtype=="Official" and syzyasan!=1', {
'syzygy_optimize%': 1,
@ -4999,6 +5010,16 @@
['target_subarch=="both"', {
'VALID_ARCHS': ['arm64', 'armv7', 'x86_64', 'i386'],
}],
['use_system_libcxx==1', {
'target_conditions': [
# Only use libc++ when building target for iOS not when building
# tools for the host (OS X) as Mac targets OS X SDK 10.6 which
# does not support libc++.
['_toolset=="target"', {
'CLANG_CXX_LIBRARY': 'libc++', # -stdlib=libc++
}]
],
}],
],
},
'target_conditions': [
@ -5233,7 +5254,7 @@
# on program correctness and there's no real reason to waste time
# trying to prevent it.
4503,
# C4611: interaction between 'function' and C++ object destruction is
# non-portable
# This warning is unavoidable when using e.g. setjmp/longjmp. MSDN