meson: Check arguments before adding.

-static-libstdc++ doesn't exist on the Android NDK, casuing all
later has_argument calls to return false even though the compiler
supports that argument.

Fixes: 3aee462781 "meson: add windows compiler checks and libraries"
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13164>
This commit is contained in:
Bas Nieuwenhuizen 2021-10-26 00:27:53 +02:00 committed by Marge Bot
parent 5db098c98b
commit 22673a980f
3 changed files with 18 additions and 7 deletions

View File

@ -376,7 +376,7 @@ debian/android_build:
extends:
- .use-debian/x86_build-base
variables:
MESA_IMAGE_TAG: &debian-android_build "2021-10-02-libelf-2"
MESA_IMAGE_TAG: &debian-android_build "2021-10-26-static-libstdcxx"
.use-debian/android_build:
extends:

View File

@ -17,7 +17,7 @@ cat >$cross_file <<EOF
[binaries]
ar = '$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/$arch-ar'
c = ['ccache', '$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/${arch2}29-clang', '-fno-exceptions', '-fno-unwind-tables', '-fno-asynchronous-unwind-tables']
cpp = ['ccache', '$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/${arch2}29-clang++', '-fno-exceptions', '-fno-unwind-tables', '-fno-asynchronous-unwind-tables', '-static-libstdc++']
cpp = ['ccache', '$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/${arch2}29-clang++', '-fno-exceptions', '-fno-unwind-tables', '-fno-asynchronous-unwind-tables']
c_ld = 'lld'
cpp_ld = 'lld'
strip = '$ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/$arch-strip'

View File

@ -1213,11 +1213,22 @@ if host_machine.system() == 'windows'
endif
else
add_project_link_arguments(
'-Wl,--nxcompat',
'-Wl,--dynamicbase',
'-static-libgcc',
'-static-libstdc++',
language : ['c', 'cpp'],
cc.get_supported_arguments(
'-Wl,--nxcompat',
'-Wl,--dynamicbase',
'-static-libgcc',
'-static-libstdc++',
),
language : ['c'],
)
add_project_link_arguments(
cpp.get_supported_arguments(
'-Wl,--nxcompat',
'-Wl,--dynamicbase',
'-static-libgcc',
'-static-libstdc++',
),
language : ['cpp'],
)
endif
endif